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

Side by Side Diff: base/memory/discardable_memory.cc

Issue 15650016: [Not for review] Discardable memory emulation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 6 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "base/memory/discardable_memory.h" 5 #include "base/memory/discardable_memory.h"
6 6
7 #include "base/logging.h"
8
9 namespace base { 7 namespace base {
10 8
11 DiscardableMemory::DiscardableMemory() 9 #if !defined(DISCARDABLE_MEMORY_SUPPORTED_NATIVELY)
12 : memory_(NULL), 10 static DiscardableMemoryProvider* s_factory = NULL;
13 size_(0),
14 is_locked_(false)
15 #if defined(OS_ANDROID)
16 , fd_(-1)
17 #endif // OS_ANDROID
18 {
19 DCHECK(Supported());
20 }
21 11
22 void* DiscardableMemory::Memory() const { 12 // static
23 DCHECK(is_locked_); 13 DiscardableMemoryProvider* DiscardableMemoryProvider::GetInstance() {
24 return memory_; 14 return s_factory;
25 }
26
27 // Stub implementations for platforms that don't support discardable memory.
28
29 #if !defined(OS_ANDROID) && !defined(OS_MACOSX)
30
31 DiscardableMemory::~DiscardableMemory() {
32 NOTIMPLEMENTED();
33 } 15 }
34 16
35 // static 17 // static
36 bool DiscardableMemory::Supported() { 18 void DiscardableMemoryProvider::SetInstance(
37 return false; 19 DiscardableMemoryProvider* factory) {
20 s_factory = factory;
21 }
22 #endif
23
24 DiscardableMemory::~DiscardableMemory() {
38 } 25 }
39 26
40 bool DiscardableMemory::InitializeAndLock(size_t size) {
41 NOTIMPLEMENTED();
42 return false;
43 }
44
45 LockDiscardableMemoryStatus DiscardableMemory::Lock() {
46 NOTIMPLEMENTED();
47 return DISCARDABLE_MEMORY_FAILED;
48 }
49
50 void DiscardableMemory::Unlock() {
51 NOTIMPLEMENTED();
52 }
53
54 // static
55 bool DiscardableMemory::PurgeForTestingSupported() {
56 return false;
57 }
58
59 // static
60 void DiscardableMemory::PurgeForTesting() {
61 NOTIMPLEMENTED();
62 }
63
64 #endif // OS_*
65
66 } // namespace base 27 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698