OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_CHILD_CHILD_SHARED_BITMAP_MANAGER_H_ | |
6 #define CONTENT_CHILD_CHILD_SHARED_BITMAP_MANAGER_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include <memory> | |
11 | |
12 #include "base/macros.h" | |
13 #include "base/memory/ref_counted.h" | |
14 #include "base/memory/shared_memory.h" | |
15 #include "cc/resources/shared_bitmap_manager.h" | |
16 #include "content/common/render_message_filter.mojom.h" | |
17 #include "mojo/public/cpp/bindings/thread_safe_interface_ptr.h" | |
18 | |
19 namespace content { | |
20 | |
21 class SharedMemoryBitmap : public cc::SharedBitmap { | |
22 public: | |
23 base::SharedMemory* shared_memory() { return shared_memory_; } | |
24 | |
25 protected: | |
26 SharedMemoryBitmap(uint8_t* pixels, | |
27 const cc::SharedBitmapId& id, | |
28 base::SharedMemory* shared_memory); | |
29 | |
30 base::SharedMemory* shared_memory_; | |
31 }; | |
32 | |
33 class ChildSharedBitmapManager : public cc::SharedBitmapManager { | |
34 public: | |
35 explicit ChildSharedBitmapManager( | |
36 const scoped_refptr<mojom::ThreadSafeRenderMessageFilterAssociatedPtr>& | |
37 render_message_filter_ptr); | |
38 ~ChildSharedBitmapManager() override; | |
39 | |
40 // cc::SharedBitmapManager implementation. | |
41 std::unique_ptr<cc::SharedBitmap> AllocateSharedBitmap( | |
42 const gfx::Size& size) override; | |
43 std::unique_ptr<cc::SharedBitmap> GetSharedBitmapFromId( | |
44 const gfx::Size&, | |
45 const cc::SharedBitmapId&) override; | |
46 | |
47 std::unique_ptr<cc::SharedBitmap> GetBitmapForSharedMemory( | |
48 base::SharedMemory* mem); | |
49 | |
50 private: | |
51 void NotifyAllocatedSharedBitmap(base::SharedMemory* memory, | |
52 const cc::SharedBitmapId& id); | |
53 | |
54 scoped_refptr<mojom::ThreadSafeRenderMessageFilterAssociatedPtr> | |
55 render_message_filter_ptr_; | |
56 | |
57 DISALLOW_COPY_AND_ASSIGN(ChildSharedBitmapManager); | |
58 }; | |
59 | |
60 } // namespace content | |
61 | |
62 #endif // CONTENT_CHILD_CHILD_SHARED_BITMAP_MANAGER_H_ | |
OLD | NEW |