OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 5 #ifndef CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
6 #define CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 6 #define CONTENT_COMMON_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 15 matching lines...) Expand all Loading... |
26 class GpuWatchdog; | 26 class GpuWatchdog; |
27 | 27 |
28 class GpuCommandBufferStub | 28 class GpuCommandBufferStub |
29 : public IPC::Channel::Listener, | 29 : public IPC::Channel::Listener, |
30 public IPC::Message::Sender, | 30 public IPC::Message::Sender, |
31 public base::SupportsWeakPtr<GpuCommandBufferStub> { | 31 public base::SupportsWeakPtr<GpuCommandBufferStub> { |
32 public: | 32 public: |
33 GpuCommandBufferStub( | 33 GpuCommandBufferStub( |
34 GpuChannel* channel, | 34 GpuChannel* channel, |
35 gfx::PluginWindowHandle handle, | 35 gfx::PluginWindowHandle handle, |
36 GpuCommandBufferStub* parent, | |
37 const gfx::Size& size, | 36 const gfx::Size& size, |
38 const gpu::gles2::DisallowedExtensions& disallowed_extensions, | 37 const gpu::gles2::DisallowedExtensions& disallowed_extensions, |
39 const std::string& allowed_extensions, | 38 const std::string& allowed_extensions, |
40 const std::vector<int32>& attribs, | 39 const std::vector<int32>& attribs, |
41 uint32 parent_texture_id, | |
42 int32 route_id, | 40 int32 route_id, |
43 int32 renderer_id, | 41 int32 renderer_id, |
44 int32 render_view_id, | 42 int32 render_view_id, |
45 GpuWatchdog* watchdog); | 43 GpuWatchdog* watchdog); |
46 | 44 |
47 virtual ~GpuCommandBufferStub(); | 45 virtual ~GpuCommandBufferStub(); |
48 | 46 |
49 // IPC::Channel::Listener implementation: | 47 // IPC::Channel::Listener implementation: |
50 virtual bool OnMessageReceived(const IPC::Message& message); | 48 virtual bool OnMessageReceived(const IPC::Message& message); |
51 | 49 |
(...skipping 27 matching lines...) Expand all Loading... |
79 | 77 |
80 // Called when the command buffer was destroyed, and the stub should now | 78 // Called when the command buffer was destroyed, and the stub should now |
81 // unblock itself and handle pending messages. | 79 // unblock itself and handle pending messages. |
82 void CommandBufferWasDestroyed(); | 80 void CommandBufferWasDestroyed(); |
83 | 81 |
84 private: | 82 private: |
85 // Message handlers: | 83 // Message handlers: |
86 void OnInitialize(base::SharedMemoryHandle ring_buffer, | 84 void OnInitialize(base::SharedMemoryHandle ring_buffer, |
87 int32 size, | 85 int32 size, |
88 IPC::Message* reply_message); | 86 IPC::Message* reply_message); |
| 87 void OnSetParent(int32 parent_route_id, |
| 88 uint32 parent_texture_id, |
| 89 IPC::Message* reply_message); |
89 void OnGetState(IPC::Message* reply_message); | 90 void OnGetState(IPC::Message* reply_message); |
90 void OnFlush(int32 put_offset, | 91 void OnFlush(int32 put_offset, |
91 int32 last_known_get, | 92 int32 last_known_get, |
92 uint32 flush_count, | 93 uint32 flush_count, |
93 IPC::Message* reply_message); | 94 IPC::Message* reply_message); |
94 void OnAsyncFlush(int32 put_offset, uint32 flush_count); | 95 void OnAsyncFlush(int32 put_offset, uint32 flush_count); |
95 void OnCreateTransferBuffer(int32 size, | 96 void OnCreateTransferBuffer(int32 size, |
96 int32 id_request, | 97 int32 id_request, |
97 IPC::Message* reply_message); | 98 IPC::Message* reply_message); |
98 void OnRegisterTransferBuffer(base::SharedMemoryHandle transfer_buffer, | 99 void OnRegisterTransferBuffer(base::SharedMemoryHandle transfer_buffer, |
(...skipping 17 matching lines...) Expand all Loading... |
116 | 117 |
117 void ResizeCallback(gfx::Size size); | 118 void ResizeCallback(gfx::Size size); |
118 void ReportState(); | 119 void ReportState(); |
119 | 120 |
120 // The lifetime of objects of this class is managed by a GpuChannel. The | 121 // The lifetime of objects of this class is managed by a GpuChannel. The |
121 // GpuChannels destroy all the GpuCommandBufferStubs that they own when they | 122 // GpuChannels destroy all the GpuCommandBufferStubs that they own when they |
122 // are destroyed. So a raw pointer is safe. | 123 // are destroyed. So a raw pointer is safe. |
123 GpuChannel* channel_; | 124 GpuChannel* channel_; |
124 | 125 |
125 gfx::PluginWindowHandle handle_; | 126 gfx::PluginWindowHandle handle_; |
126 base::WeakPtr<GpuCommandBufferStub> parent_; | |
127 gfx::Size initial_size_; | 127 gfx::Size initial_size_; |
128 gpu::gles2::DisallowedExtensions disallowed_extensions_; | 128 gpu::gles2::DisallowedExtensions disallowed_extensions_; |
129 std::string allowed_extensions_; | 129 std::string allowed_extensions_; |
130 std::vector<int32> requested_attribs_; | 130 std::vector<int32> requested_attribs_; |
131 uint32 parent_texture_id_; | |
132 int32 route_id_; | 131 int32 route_id_; |
133 uint32 last_flush_count_; | 132 uint32 last_flush_count_; |
134 | 133 |
135 // The following two fields are used on Mac OS X to identify the window | 134 // The following two fields are used on Mac OS X to identify the window |
136 // for the rendering results on the browser side. | 135 // for the rendering results on the browser side. |
137 int32 renderer_id_; | 136 int32 renderer_id_; |
138 int32 render_view_id_; | 137 int32 render_view_id_; |
139 | 138 |
140 scoped_ptr<gpu::CommandBufferService> command_buffer_; | 139 scoped_ptr<gpu::CommandBufferService> command_buffer_; |
141 scoped_ptr<gpu::GpuScheduler> scheduler_; | 140 scoped_ptr<gpu::GpuScheduler> scheduler_; |
142 std::queue<IPC::Message*> deferred_messages_; | 141 std::queue<IPC::Message*> deferred_messages_; |
143 | 142 |
144 GpuWatchdog* watchdog_; | 143 GpuWatchdog* watchdog_; |
145 ScopedRunnableMethodFactory<GpuCommandBufferStub> task_factory_; | 144 ScopedRunnableMethodFactory<GpuCommandBufferStub> task_factory_; |
146 | 145 |
147 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); | 146 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); |
148 }; | 147 }; |
149 | 148 |
150 #endif // defined(ENABLE_GPU) | 149 #endif // defined(ENABLE_GPU) |
151 | 150 |
152 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 151 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
OLD | NEW |