| 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 #ifndef CONTENT_CHILD_MEMORY_CHILD_MEMORY_COORDINATOR_IMPL_H_ | 5 #ifndef CONTENT_CHILD_MEMORY_CHILD_MEMORY_COORDINATOR_IMPL_H_ |
| 6 #define CONTENT_CHILD_MEMORY_CHILD_MEMORY_COORDINATOR_IMPL_H_ | 6 #define CONTENT_CHILD_MEMORY_CHILD_MEMORY_COORDINATOR_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/memory_coordinator_client.h" | 9 #include "base/memory/memory_coordinator_client.h" |
| 10 #include "content/common/child_memory_coordinator.mojom.h" | 10 #include "content/common/child_memory_coordinator.mojom.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // Returns the instance of ChildMemoryCoordinatorImpl. Could be nullptr. | 31 // Returns the instance of ChildMemoryCoordinatorImpl. Could be nullptr. |
| 32 static ChildMemoryCoordinatorImpl* GetInstance(); | 32 static ChildMemoryCoordinatorImpl* GetInstance(); |
| 33 | 33 |
| 34 ChildMemoryCoordinatorImpl(mojom::MemoryCoordinatorHandlePtr parent, | 34 ChildMemoryCoordinatorImpl(mojom::MemoryCoordinatorHandlePtr parent, |
| 35 ChildMemoryCoordinatorDelegate* delegate); | 35 ChildMemoryCoordinatorDelegate* delegate); |
| 36 ~ChildMemoryCoordinatorImpl() override; | 36 ~ChildMemoryCoordinatorImpl() override; |
| 37 | 37 |
| 38 // mojom::ChildMemoryCoordinator implementations: | 38 // mojom::ChildMemoryCoordinator implementations: |
| 39 void OnStateChange(mojom::MemoryState state) override; | 39 void OnStateChange(mojom::MemoryState state) override; |
| 40 | 40 |
| 41 void PrepareToSuspend() { |
| 42 // TODO(tasak): Change states of memory coordinator clients to be |
| 43 // SUSPENDED. |
| 44 } |
| 45 |
| 41 protected: | 46 protected: |
| 42 ChildMemoryCoordinatorDelegate* delegate() { return delegate_; } | 47 ChildMemoryCoordinatorDelegate* delegate() { return delegate_; } |
| 43 | 48 |
| 44 private: | 49 private: |
| 45 friend class ChildMemoryCoordinatorImplTest; | 50 friend class ChildMemoryCoordinatorImplTest; |
| 46 | 51 |
| 47 mojo::Binding<mojom::ChildMemoryCoordinator> binding_; | 52 mojo::Binding<mojom::ChildMemoryCoordinator> binding_; |
| 48 mojom::MemoryCoordinatorHandlePtr parent_; | 53 mojom::MemoryCoordinatorHandlePtr parent_; |
| 49 ChildMemoryCoordinatorDelegate* delegate_; | 54 ChildMemoryCoordinatorDelegate* delegate_; |
| 50 | 55 |
| 51 DISALLOW_COPY_AND_ASSIGN(ChildMemoryCoordinatorImpl); | 56 DISALLOW_COPY_AND_ASSIGN(ChildMemoryCoordinatorImpl); |
| 52 }; | 57 }; |
| 53 | 58 |
| 54 // Factory function for creating a ChildMemoryCoordinator for the current | 59 // Factory function for creating a ChildMemoryCoordinator for the current |
| 55 // platform. Doesn't take the ownership of |delegate|. | 60 // platform. Doesn't take the ownership of |delegate|. |
| 56 CONTENT_EXPORT std::unique_ptr<ChildMemoryCoordinatorImpl> | 61 CONTENT_EXPORT std::unique_ptr<ChildMemoryCoordinatorImpl> |
| 57 CreateChildMemoryCoordinator(mojom::MemoryCoordinatorHandlePtr parent, | 62 CreateChildMemoryCoordinator(mojom::MemoryCoordinatorHandlePtr parent, |
| 58 ChildMemoryCoordinatorDelegate* delegate); | 63 ChildMemoryCoordinatorDelegate* delegate); |
| 59 | 64 |
| 60 } // namespace content | 65 } // namespace content |
| 61 | 66 |
| 62 #endif // CONTENT_CHILD_MEMORY_CHILD_MEMORY_COORDINATOR_IMPL_H_ | 67 #endif // CONTENT_CHILD_MEMORY_CHILD_MEMORY_COORDINATOR_IMPL_H_ |
| OLD | NEW |