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

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: address review feedback Created 7 years, 2 months 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 : discardable_(new base::DiscardableMemory()) { 8 : discardable_(new base::DiscardableMemory()) {
9 } 9 }
10 10
(...skipping 20 matching lines...) Expand all
31 31
32 void SkDiscardableMemoryChrome::unlock() { 32 void SkDiscardableMemoryChrome::unlock() {
33 discardable_->Unlock(); 33 discardable_->Unlock();
34 } 34 }
35 35
36 bool SkDiscardableMemoryChrome::InitializeAndLock(size_t bytes) { 36 bool SkDiscardableMemoryChrome::InitializeAndLock(size_t bytes) {
37 return discardable_->InitializeAndLock(bytes); 37 return discardable_->InitializeAndLock(bytes);
38 } 38 }
39 39
40 SkDiscardableMemory* SkDiscardableMemory::Create(size_t bytes) { 40 SkDiscardableMemory* SkDiscardableMemory::Create(size_t bytes) {
41 if (!base::DiscardableMemory::Supported()) {
42 return NULL;
43 }
44 scoped_ptr<SkDiscardableMemoryChrome> discardable( 41 scoped_ptr<SkDiscardableMemoryChrome> discardable(
45 new SkDiscardableMemoryChrome()); 42 new SkDiscardableMemoryChrome());
46 if (discardable->InitializeAndLock(bytes)) 43 if (discardable->InitializeAndLock(bytes))
47 return discardable.release(); 44 return discardable.release();
48 return NULL; 45 return NULL;
49 } 46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698