| 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/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/process/process_handle.h" | 9 #include "base/process/process_handle.h" |
| 10 #include "base/process/process_metrics.h" | 10 #include "base/process/process_metrics.h" |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 RecordStateChange(prev_state, next_state, | 312 RecordStateChange(prev_state, next_state, |
| 313 last_state_change_ - prev_last_state_change); | 313 last_state_change_ - prev_last_state_change); |
| 314 NotifyStateToClients(); | 314 NotifyStateToClients(); |
| 315 NotifyStateToChildren(); | 315 NotifyStateToChildren(); |
| 316 return true; | 316 return true; |
| 317 } | 317 } |
| 318 | 318 |
| 319 void MemoryCoordinatorImpl::AddChildForTesting( | 319 void MemoryCoordinatorImpl::AddChildForTesting( |
| 320 int dummy_render_process_id, mojom::ChildMemoryCoordinatorPtr child) { | 320 int dummy_render_process_id, mojom::ChildMemoryCoordinatorPtr child) { |
| 321 mojom::MemoryCoordinatorHandlePtr mch; | 321 mojom::MemoryCoordinatorHandlePtr mch; |
| 322 auto request = mojo::GetProxy(&mch); | 322 auto request = mojo::MakeRequest(&mch); |
| 323 std::unique_ptr<MemoryCoordinatorHandleImpl> handle( | 323 std::unique_ptr<MemoryCoordinatorHandleImpl> handle( |
| 324 new MemoryCoordinatorHandleImpl(std::move(request), this, | 324 new MemoryCoordinatorHandleImpl(std::move(request), this, |
| 325 dummy_render_process_id)); | 325 dummy_render_process_id)); |
| 326 handle->AddChild(std::move(child)); | 326 handle->AddChild(std::move(child)); |
| 327 CreateChildInfoMapEntry(dummy_render_process_id, std::move(handle)); | 327 CreateChildInfoMapEntry(dummy_render_process_id, std::move(handle)); |
| 328 } | 328 } |
| 329 | 329 |
| 330 void MemoryCoordinatorImpl::OnConnectionError(int render_process_id) { | 330 void MemoryCoordinatorImpl::OnConnectionError(int render_process_id) { |
| 331 children_.erase(render_process_id); | 331 children_.erase(render_process_id); |
| 332 } | 332 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 | 428 |
| 429 MemoryCoordinatorImpl::ChildInfo::ChildInfo() {} | 429 MemoryCoordinatorImpl::ChildInfo::ChildInfo() {} |
| 430 | 430 |
| 431 MemoryCoordinatorImpl::ChildInfo::ChildInfo(const ChildInfo& rhs) { | 431 MemoryCoordinatorImpl::ChildInfo::ChildInfo(const ChildInfo& rhs) { |
| 432 // This is a nop, but exists for compatibility with STL containers. | 432 // This is a nop, but exists for compatibility with STL containers. |
| 433 } | 433 } |
| 434 | 434 |
| 435 MemoryCoordinatorImpl::ChildInfo::~ChildInfo() {} | 435 MemoryCoordinatorImpl::ChildInfo::~ChildInfo() {} |
| 436 | 436 |
| 437 } // namespace content | 437 } // namespace content |
| OLD | NEW |