OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/common/host_discardable_shared_memory_manager.h" | 5 #include "content/common/host_discardable_shared_memory_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/debug/crash_logging.h" | 10 #include "base/debug/crash_logging.h" |
11 #include "base/debug/trace_event.h" | |
12 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
13 #include "base/numerics/safe_math.h" | 12 #include "base/numerics/safe_math.h" |
14 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/trace_event/trace_event.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 namespace { | 17 namespace { |
18 | 18 |
19 base::LazyInstance<HostDiscardableSharedMemoryManager> | 19 base::LazyInstance<HostDiscardableSharedMemoryManager> |
20 g_discardable_shared_memory_manager = LAZY_INSTANCE_INITIALIZER; | 20 g_discardable_shared_memory_manager = LAZY_INSTANCE_INITIALIZER; |
21 | 21 |
22 const size_t kDefaultMemoryLimit = 512 * 1024 * 1024; | 22 const size_t kDefaultMemoryLimit = 512 * 1024 * 1024; |
23 | 23 |
24 const int kEnforceMemoryPolicyDelayMs = 1000; | 24 const int kEnforceMemoryPolicyDelayMs = 1000; |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 | 247 |
248 enforce_memory_policy_pending_ = true; | 248 enforce_memory_policy_pending_ = true; |
249 base::MessageLoop::current()->PostDelayedTask( | 249 base::MessageLoop::current()->PostDelayedTask( |
250 FROM_HERE, | 250 FROM_HERE, |
251 base::Bind(&HostDiscardableSharedMemoryManager::EnforceMemoryPolicy, | 251 base::Bind(&HostDiscardableSharedMemoryManager::EnforceMemoryPolicy, |
252 weak_ptr_factory_.GetWeakPtr()), | 252 weak_ptr_factory_.GetWeakPtr()), |
253 base::TimeDelta::FromMilliseconds(kEnforceMemoryPolicyDelayMs)); | 253 base::TimeDelta::FromMilliseconds(kEnforceMemoryPolicyDelayMs)); |
254 } | 254 } |
255 | 255 |
256 } // namespace content | 256 } // namespace content |
OLD | NEW |