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

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

Issue 114923005: base: Discardable memory types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review feedback Created 7 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/memory/discardable_memory.h"
6
7 #include "base/lazy_instance.h"
8
9 namespace base {
10 namespace {
11
12 struct TypeInitializedWithPreferredValue {
13 TypeInitializedWithPreferredValue() : value(DISCARDABLE_MEMORY_TYPE_NONE) {
14 std::vector<DiscardableMemoryType> supported_types;
15 DiscardableMemory::GetSupportedTypes(&supported_types);
16 DCHECK(!supported_types.empty());
17 value = supported_types.front();
18 }
19 DiscardableMemoryType value;
20 };
21 LazyInstance<TypeInitializedWithPreferredValue>::Leaky
22 g_discardable_memory_type = LAZY_INSTANCE_INITIALIZER;
23
24 } // namespace
25
26 // static
27 void DiscardableMemory::SetType(DiscardableMemoryType type) {
28 g_discardable_memory_type.Get().value = type;
29 }
30
31 // static
32 DiscardableMemoryType DiscardableMemory::GetType() {
33 return g_discardable_memory_type.Get().value;
34 }
35
36 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698