OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/browser/memory/memory_coordinator_impl.h" | 5 #include "content/browser/memory/memory_coordinator_impl.h" |
6 | 6 |
7 #include "base/memory/memory_coordinator_client_registry.h" | 7 #include "base/memory/memory_coordinator_client_registry.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 return false; | 266 return false; |
267 | 267 |
268 // Set |can_purge_after| to the maximum value to suppress another purge | 268 // Set |can_purge_after| to the maximum value to suppress another purge |
269 // request until the child process goes foreground and then goes background | 269 // request until the child process goes foreground and then goes background |
270 // again. | 270 // again. |
271 iter->second.can_purge_after = base::TimeTicks::Max(); | 271 iter->second.can_purge_after = base::TimeTicks::Max(); |
272 handle->child()->PurgeMemory(); | 272 handle->child()->PurgeMemory(); |
273 return true; | 273 return true; |
274 } | 274 } |
275 | 275 |
276 void MemoryCoordinatorImpl::RecordMemoryPressure( | |
277 base::MemoryPressureMonitor::MemoryPressureLevel level) { | |
278 // TODO(bashi): Record memory pressure level. | |
279 } | |
280 | |
281 MemoryState MemoryCoordinatorImpl::GetCurrentMemoryState() const { | 276 MemoryState MemoryCoordinatorImpl::GetCurrentMemoryState() const { |
282 return browser_memory_state_; | 277 return browser_memory_state_; |
283 } | 278 } |
284 | 279 |
285 void MemoryCoordinatorImpl::ForceSetMemoryCondition(MemoryCondition condition, | 280 void MemoryCoordinatorImpl::ForceSetMemoryCondition(MemoryCondition condition, |
286 base::TimeDelta duration) { | 281 base::TimeDelta duration) { |
287 UpdateConditionIfNeeded(condition); | 282 UpdateConditionIfNeeded(condition); |
288 suppress_condition_change_until_ = tick_clock_->NowTicks() + duration; | 283 suppress_condition_change_until_ = tick_clock_->NowTicks() + duration; |
289 } | 284 } |
290 | 285 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 | 415 |
421 MemoryCoordinatorImpl::ChildInfo::ChildInfo() {} | 416 MemoryCoordinatorImpl::ChildInfo::ChildInfo() {} |
422 | 417 |
423 MemoryCoordinatorImpl::ChildInfo::ChildInfo(const ChildInfo& rhs) { | 418 MemoryCoordinatorImpl::ChildInfo::ChildInfo(const ChildInfo& rhs) { |
424 // This is a nop, but exists for compatibility with STL containers. | 419 // This is a nop, but exists for compatibility with STL containers. |
425 } | 420 } |
426 | 421 |
427 MemoryCoordinatorImpl::ChildInfo::~ChildInfo() {} | 422 MemoryCoordinatorImpl::ChildInfo::~ChildInfo() {} |
428 | 423 |
429 } // namespace content | 424 } // namespace content |
OLD | NEW |