Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(531)

Side by Side Diff: components/viz/display_compositor/host_shared_bitmap_manager.h

Issue 2873243002: Move components/display_compositor to components/viz/display_compositor (Closed)
Patch Set: Rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_VIZ_DISPLAY_COMPOSITOR_HOST_SHARED_BITMAP_MANAGER_H_
6 #define COMPONENTS_DISPLAY_COMPOSITOR_HOST_SHARED_BITMAP_MANAGER_H_ 6 #define COMPONENTS_VIZ_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>
11 #include <memory> 11 #include <memory>
12 #include <set> 12 #include <set>
13 13
14 #include "base/containers/hash_tables.h" 14 #include "base/containers/hash_tables.h"
15 #include "base/hash.h" 15 #include "base/hash.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
18 #include "base/memory/shared_memory.h" 18 #include "base/memory/shared_memory.h"
19 #include "base/synchronization/lock.h" 19 #include "base/synchronization/lock.h"
20 #include "base/trace_event/memory_dump_provider.h" 20 #include "base/trace_event/memory_dump_provider.h"
21 #include "cc/ipc/shared_bitmap_manager.mojom.h" 21 #include "cc/ipc/shared_bitmap_manager.mojom.h"
22 #include "cc/resources/shared_bitmap_manager.h" 22 #include "cc/resources/shared_bitmap_manager.h"
23 #include "components/display_compositor/display_compositor_export.h" 23 #include "components/viz/viz_export.h"
24 #include "mojo/public/cpp/bindings/associated_binding.h" 24 #include "mojo/public/cpp/bindings/associated_binding.h"
25 25
26 namespace BASE_HASH_NAMESPACE { 26 namespace BASE_HASH_NAMESPACE {
27 template <> 27 template <>
28 struct hash<cc::SharedBitmapId> { 28 struct hash<cc::SharedBitmapId> {
29 size_t operator()(const cc::SharedBitmapId& id) const { 29 size_t operator()(const cc::SharedBitmapId& id) const {
30 return base::Hash(reinterpret_cast<const char*>(id.name), sizeof(id.name)); 30 return base::Hash(reinterpret_cast<const char*>(id.name), sizeof(id.name));
31 } 31 }
32 }; 32 };
33 } // namespace BASE_HASH_NAMESPACE 33 } // namespace BASE_HASH_NAMESPACE
34 34
35 namespace display_compositor { 35 namespace viz {
36 class BitmapData; 36 class BitmapData;
37 class HostSharedBitmapManager; 37 class HostSharedBitmapManager;
38 38
39 class DISPLAY_COMPOSITOR_EXPORT HostSharedBitmapManagerClient 39 class VIZ_EXPORT HostSharedBitmapManagerClient
40 : NON_EXPORTED_BASE(public cc::mojom::SharedBitmapManager) { 40 : NON_EXPORTED_BASE(public cc::mojom::SharedBitmapManager) {
41 public: 41 public:
42 explicit HostSharedBitmapManagerClient(HostSharedBitmapManager* manager); 42 explicit HostSharedBitmapManagerClient(HostSharedBitmapManager* manager);
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 ChildAllocatedSharedBitmap(size_t buffer_size, 53 void ChildAllocatedSharedBitmap(size_t buffer_size,
54 const base::SharedMemoryHandle& handle, 54 const base::SharedMemoryHandle& handle,
55 const cc::SharedBitmapId& id); 55 const cc::SharedBitmapId& id);
56 56
57 private: 57 private:
58 HostSharedBitmapManager* manager_; 58 HostSharedBitmapManager* manager_;
59 mojo::AssociatedBinding<cc::mojom::SharedBitmapManager> binding_; 59 mojo::AssociatedBinding<cc::mojom::SharedBitmapManager> binding_;
60 60
61 // Lock must be held around access to owned_bitmaps_. 61 // Lock must be held around access to owned_bitmaps_.
62 base::Lock lock_; 62 base::Lock lock_;
63 base::hash_set<cc::SharedBitmapId> owned_bitmaps_; 63 base::hash_set<cc::SharedBitmapId> owned_bitmaps_;
64 64
65 DISALLOW_COPY_AND_ASSIGN(HostSharedBitmapManagerClient); 65 DISALLOW_COPY_AND_ASSIGN(HostSharedBitmapManagerClient);
66 }; 66 };
67 67
68 class DISPLAY_COMPOSITOR_EXPORT HostSharedBitmapManager 68 class VIZ_EXPORT HostSharedBitmapManager
69 : public cc::SharedBitmapManager, 69 : public cc::SharedBitmapManager,
70 public base::trace_event::MemoryDumpProvider { 70 public base::trace_event::MemoryDumpProvider {
71 public: 71 public:
72 HostSharedBitmapManager(); 72 HostSharedBitmapManager();
73 ~HostSharedBitmapManager() override; 73 ~HostSharedBitmapManager() override;
74 74
75 static HostSharedBitmapManager* current(); 75 static HostSharedBitmapManager* current();
76 76
77 // cc::SharedBitmapManager implementation. 77 // cc::SharedBitmapManager implementation.
78 std::unique_ptr<cc::SharedBitmap> AllocateSharedBitmap( 78 std::unique_ptr<cc::SharedBitmap> AllocateSharedBitmap(
(...skipping 20 matching lines...) Expand all
99 99
100 mutable base::Lock lock_; 100 mutable base::Lock lock_;
101 101
102 typedef base::hash_map<cc::SharedBitmapId, scoped_refptr<BitmapData>> 102 typedef base::hash_map<cc::SharedBitmapId, scoped_refptr<BitmapData>>
103 BitmapMap; 103 BitmapMap;
104 BitmapMap handle_map_; 104 BitmapMap handle_map_;
105 105
106 DISALLOW_COPY_AND_ASSIGN(HostSharedBitmapManager); 106 DISALLOW_COPY_AND_ASSIGN(HostSharedBitmapManager);
107 }; 107 };
108 108
109 } // namespace display_compositor 109 } // namespace viz
110 110
111 #endif // COMPONENTS_DISPLAY_COMPOSITOR_HOST_SHARED_BITMAP_MANAGER_H_ 111 #endif // COMPONENTS_VIZ_DISPLAY_COMPOSITOR_HOST_SHARED_BITMAP_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698