gfx/skia/trunk/src/core/SkDiscardableMemory.h

Wed, 31 Dec 2014 07:53:36 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:53:36 +0100
branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
permissions
-rw-r--r--

Correct small whitespace inconsistency, lost while renaming variables.

     1 /*
     2  * Copyright 2013 Google Inc.
     3  *
     4  * Use of this source code is governed by a BSD-style license that can be
     5  * found in the LICENSE file.
     6  */
     8 #ifndef SkDiscardableMemory_DEFINED
     9 #define SkDiscardableMemory_DEFINED
    11 #include "SkRefCnt.h"
    12 #include "SkTypes.h"
    14 /**
    15  *  Interface for discardable memory. Implementation is provided by the
    16  *  embedder.
    17  */
    18 class SK_API SkDiscardableMemory {
    19 public:
    20     /**
    21      *  Factory method that creates, initializes and locks an SkDiscardableMemory
    22      *  object. If either of these steps fails, a NULL pointer will be returned.
    23      */
    24     static SkDiscardableMemory* Create(size_t bytes);
    26     /**
    27      *  Factory class that creates, initializes and locks an SkDiscardableMemory
    28      *  object. If either of these steps fails, a NULL pointer will be returned.
    29      */
    30     class Factory : public SkRefCnt {
    31     public:
    32         virtual SkDiscardableMemory* create(size_t bytes) = 0;
    33     private:
    34         typedef SkRefCnt INHERITED;
    35     };
    37     /** Must not be called while locked.
    38      */
    39     virtual ~SkDiscardableMemory() {}
    41     /**
    42      * Locks the memory, prevent it from being discarded. Once locked. you may
    43      * obtain a pointer to that memory using the data() method.
    44      *
    45      * lock() may return false, indicating that the underlying memory was
    46      * discarded and that the lock failed.
    47      *
    48      * Nested calls to lock are not allowed.
    49      */
    50     virtual bool lock() = 0;
    52     /**
    53      * Returns the current pointer for the discardable memory. This call is ONLY
    54      * valid when the discardable memory object is locked.
    55      */
    56     virtual void* data() = 0;
    58     /**
    59      * Unlock the memory so that it can be purged by the system. Must be called
    60      * after every successful lock call.
    61      */
    62     virtual void unlock() = 0;
    63 };
    65 #endif

mercurial