summaryrefslogtreecommitdiffstats
path: root/skia/ext/SkDiscardableMemory_chrome.h
blob: 1be4516be168b90648940b5dbb03f13747a29963 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef SKIA_EXT_SK_DISCARDABLE_MEMORY_CHROME_H_
#define SKIA_EXT_SK_DISCARDABLE_MEMORY_CHROME_H_

#include "base/memory/scoped_ptr.h"
#include "third_party/skia/src/core/SkDiscardableMemory.h"

namespace base {
class DiscardableMemory;
}

// This class implements the SkDiscardableMemory interface using
// base::DiscardableMemory.
class SK_API SkDiscardableMemoryChrome : public SkDiscardableMemory {
public:
 ~SkDiscardableMemoryChrome() override;

  // SkDiscardableMemory:
 bool lock() override;
 void* data() override;
 void unlock() override;

private:
  friend class SkDiscardableMemory;

  SkDiscardableMemoryChrome(scoped_ptr<base::DiscardableMemory> memory);

  scoped_ptr<base::DiscardableMemory> discardable_;
};

#endif  // SKIA_EXT_SK_DISCARDABLE_MEMORY_CHROME_H_