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 #pragma once | 7 #pragma once |
8 | 8 |
9 #if defined(ENABLE_GPU) | 9 #if defined(ENABLE_GPU) |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 class GpuCommandBufferStub | 22 class GpuCommandBufferStub |
23 : public IPC::Channel::Listener, | 23 : public IPC::Channel::Listener, |
24 public IPC::Message::Sender, | 24 public IPC::Message::Sender, |
25 public base::SupportsWeakPtr<GpuCommandBufferStub> { | 25 public base::SupportsWeakPtr<GpuCommandBufferStub> { |
26 public: | 26 public: |
27 GpuCommandBufferStub(GpuChannel* channel, | 27 GpuCommandBufferStub(GpuChannel* channel, |
28 gfx::PluginWindowHandle handle, | 28 gfx::PluginWindowHandle handle, |
29 GpuCommandBufferStub* parent, | 29 GpuCommandBufferStub* parent, |
30 const gfx::Size& size, | 30 const gfx::Size& size, |
31 uint32 parent_texture_id, | 31 uint32 parent_texture_id, |
32 int32 route_id); | 32 int32 route_id, |
| 33 int32 renderer_id, |
| 34 int32 render_view_id); |
33 | 35 |
34 virtual ~GpuCommandBufferStub(); | 36 virtual ~GpuCommandBufferStub(); |
35 | 37 |
36 // IPC::Channel::Listener implementation: | 38 // IPC::Channel::Listener implementation: |
37 virtual void OnMessageReceived(const IPC::Message& message); | 39 virtual void OnMessageReceived(const IPC::Message& message); |
38 | 40 |
39 // IPC::Message::Sender implementation: | 41 // IPC::Message::Sender implementation: |
40 virtual bool Send(IPC::Message* msg); | 42 virtual bool Send(IPC::Message* msg); |
41 | 43 |
42 int32 route_id() const { return route_id_; } | 44 int32 route_id() const { return route_id_; } |
43 | 45 |
44 private: | 46 private: |
45 // Message handlers: | 47 // Message handlers: |
46 void OnInitialize(int32 size, base::SharedMemoryHandle* ring_buffer); | 48 void OnInitialize(int32 size, base::SharedMemoryHandle* ring_buffer); |
47 void OnGetState(gpu::CommandBuffer::State* state); | 49 void OnGetState(gpu::CommandBuffer::State* state); |
48 void OnAsyncGetState(); | 50 void OnAsyncGetState(); |
49 void OnFlush(int32 put_offset, gpu::CommandBuffer::State* state); | 51 void OnFlush(int32 put_offset, gpu::CommandBuffer::State* state); |
50 void OnAsyncFlush(int32 put_offset); | 52 void OnAsyncFlush(int32 put_offset); |
51 void OnCreateTransferBuffer(int32 size, int32* id); | 53 void OnCreateTransferBuffer(int32 size, int32* id); |
52 void OnDestroyTransferBuffer(int32 id); | 54 void OnDestroyTransferBuffer(int32 id); |
53 void OnGetTransferBuffer(int32 id, | 55 void OnGetTransferBuffer(int32 id, |
54 base::SharedMemoryHandle* transfer_buffer, | 56 base::SharedMemoryHandle* transfer_buffer, |
55 uint32* size); | 57 uint32* size); |
56 void OnResizeOffscreenFrameBuffer(const gfx::Size& size); | 58 void OnResizeOffscreenFrameBuffer(const gfx::Size& size); |
57 | 59 |
| 60 #if defined(OS_MACOSX) |
| 61 void OnSetWindowSize(const gfx::Size& size); |
| 62 void SwapBuffersCallback(); |
| 63 #endif |
| 64 |
58 // The lifetime of objects of this class is managed by a GpuChannel. The | 65 // The lifetime of objects of this class is managed by a GpuChannel. The |
59 // GpuChannels destroy all the GpuCommandBufferStubs that they own when they | 66 // GpuChannels destroy all the GpuCommandBufferStubs that they own when they |
60 // are destroyed. So a raw pointer is safe. | 67 // are destroyed. So a raw pointer is safe. |
61 GpuChannel* channel_; | 68 GpuChannel* channel_; |
62 | 69 |
63 gfx::PluginWindowHandle handle_; | 70 gfx::PluginWindowHandle handle_; |
64 base::WeakPtr<GpuCommandBufferStub> parent_; | 71 base::WeakPtr<GpuCommandBufferStub> parent_; |
65 gfx::Size initial_size_; | 72 gfx::Size initial_size_; |
66 uint32 parent_texture_id_; | 73 uint32 parent_texture_id_; |
67 int32 route_id_; | 74 int32 route_id_; |
68 | 75 |
| 76 // The following two fields are used on Mac OS X to identify the window |
| 77 // for the rendering results on the browser side. |
| 78 int32 renderer_id_; |
| 79 int32 render_view_id_; |
| 80 |
69 scoped_ptr<gpu::CommandBufferService> command_buffer_; | 81 scoped_ptr<gpu::CommandBufferService> command_buffer_; |
70 scoped_ptr<gpu::GPUProcessor> processor_; | 82 scoped_ptr<gpu::GPUProcessor> processor_; |
71 | 83 |
72 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); | 84 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); |
73 }; | 85 }; |
74 | 86 |
75 #endif // ENABLE_GPU | 87 #endif // ENABLE_GPU |
76 | 88 |
77 #endif // CHROME_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 89 #endif // CHROME_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
OLD | NEW |