SkDiscardableMemory_chrome.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. #ifndef SKIA_EXT_SKDISCARDABLEMEMORY_CHROME_H_
  5. #define SKIA_EXT_SKDISCARDABLEMEMORY_CHROME_H_
  6. #include <memory>
  7. #include "third_party/skia/src/core/SkDiscardableMemory.h"
  8. namespace base {
  9. class DiscardableMemory;
  10. namespace trace_event {
  11. class MemoryAllocatorDump;
  12. class ProcessMemoryDump;
  13. }
  14. } // namespace base
  15. // This class implements the SkDiscardableMemory interface using
  16. // base::DiscardableMemory.
  17. class SK_API SkDiscardableMemoryChrome : public SkDiscardableMemory {
  18. public:
  19. ~SkDiscardableMemoryChrome() override;
  20. // SkDiscardableMemory:
  21. bool lock() override;
  22. void* data() override;
  23. void unlock() override;
  24. base::trace_event::MemoryAllocatorDump* CreateMemoryAllocatorDump(
  25. const char* name,
  26. base::trace_event::ProcessMemoryDump* pmd) const;
  27. private:
  28. friend class SkDiscardableMemory;
  29. SkDiscardableMemoryChrome(std::unique_ptr<base::DiscardableMemory> memory);
  30. std::unique_ptr<base::DiscardableMemory> discardable_;
  31. };
  32. #endif // SKIA_EXT_SKDISCARDABLEMEMORY_CHROME_H_