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 17 matching lines...) Expand all Loading... |
28 class CONTENT_EXPORT ChildMemoryCoordinatorImpl | 28 class CONTENT_EXPORT ChildMemoryCoordinatorImpl |
29 : NON_EXPORTED_BASE(public mojom::ChildMemoryCoordinator) { | 29 : NON_EXPORTED_BASE(public mojom::ChildMemoryCoordinator) { |
30 public: | 30 public: |
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 // Requests purging memory to clients. |
| 39 void PurgeMemory(); |
| 40 |
38 // mojom::ChildMemoryCoordinator implementations: | 41 // mojom::ChildMemoryCoordinator implementations: |
39 void OnStateChange(mojom::MemoryState state) override; | 42 void OnStateChange(mojom::MemoryState state) override; |
40 | 43 |
41 protected: | 44 protected: |
42 ChildMemoryCoordinatorDelegate* delegate() { return delegate_; } | 45 ChildMemoryCoordinatorDelegate* delegate() { return delegate_; } |
43 | 46 |
44 private: | 47 private: |
45 friend class ChildMemoryCoordinatorImplTest; | 48 friend class ChildMemoryCoordinatorImplTest; |
46 | 49 |
47 mojo::Binding<mojom::ChildMemoryCoordinator> binding_; | 50 mojo::Binding<mojom::ChildMemoryCoordinator> binding_; |
48 mojom::MemoryCoordinatorHandlePtr parent_; | 51 mojom::MemoryCoordinatorHandlePtr parent_; |
49 ChildMemoryCoordinatorDelegate* delegate_; | 52 ChildMemoryCoordinatorDelegate* delegate_; |
50 | 53 |
51 DISALLOW_COPY_AND_ASSIGN(ChildMemoryCoordinatorImpl); | 54 DISALLOW_COPY_AND_ASSIGN(ChildMemoryCoordinatorImpl); |
52 }; | 55 }; |
53 | 56 |
54 // Factory function for creating a ChildMemoryCoordinator for the current | 57 // Factory function for creating a ChildMemoryCoordinator for the current |
55 // platform. Doesn't take the ownership of |delegate|. | 58 // platform. Doesn't take the ownership of |delegate|. |
56 CONTENT_EXPORT std::unique_ptr<ChildMemoryCoordinatorImpl> | 59 CONTENT_EXPORT std::unique_ptr<ChildMemoryCoordinatorImpl> |
57 CreateChildMemoryCoordinator(mojom::MemoryCoordinatorHandlePtr parent, | 60 CreateChildMemoryCoordinator(mojom::MemoryCoordinatorHandlePtr parent, |
58 ChildMemoryCoordinatorDelegate* delegate); | 61 ChildMemoryCoordinatorDelegate* delegate); |
59 | 62 |
60 } // namespace content | 63 } // namespace content |
61 | 64 |
62 #endif // CONTENT_CHILD_MEMORY_CHILD_MEMORY_COORDINATOR_IMPL_H_ | 65 #endif // CONTENT_CHILD_MEMORY_CHILD_MEMORY_COORDINATOR_IMPL_H_ |
OLD | NEW |