| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 MemoryCoordinatorImplSingletonTraits>::get(); | 166 MemoryCoordinatorImplSingletonTraits>::get(); |
| 167 } | 167 } |
| 168 | 168 |
| 169 MemoryCoordinatorImpl::MemoryCoordinatorImpl( | 169 MemoryCoordinatorImpl::MemoryCoordinatorImpl( |
| 170 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 170 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 171 std::unique_ptr<MemoryMonitor> memory_monitor) | 171 std::unique_ptr<MemoryMonitor> memory_monitor) |
| 172 : delegate_(GetContentClient()->browser()->GetMemoryCoordinatorDelegate()), | 172 : delegate_(GetContentClient()->browser()->GetMemoryCoordinatorDelegate()), |
| 173 memory_monitor_(std::move(memory_monitor)), | 173 memory_monitor_(std::move(memory_monitor)), |
| 174 state_updater_(base::MakeUnique<MemoryStateUpdater>(this, task_runner)) { | 174 state_updater_(base::MakeUnique<MemoryStateUpdater>(this, task_runner)) { |
| 175 DCHECK(memory_monitor_.get()); | 175 DCHECK(memory_monitor_.get()); |
| 176 base::MemoryCoordinatorProxy::SetMemoryCoordinator(this); |
| 176 } | 177 } |
| 177 | 178 |
| 178 MemoryCoordinatorImpl::~MemoryCoordinatorImpl() {} | 179 MemoryCoordinatorImpl::~MemoryCoordinatorImpl() {} |
| 179 | 180 |
| 180 void MemoryCoordinatorImpl::Start() { | 181 void MemoryCoordinatorImpl::Start() { |
| 181 DCHECK(CalledOnValidThread()); | 182 DCHECK(CalledOnValidThread()); |
| 182 DCHECK(last_state_change_.is_null()); | 183 DCHECK(last_state_change_.is_null()); |
| 183 | 184 |
| 184 notification_registrar_.Add( | 185 notification_registrar_.Add( |
| 185 this, NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, | 186 this, NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 | 457 |
| 457 MemoryCoordinatorImpl::ChildInfo::ChildInfo() {} | 458 MemoryCoordinatorImpl::ChildInfo::ChildInfo() {} |
| 458 | 459 |
| 459 MemoryCoordinatorImpl::ChildInfo::ChildInfo(const ChildInfo& rhs) { | 460 MemoryCoordinatorImpl::ChildInfo::ChildInfo(const ChildInfo& rhs) { |
| 460 // This is a nop, but exists for compatibility with STL containers. | 461 // This is a nop, but exists for compatibility with STL containers. |
| 461 } | 462 } |
| 462 | 463 |
| 463 MemoryCoordinatorImpl::ChildInfo::~ChildInfo() {} | 464 MemoryCoordinatorImpl::ChildInfo::~ChildInfo() {} |
| 464 | 465 |
| 465 } // namespace content | 466 } // namespace content |
| OLD | NEW |