Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: skia/ext/SkDiscardableMemory_chrome.cc

Issue 17106004: Add discardable memory emulation for non-android/mac platforms (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix MemoryAfterUnlock test Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698