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

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

Issue 342943008: base: Increase hard limit for emulated discardable memory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
« no previous file with comments | « no previous file | no next file » | 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 "base/memory/discardable_memory_emulated.h" 5 #include "base/memory/discardable_memory_emulated.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/memory/discardable_memory_manager.h" 8 #include "base/memory/discardable_memory_manager.h"
9 9
10 namespace base { 10 namespace base {
11 namespace { 11 namespace {
12 12
13 // This is admittedly pretty magical. It's approximately enough memory for four 13 // This is admittedly pretty magical.
14 // 2560x1600 images. 14 const size_t kEmulatedMemoryLimit = 512 * 1024 * 1024;
15 const size_t kEmulatedMemoryLimit = 64 * 1024 * 1024; 15 const size_t kEmulatedSoftMemoryLimit = 32 * 1024 * 1024;
16 const size_t kEmulatedBytesToKeepUnderModeratePressure = 16 const size_t kEmulatedBytesToKeepUnderModeratePressure = 4 * 1024 * 1024;
17 kEmulatedMemoryLimit / 4; 17 const size_t kEmulatedHardMemoryLimitExpirationTimeMs = 1000;
18 18
19 struct SharedState { 19 struct SharedState {
20 SharedState() 20 SharedState()
21 : manager(kEmulatedMemoryLimit, 21 : manager(kEmulatedMemoryLimit,
22 kEmulatedMemoryLimit, 22 kEmulatedSoftMemoryLimit,
23 kEmulatedBytesToKeepUnderModeratePressure, 23 kEmulatedBytesToKeepUnderModeratePressure,
24 TimeDelta::Max()) {} 24 TimeDelta::FromMilliseconds(
25 kEmulatedHardMemoryLimitExpirationTimeMs)) {}
25 26
26 internal::DiscardableMemoryManager manager; 27 internal::DiscardableMemoryManager manager;
27 }; 28 };
28 LazyInstance<SharedState>::Leaky g_shared_state = LAZY_INSTANCE_INITIALIZER; 29 LazyInstance<SharedState>::Leaky g_shared_state = LAZY_INSTANCE_INITIALIZER;
29 30
30 } // namespace 31 } // namespace
31 32
32 namespace internal { 33 namespace internal {
33 34
34 DiscardableMemoryEmulated::DiscardableMemoryEmulated(size_t bytes) 35 DiscardableMemoryEmulated::DiscardableMemoryEmulated(size_t bytes)
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 memory_.reset(new uint8[bytes_]); 99 memory_.reset(new uint8[bytes_]);
99 return false; 100 return false;
100 } 101 }
101 102
102 void DiscardableMemoryEmulated::Purge() { 103 void DiscardableMemoryEmulated::Purge() {
103 memory_.reset(); 104 memory_.reset();
104 } 105 }
105 106
106 } // namespace internal 107 } // namespace internal
107 } // namespace base 108 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698