| 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 if (iter == children_.end()) | 221 if (iter == children_.end()) |
| 222 return MemoryState::UNKNOWN; | 222 return MemoryState::UNKNOWN; |
| 223 return iter->second.memory_state; | 223 return iter->second.memory_state; |
| 224 } | 224 } |
| 225 | 225 |
| 226 void MemoryCoordinatorImpl::RecordMemoryPressure( | 226 void MemoryCoordinatorImpl::RecordMemoryPressure( |
| 227 base::MemoryPressureMonitor::MemoryPressureLevel level) { | 227 base::MemoryPressureMonitor::MemoryPressureLevel level) { |
| 228 // TODO(bashi): Record memory pressure level. | 228 // TODO(bashi): Record memory pressure level. |
| 229 } | 229 } |
| 230 | 230 |
| 231 MemoryState MemoryCoordinatorImpl::GetBrowserMemoryState() const { | 231 MemoryState MemoryCoordinatorImpl::GetCurrentMemoryState() const { |
| 232 return browser_memory_state_; | 232 return browser_memory_state_; |
| 233 } | 233 } |
| 234 | 234 |
| 235 MemoryState MemoryCoordinatorImpl::GetCurrentMemoryState() const { | |
| 236 return GetBrowserMemoryState(); | |
| 237 } | |
| 238 | |
| 239 void MemoryCoordinatorImpl::SetCurrentMemoryStateForTesting( | 235 void MemoryCoordinatorImpl::SetCurrentMemoryStateForTesting( |
| 240 MemoryState memory_state) { | 236 MemoryState memory_state) { |
| 241 // Resets |last_state_change_| so that | 237 // Resets |last_state_change_| so that |
| 242 // UpdateBrowserStateAndNotifyStateToClients() to set memory state forcibly. | 238 // UpdateBrowserStateAndNotifyStateToClients() to set memory state forcibly. |
| 243 last_state_change_ = base::TimeTicks(); | 239 last_state_change_ = base::TimeTicks(); |
| 244 UpdateBrowserStateAndNotifyStateToClients(memory_state); | 240 UpdateBrowserStateAndNotifyStateToClients(memory_state); |
| 245 } | 241 } |
| 246 | 242 |
| 247 void MemoryCoordinatorImpl::ForceSetMemoryCondition(MemoryCondition condition, | 243 void MemoryCoordinatorImpl::ForceSetMemoryCondition(MemoryCondition condition, |
| 248 base::TimeDelta duration) { | 244 base::TimeDelta duration) { |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 | 439 |
| 444 MemoryCoordinatorImpl::ChildInfo::ChildInfo() {} | 440 MemoryCoordinatorImpl::ChildInfo::ChildInfo() {} |
| 445 | 441 |
| 446 MemoryCoordinatorImpl::ChildInfo::ChildInfo(const ChildInfo& rhs) { | 442 MemoryCoordinatorImpl::ChildInfo::ChildInfo(const ChildInfo& rhs) { |
| 447 // This is a nop, but exists for compatibility with STL containers. | 443 // This is a nop, but exists for compatibility with STL containers. |
| 448 } | 444 } |
| 449 | 445 |
| 450 MemoryCoordinatorImpl::ChildInfo::~ChildInfo() {} | 446 MemoryCoordinatorImpl::ChildInfo::~ChildInfo() {} |
| 451 | 447 |
| 452 } // namespace content | 448 } // namespace content |
| OLD | NEW |