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