OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 5 #ifndef CHROME_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
6 #define CHROME_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 6 #define CHROME_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
7 | 7 |
8 #if defined(ENABLE_GPU) | 8 #if defined(ENABLE_GPU) |
9 | 9 |
10 #include "base/process.h" | 10 #include "base/process.h" |
11 #include "base/ref_counted.h" | 11 #include "base/ref_counted.h" |
12 #include "gfx/native_widget_types.h" | 12 #include "gfx/native_widget_types.h" |
| 13 #include "gfx/size.h" |
13 #include "gpu/command_buffer/service/command_buffer_service.h" | 14 #include "gpu/command_buffer/service/command_buffer_service.h" |
14 #include "gpu/command_buffer/service/gpu_processor.h" | 15 #include "gpu/command_buffer/service/gpu_processor.h" |
15 #include "ipc/ipc_channel.h" | 16 #include "ipc/ipc_channel.h" |
16 #include "ipc/ipc_message.h" | 17 #include "ipc/ipc_message.h" |
17 | 18 |
18 class GpuChannel; | 19 class GpuChannel; |
19 | 20 |
20 class GpuCommandBufferStub | 21 class GpuCommandBufferStub |
21 : public IPC::Channel::Listener, | 22 : public IPC::Channel::Listener, |
22 public IPC::Message::Sender, | 23 public IPC::Message::Sender, |
23 public base::RefCountedThreadSafe<GpuCommandBufferStub> { | 24 public base::RefCountedThreadSafe<GpuCommandBufferStub> { |
24 public: | 25 public: |
25 GpuCommandBufferStub(GpuChannel* channel, | 26 GpuCommandBufferStub(GpuChannel* channel, |
| 27 gfx::NativeView view, |
| 28 GpuCommandBufferStub* parent, |
| 29 const gfx::Size& size, |
| 30 uint32 parent_texture_id, |
26 int32 route_id); | 31 int32 route_id); |
27 | 32 |
28 virtual ~GpuCommandBufferStub(); | 33 virtual ~GpuCommandBufferStub(); |
29 | 34 |
30 // IPC::Channel::Listener implementation: | 35 // IPC::Channel::Listener implementation: |
31 virtual void OnMessageReceived(const IPC::Message& message); | 36 virtual void OnMessageReceived(const IPC::Message& message); |
32 | 37 |
33 // IPC::Message::Sender implementation: | 38 // IPC::Message::Sender implementation: |
34 virtual bool Send(IPC::Message* msg); | 39 virtual bool Send(IPC::Message* msg); |
35 | 40 |
36 int route_id() const { return route_id_; } | 41 int32 route_id() const { return route_id_; } |
37 | 42 |
38 private: | 43 private: |
39 // Message handlers: | 44 // Message handlers: |
40 void OnInitialize(int32 size, base::SharedMemoryHandle* ring_buffer); | 45 void OnInitialize(int32 size, base::SharedMemoryHandle* ring_buffer); |
41 void OnGetState(gpu::CommandBuffer::State* state); | 46 void OnGetState(gpu::CommandBuffer::State* state); |
42 void OnAsyncGetState(); | 47 void OnAsyncGetState(); |
43 void OnFlush(int32 put_offset, gpu::CommandBuffer::State* state); | 48 void OnFlush(int32 put_offset, gpu::CommandBuffer::State* state); |
44 void OnAsyncFlush(int32 put_offset); | 49 void OnAsyncFlush(int32 put_offset); |
45 void OnCreateTransferBuffer(int32 size, int32* id); | 50 void OnCreateTransferBuffer(int32 size, int32* id); |
46 void OnDestroyTransferBuffer(int32 id); | 51 void OnDestroyTransferBuffer(int32 id); |
47 void OnGetTransferBuffer(int32 id, | 52 void OnGetTransferBuffer(int32 id, |
48 base::SharedMemoryHandle* transfer_buffer, | 53 base::SharedMemoryHandle* transfer_buffer, |
49 uint32* size); | 54 uint32* size); |
| 55 void OnResizeOffscreenFrameBuffer(const gfx::Size& size); |
50 | 56 |
51 scoped_refptr<GpuChannel> channel_; | 57 scoped_refptr<GpuChannel> channel_; |
52 int route_id_; | 58 gfx::NativeView view_; |
| 59 scoped_refptr<GpuCommandBufferStub> parent_; |
| 60 gfx::Size initial_size_; |
| 61 uint32 parent_texture_id_; |
| 62 int32 route_id_; |
53 | 63 |
54 scoped_ptr<gpu::CommandBufferService> command_buffer_; | 64 scoped_ptr<gpu::CommandBufferService> command_buffer_; |
55 scoped_refptr<gpu::GPUProcessor> processor_; | 65 scoped_ptr<gpu::GPUProcessor> processor_; |
56 | 66 |
57 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); | 67 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); |
58 }; | 68 }; |
59 | 69 |
60 #endif // ENABLE_GPU | 70 #endif // ENABLE_GPU |
61 | 71 |
62 #endif // CHROME_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 72 #endif // CHROME_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
OLD | NEW |