OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 COMPONENTS_DISPLAY_COMPOSITOR_HOST_SHARED_BITMAP_MANAGER_H_ | 5 #ifndef COMPONENTS_DISPLAY_COMPOSITOR_HOST_SHARED_BITMAP_MANAGER_H_ |
6 #define COMPONENTS_DISPLAY_COMPOSITOR_HOST_SHARED_BITMAP_MANAGER_H_ | 6 #define COMPONENTS_DISPLAY_COMPOSITOR_HOST_SHARED_BITMAP_MANAGER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 ~HostSharedBitmapManagerClient() override; | 44 ~HostSharedBitmapManagerClient() override; |
45 | 45 |
46 void Bind(cc::mojom::SharedBitmapManagerAssociatedRequest request); | 46 void Bind(cc::mojom::SharedBitmapManagerAssociatedRequest request); |
47 | 47 |
48 // cc::mojom::SharedBitmapManager overrides: | 48 // cc::mojom::SharedBitmapManager overrides: |
49 void DidAllocateSharedBitmap(mojo::ScopedSharedBufferHandle buffer, | 49 void DidAllocateSharedBitmap(mojo::ScopedSharedBufferHandle buffer, |
50 const cc::SharedBitmapId& id) override; | 50 const cc::SharedBitmapId& id) override; |
51 void DidDeleteSharedBitmap(const cc::SharedBitmapId& id) override; | 51 void DidDeleteSharedBitmap(const cc::SharedBitmapId& id) override; |
52 | 52 |
53 void AllocateSharedBitmapForChild( | |
54 base::ProcessHandle process_handle, | |
55 size_t buffer_size, | |
56 const cc::SharedBitmapId& id, | |
57 base::SharedMemoryHandle* shared_memory_handle); | |
58 void ChildAllocatedSharedBitmap(size_t buffer_size, | 53 void ChildAllocatedSharedBitmap(size_t buffer_size, |
59 const base::SharedMemoryHandle& handle, | 54 const base::SharedMemoryHandle& handle, |
60 const cc::SharedBitmapId& id); | 55 const cc::SharedBitmapId& id); |
61 | 56 |
62 private: | 57 private: |
63 HostSharedBitmapManager* manager_; | 58 HostSharedBitmapManager* manager_; |
64 mojo::AssociatedBinding<cc::mojom::SharedBitmapManager> binding_; | 59 mojo::AssociatedBinding<cc::mojom::SharedBitmapManager> binding_; |
65 | 60 |
66 // Lock must be held around access to owned_bitmaps_. | 61 // Lock must be held around access to owned_bitmaps_. |
67 base::Lock lock_; | 62 base::Lock lock_; |
(...skipping 22 matching lines...) Expand all Loading... |
90 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, | 85 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, |
91 base::trace_event::ProcessMemoryDump* pmd) override; | 86 base::trace_event::ProcessMemoryDump* pmd) override; |
92 | 87 |
93 size_t AllocatedBitmapCount() const; | 88 size_t AllocatedBitmapCount() const; |
94 | 89 |
95 void FreeSharedMemoryFromMap(const cc::SharedBitmapId& id); | 90 void FreeSharedMemoryFromMap(const cc::SharedBitmapId& id); |
96 | 91 |
97 private: | 92 private: |
98 friend class HostSharedBitmapManagerClient; | 93 friend class HostSharedBitmapManagerClient; |
99 | 94 |
100 void AllocateSharedBitmapForChild( | |
101 base::ProcessHandle process_handle, | |
102 size_t buffer_size, | |
103 const cc::SharedBitmapId& id, | |
104 base::SharedMemoryHandle* shared_memory_handle); | |
105 bool ChildAllocatedSharedBitmap(size_t buffer_size, | 95 bool ChildAllocatedSharedBitmap(size_t buffer_size, |
106 const base::SharedMemoryHandle& handle, | 96 const base::SharedMemoryHandle& handle, |
107 const cc::SharedBitmapId& id); | 97 const cc::SharedBitmapId& id); |
108 void ChildDeletedSharedBitmap(const cc::SharedBitmapId& id); | 98 void ChildDeletedSharedBitmap(const cc::SharedBitmapId& id); |
109 | 99 |
110 mutable base::Lock lock_; | 100 mutable base::Lock lock_; |
111 | 101 |
112 typedef base::hash_map<cc::SharedBitmapId, scoped_refptr<BitmapData>> | 102 typedef base::hash_map<cc::SharedBitmapId, scoped_refptr<BitmapData>> |
113 BitmapMap; | 103 BitmapMap; |
114 BitmapMap handle_map_; | 104 BitmapMap handle_map_; |
115 | 105 |
116 DISALLOW_COPY_AND_ASSIGN(HostSharedBitmapManager); | 106 DISALLOW_COPY_AND_ASSIGN(HostSharedBitmapManager); |
117 }; | 107 }; |
118 | 108 |
119 } // namespace display_compositor | 109 } // namespace display_compositor |
120 | 110 |
121 #endif // COMPONENTS_DISPLAY_COMPOSITOR_HOST_SHARED_BITMAP_MANAGER_H_ | 111 #endif // COMPONENTS_DISPLAY_COMPOSITOR_HOST_SHARED_BITMAP_MANAGER_H_ |
OLD | NEW |