| 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/child/memory/child_memory_coordinator_impl.h" | 5 #include "content/child/memory/child_memory_coordinator_impl.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/memory/memory_coordinator_client_registry.h" | 8 #include "base/memory/memory_coordinator_client_registry.h" |
| 9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 51 } |
| 52 | 52 |
| 53 ChildMemoryCoordinatorImpl::~ChildMemoryCoordinatorImpl() { | 53 ChildMemoryCoordinatorImpl::~ChildMemoryCoordinatorImpl() { |
| 54 base::AutoLock lock(*g_lock.Pointer()); | 54 base::AutoLock lock(*g_lock.Pointer()); |
| 55 DCHECK(g_child_memory_coordinator == this); | 55 DCHECK(g_child_memory_coordinator == this); |
| 56 g_child_memory_coordinator = nullptr; | 56 g_child_memory_coordinator = nullptr; |
| 57 } | 57 } |
| 58 | 58 |
| 59 void ChildMemoryCoordinatorImpl::OnStateChange(mojom::MemoryState state) { | 59 void ChildMemoryCoordinatorImpl::OnStateChange(mojom::MemoryState state) { |
| 60 base::MemoryState base_state = ToBaseMemoryState(state); | 60 base::MemoryState base_state = ToBaseMemoryState(state); |
| 61 base::MemoryCoordinatorClientRegistry::GetInstance()->clients()->Notify( | 61 base::MemoryCoordinatorClientRegistry::GetInstance()->Notify( |
| 62 FROM_HERE, &base::MemoryCoordinatorClient::OnMemoryStateChange, | |
| 63 base_state); | 62 base_state); |
| 64 } | 63 } |
| 65 | 64 |
| 66 #if !defined(OS_ANDROID) | 65 #if !defined(OS_ANDROID) |
| 67 std::unique_ptr<ChildMemoryCoordinatorImpl> CreateChildMemoryCoordinator( | 66 std::unique_ptr<ChildMemoryCoordinatorImpl> CreateChildMemoryCoordinator( |
| 68 mojom::MemoryCoordinatorHandlePtr parent, | 67 mojom::MemoryCoordinatorHandlePtr parent, |
| 69 ChildMemoryCoordinatorDelegate* delegate) { | 68 ChildMemoryCoordinatorDelegate* delegate) { |
| 70 return base::WrapUnique( | 69 return base::WrapUnique( |
| 71 new ChildMemoryCoordinatorImpl(std::move(parent), delegate)); | 70 new ChildMemoryCoordinatorImpl(std::move(parent), delegate)); |
| 72 } | 71 } |
| 73 #endif | 72 #endif |
| 74 | 73 |
| 75 } // namespace content | 74 } // namespace content |
| OLD | NEW |