1 // Copyright 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef SKIA_EXT_SK_DISCARDABLE_MEMORY_CHROME_H_ 6 #define SKIA_EXT_SK_DISCARDABLE_MEMORY_CHROME_H_ 7 8 #include "base/memory/discardable_memory.h" 9 #include "base/memory/scoped_ptr.h" 10 #include "third_party/skia/src/core/SkDiscardableMemory.h" 11 12 // This class implements the SkDiscardableMemory interface using 13 // base::DiscardableMemory. 14 class SK_API SkDiscardableMemoryChrome : public SkDiscardableMemory { 15 public: 16 virtual ~SkDiscardableMemoryChrome(); 17 18 // SkDiscardableMemory: 19 virtual bool lock() OVERRIDE; 20 virtual void* data() OVERRIDE; 21 virtual void unlock() OVERRIDE; 22 23 private: 24 friend class SkDiscardableMemory; 25 26 SkDiscardableMemoryChrome(scoped_ptr<base::DiscardableMemory> memory); 27 28 scoped_ptr<base::DiscardableMemory> discardable_; 29 }; 30 31 #endif // SKIA_EXT_SK_DISCARDABLE_MEMORY_CHROME_H_ 32