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.
5 #ifndef CONTENT_CHILD_CHILD_SHARED_BITMAP_MANAGER_H_
6 #define CONTENT_CHILD_CHILD_SHARED_BITMAP_MANAGER_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/shared_memory.h"
11 #include "cc/resources/shared_bitmap_manager.h"
12 #include "content/child/thread_safe_sender.h"
16 class SharedMemoryBitmap
: public cc::SharedBitmap
{
18 base::SharedMemory
* shared_memory() { return shared_memory_
; }
21 SharedMemoryBitmap(uint8
* pixels
,
22 const cc::SharedBitmapId
& id
,
23 base::SharedMemory
* shared_memory
);
25 base::SharedMemory
* shared_memory_
;
28 class ChildSharedBitmapManager
: public cc::SharedBitmapManager
{
30 ChildSharedBitmapManager(scoped_refptr
<ThreadSafeSender
> sender
);
31 ~ChildSharedBitmapManager() override
;
33 // cc::SharedBitmapManager implementation.
34 scoped_ptr
<cc::SharedBitmap
> AllocateSharedBitmap(
35 const gfx::Size
& size
) override
;
36 scoped_ptr
<cc::SharedBitmap
> GetSharedBitmapFromId(
38 const cc::SharedBitmapId
&) override
;
40 scoped_ptr
<cc::SharedBitmap
> GetBitmapForSharedMemory(
41 base::SharedMemory
* mem
);
42 scoped_ptr
<SharedMemoryBitmap
> AllocateSharedMemoryBitmap(
43 const gfx::Size
& size
);
46 scoped_refptr
<ThreadSafeSender
> sender_
;
48 DISALLOW_COPY_AND_ASSIGN(ChildSharedBitmapManager
);
51 } // namespace content
53 #endif // CONTENT_CHILD_CHILD_SHARED_BITMAP_MANAGER_H_