OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "SkDiscardableMemory_chrome.h" | 5 #include "SkDiscardableMemory_chrome.h" |
6 | 6 |
7 SkDiscardableMemoryChrome::~SkDiscardableMemoryChrome() {} | 7 SkDiscardableMemoryChrome::~SkDiscardableMemoryChrome() {} |
8 | 8 |
9 bool SkDiscardableMemoryChrome::lock() { | 9 bool SkDiscardableMemoryChrome::lock() { |
10 const base::LockDiscardableMemoryStatus status = discardable_->Lock(); | 10 const base::LockDiscardableMemoryStatus status = discardable_->Lock(); |
(...skipping 16 matching lines...) Expand all Loading... |
27 void SkDiscardableMemoryChrome::unlock() { | 27 void SkDiscardableMemoryChrome::unlock() { |
28 discardable_->Unlock(); | 28 discardable_->Unlock(); |
29 } | 29 } |
30 | 30 |
31 SkDiscardableMemoryChrome::SkDiscardableMemoryChrome( | 31 SkDiscardableMemoryChrome::SkDiscardableMemoryChrome( |
32 scoped_ptr<base::DiscardableMemory> memory) | 32 scoped_ptr<base::DiscardableMemory> memory) |
33 : discardable_(memory.Pass()) { | 33 : discardable_(memory.Pass()) { |
34 } | 34 } |
35 | 35 |
36 SkDiscardableMemory* SkDiscardableMemory::Create(size_t bytes) { | 36 SkDiscardableMemory* SkDiscardableMemory::Create(size_t bytes) { |
37 if (!base::DiscardableMemory::Supported()) | |
38 return NULL; | |
39 scoped_ptr<base::DiscardableMemory> discardable( | 37 scoped_ptr<base::DiscardableMemory> discardable( |
40 base::DiscardableMemory::CreateLockedMemory(bytes)); | 38 base::DiscardableMemory::CreateLockedMemory(bytes)); |
41 if (!discardable) | 39 if (!discardable) |
42 return NULL; | 40 return NULL; |
43 return new SkDiscardableMemoryChrome(discardable.Pass()); | 41 return new SkDiscardableMemoryChrome(discardable.Pass()); |
44 } | 42 } |
OLD | NEW |