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

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

Issue 1001833005: Update from https://crrev.com/320343 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Supress Created 5 years, 9 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
« no previous file with comments | « skia/config/SkUserConfig.h ('k') | skia/ext/analysis_canvas.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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::DiscardableMemoryLockStatus status = discardable_->Lock(); 10 return discardable_->Lock();
11 switch (status) {
12 case base::DISCARDABLE_MEMORY_LOCK_STATUS_SUCCESS:
13 return true;
14 case base::DISCARDABLE_MEMORY_LOCK_STATUS_PURGED:
15 discardable_->Unlock();
16 return false;
17 default:
18 discardable_.reset();
19 return false;
20 }
21 } 11 }
22 12
23 void* SkDiscardableMemoryChrome::data() { 13 void* SkDiscardableMemoryChrome::data() {
24 return discardable_->Memory(); 14 return discardable_->Memory();
25 } 15 }
26 16
27 void SkDiscardableMemoryChrome::unlock() { 17 void SkDiscardableMemoryChrome::unlock() {
28 discardable_->Unlock(); 18 discardable_->Unlock();
29 } 19 }
30 20
31 SkDiscardableMemoryChrome::SkDiscardableMemoryChrome( 21 SkDiscardableMemoryChrome::SkDiscardableMemoryChrome(
32 scoped_ptr<base::DiscardableMemory> memory) 22 scoped_ptr<base::DiscardableMemory> memory)
33 : discardable_(memory.Pass()) { 23 : discardable_(memory.Pass()) {
34 } 24 }
35 25
36 SkDiscardableMemory* SkDiscardableMemory::Create(size_t bytes) { 26 SkDiscardableMemory* SkDiscardableMemory::Create(size_t bytes) {
37 scoped_ptr<base::DiscardableMemory> discardable( 27 return new SkDiscardableMemoryChrome(
38 base::DiscardableMemory::CreateLockedMemory(bytes)); 28 base::DiscardableMemory::CreateLockedMemory(bytes));
39 if (!discardable)
40 return NULL;
41 return new SkDiscardableMemoryChrome(discardable.Pass());
42 } 29 }
OLDNEW
« no previous file with comments | « skia/config/SkUserConfig.h ('k') | skia/ext/analysis_canvas.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698