Chromium Code Reviews| Index: components/memory_coordinator/child/child_memory_coordinator_impl.cc |
| diff --git a/components/memory_coordinator/child/child_memory_coordinator_impl.cc b/components/memory_coordinator/child/child_memory_coordinator_impl.cc |
| index 75889ed43f66e6463c0e9b3dc0ed578ca745b85b..c2247d05b1222f21f0a014f50cf3539ef0a07c3a 100644 |
| --- a/components/memory_coordinator/child/child_memory_coordinator_impl.cc |
| +++ b/components/memory_coordinator/child/child_memory_coordinator_impl.cc |
| @@ -4,19 +4,38 @@ |
| #include "components/memory_coordinator/child/child_memory_coordinator_impl.h" |
| +#include "components/memory_coordinator/child/blink_memory_coordinator_client.h" |
| + |
| namespace memory_coordinator { |
| +// static |
| +void ChildMemoryCoordinatorImpl::Create( |
| + mojo::InterfaceRequest<mojom::ChildMemoryCoordinator> request) { |
| + scoped_refptr<ClientList> clients(new ClientList); |
| + new ChildMemoryCoordinatorImpl(std::move(request), clients); |
|
haraken
2016/06/27 02:17:07
Nit: new ChildMemoryCoordinatorImpl(std::move(requ
bashi
2016/06/27 03:49:29
Done.
|
| +} |
| + |
| ChildMemoryCoordinatorImpl::ChildMemoryCoordinatorImpl( |
| mojo::InterfaceRequest<mojom::ChildMemoryCoordinator> request, |
| scoped_refptr<ClientList> clients) |
| : binding_(this, std::move(request)), |
| - clients_(clients) {} |
| + clients_(clients), |
| + blink_client_(new BlinkMemoryCoordinatorClient) { |
|
haraken
2016/06/27 02:17:07
Do we need the member variable |blink_client_|?
bashi
2016/06/27 03:49:29
Someone needs to have the ownership of BlinkMemory
|
| + // TODO(bashi): Add more clients (e.g. skia). |
| + clients_->AddObserver(blink_client_.get()); |
| +} |
| ChildMemoryCoordinatorImpl::~ChildMemoryCoordinatorImpl() {} |
| void ChildMemoryCoordinatorImpl::OnStateChange(mojom::MemoryState state) { |
| + state_ = state; |
| clients_->Notify(FROM_HERE, &MemoryCoordinatorClient::OnMemoryStateChange, |
| state); |
| } |
| +void ChildMemoryCoordinatorImpl::GetLastState( |
| + const GetLastStateCallback& callback) { |
| + callback.Run(state_); |
| +} |
| + |
| } // namespace memory_coordinator |