Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / skia / ext / SkDiscardableMemory_chrome.h
blob93a7807b5f2026e57277eeb5a16d25453486c04b
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.
5 #ifndef SKIA_EXT_SK_DISCARDABLE_MEMORY_CHROME_H_
6 #define SKIA_EXT_SK_DISCARDABLE_MEMORY_CHROME_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "third_party/skia/src/core/SkDiscardableMemory.h"
11 namespace base {
12 class DiscardableMemory;
14 namespace trace_event {
15 class MemoryAllocatorDump;
16 class ProcessMemoryDump;
19 } // namespace base
21 // This class implements the SkDiscardableMemory interface using
22 // base::DiscardableMemory.
23 class SK_API SkDiscardableMemoryChrome : public SkDiscardableMemory {
24 public:
25 ~SkDiscardableMemoryChrome() override;
27 // SkDiscardableMemory:
28 bool lock() override;
29 void* data() override;
30 void unlock() override;
32 base::trace_event::MemoryAllocatorDump* CreateMemoryAllocatorDump(
33 const char* name,
34 base::trace_event::ProcessMemoryDump* pmd) const;
36 private:
37 friend class SkDiscardableMemory;
39 SkDiscardableMemoryChrome(scoped_ptr<base::DiscardableMemory> memory);
41 scoped_ptr<base::DiscardableMemory> discardable_;
44 #endif // SKIA_EXT_SK_DISCARDABLE_MEMORY_CHROME_H_