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 "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
11 #include "cc/resources/shared_bitmap_manager.h" | 11 #include "cc/resources/shared_bitmap_manager.h" |
12 #include "content/child/thread_safe_sender.h" | 12 #include "content/child/thread_safe_sender.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 | 15 |
| 16 class SharedMemoryBitmap : public cc::SharedBitmap { |
| 17 public: |
| 18 base::SharedMemory* shared_memory() { return shared_memory_; } |
| 19 |
| 20 protected: |
| 21 SharedMemoryBitmap(uint8* pixels, |
| 22 const cc::SharedBitmapId& id, |
| 23 base::SharedMemory* shared_memory); |
| 24 |
| 25 base::SharedMemory* shared_memory_; |
| 26 }; |
| 27 |
16 class ChildSharedBitmapManager : public cc::SharedBitmapManager { | 28 class ChildSharedBitmapManager : public cc::SharedBitmapManager { |
17 public: | 29 public: |
18 ChildSharedBitmapManager(scoped_refptr<ThreadSafeSender> sender); | 30 ChildSharedBitmapManager(scoped_refptr<ThreadSafeSender> sender); |
19 ~ChildSharedBitmapManager() override; | 31 ~ChildSharedBitmapManager() override; |
20 | 32 |
21 // cc::SharedBitmapManager implementation. | 33 // cc::SharedBitmapManager implementation. |
22 scoped_ptr<cc::SharedBitmap> AllocateSharedBitmap( | 34 scoped_ptr<cc::SharedBitmap> AllocateSharedBitmap( |
23 const gfx::Size& size) override; | 35 const gfx::Size& size) override; |
24 scoped_ptr<cc::SharedBitmap> GetSharedBitmapFromId( | 36 scoped_ptr<cc::SharedBitmap> GetSharedBitmapFromId( |
25 const gfx::Size&, | 37 const gfx::Size&, |
26 const cc::SharedBitmapId&) override; | 38 const cc::SharedBitmapId&) override; |
27 | 39 |
28 scoped_ptr<cc::SharedBitmap> GetBitmapForSharedMemory( | 40 scoped_ptr<cc::SharedBitmap> GetBitmapForSharedMemory( |
29 base::SharedMemory* mem); | 41 base::SharedMemory* mem); |
| 42 scoped_ptr<SharedMemoryBitmap> AllocateSharedMemoryBitmap( |
| 43 const gfx::Size& size); |
30 | 44 |
31 private: | 45 private: |
32 scoped_refptr<ThreadSafeSender> sender_; | 46 scoped_refptr<ThreadSafeSender> sender_; |
33 | 47 |
34 DISALLOW_COPY_AND_ASSIGN(ChildSharedBitmapManager); | 48 DISALLOW_COPY_AND_ASSIGN(ChildSharedBitmapManager); |
35 }; | 49 }; |
36 | 50 |
37 } // namespace content | 51 } // namespace content |
38 | 52 |
39 #endif // CONTENT_CHILD_CHILD_SHARED_BITMAP_MANAGER_H_ | 53 #endif // CONTENT_CHILD_CHILD_SHARED_BITMAP_MANAGER_H_ |
OLD | NEW |