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_CHANNEL_H_ | 5 #ifndef CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 } | 71 } |
72 | 72 |
73 // IPC::Channel::Listener implementation: | 73 // IPC::Channel::Listener implementation: |
74 virtual bool OnMessageReceived(const IPC::Message& msg); | 74 virtual bool OnMessageReceived(const IPC::Message& msg); |
75 virtual void OnChannelError(); | 75 virtual void OnChannelError(); |
76 virtual void OnChannelConnected(int32 peer_pid); | 76 virtual void OnChannelConnected(int32 peer_pid); |
77 | 77 |
78 // IPC::Message::Sender implementation: | 78 // IPC::Message::Sender implementation: |
79 virtual bool Send(IPC::Message* msg); | 79 virtual bool Send(IPC::Message* msg); |
80 | 80 |
| 81 // Whether this channel is able to handle IPC messages. |
| 82 bool IsScheduled(); |
| 83 |
| 84 // This is called when a command buffer transitions from the unscheduled |
| 85 // state to the scheduled state, which potentially means the channel |
| 86 // transitions from the unscheduled to the scheduled state. When this occurs |
| 87 // deferred IPC messaged are handled. |
| 88 void OnScheduled(); |
| 89 |
81 void CreateViewCommandBuffer( | 90 void CreateViewCommandBuffer( |
82 gfx::PluginWindowHandle window, | 91 gfx::PluginWindowHandle window, |
83 int32 render_view_id, | 92 int32 render_view_id, |
84 const GPUCreateCommandBufferConfig& init_params, | 93 const GPUCreateCommandBufferConfig& init_params, |
85 int32* route_id); | 94 int32* route_id); |
86 | 95 |
87 void ViewResized(int32 command_buffer_route_id); | 96 void ViewResized(int32 command_buffer_route_id); |
88 | 97 |
89 gfx::GLShareGroup* share_group() const { return share_group_.get(); } | 98 gfx::GLShareGroup* share_group() const { return share_group_.get(); } |
90 | 99 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 // A callback which is called after a Set/WaitLatch command is processed. | 133 // A callback which is called after a Set/WaitLatch command is processed. |
125 // The bool parameter will be true for SetLatch, and false for a WaitLatch | 134 // The bool parameter will be true for SetLatch, and false for a WaitLatch |
126 // that is blocked. An unblocked WaitLatch will not trigger a callback. | 135 // that is blocked. An unblocked WaitLatch will not trigger a callback. |
127 void OnLatchCallback(int route_id, bool is_set_latch); | 136 void OnLatchCallback(int route_id, bool is_set_latch); |
128 | 137 |
129 private: | 138 private: |
130 void OnDestroy(); | 139 void OnDestroy(); |
131 | 140 |
132 bool OnControlMessageReceived(const IPC::Message& msg); | 141 bool OnControlMessageReceived(const IPC::Message& msg); |
133 | 142 |
| 143 void HandleDeferredMessages(); |
| 144 |
134 int GenerateRouteID(); | 145 int GenerateRouteID(); |
135 | 146 |
136 // Message handlers. | 147 // Message handlers. |
137 void OnInitialize(base::ProcessHandle renderer_process); | 148 void OnInitialize(base::ProcessHandle renderer_process); |
138 void OnCreateOffscreenCommandBuffer( | 149 void OnCreateOffscreenCommandBuffer( |
139 const gfx::Size& size, | 150 const gfx::Size& size, |
140 const GPUCreateCommandBufferConfig& init_params, | 151 const GPUCreateCommandBufferConfig& init_params, |
141 int32* route_id); | 152 IPC::Message* reply_message); |
142 void OnDestroyCommandBuffer(int32 route_id); | 153 void OnDestroyCommandBuffer(int32 route_id, IPC::Message* reply_message); |
143 | 154 |
144 void OnCreateOffscreenSurface(const gfx::Size& size, | 155 void OnCreateOffscreenSurface(const gfx::Size& size, |
145 int* route_id); | 156 IPC::Message* reply_message); |
146 void OnDestroySurface(int route_id); | 157 void OnDestroySurface(int route_id); |
147 | 158 |
148 void OnCreateTransportTexture(int32 context_route_id, int32 host_id); | 159 void OnCreateTransportTexture(int32 context_route_id, int32 host_id); |
149 | 160 |
150 // The lifetime of objects of this class is managed by a GpuChannelManager. | 161 // The lifetime of objects of this class is managed by a GpuChannelManager. |
151 // The GpuChannelManager destroy all the GpuChannels that they own when they | 162 // The GpuChannelManager destroy all the GpuChannels that they own when they |
152 // are destroyed. So a raw pointer is safe. | 163 // are destroyed. So a raw pointer is safe. |
153 GpuChannelManager* gpu_channel_manager_; | 164 GpuChannelManager* gpu_channel_manager_; |
154 | 165 |
155 scoped_ptr<IPC::SyncChannel> channel_; | 166 scoped_ptr<IPC::SyncChannel> channel_; |
156 | 167 |
| 168 std::queue<IPC::Message*> deferred_messages_; |
| 169 |
157 // The id of the renderer who is on the other side of the channel. | 170 // The id of the renderer who is on the other side of the channel. |
158 int renderer_id_; | 171 int renderer_id_; |
159 | 172 |
160 // Handle to the renderer process that is on the other side of the channel. | 173 // Handle to the renderer process that is on the other side of the channel. |
161 base::ProcessHandle renderer_process_; | 174 base::ProcessHandle renderer_process_; |
162 | 175 |
163 // The process id of the renderer process. | 176 // The process id of the renderer process. |
164 base::ProcessId renderer_pid_; | 177 base::ProcessId renderer_pid_; |
165 | 178 |
166 // Used to implement message routing functionality to CommandBuffer objects | 179 // Used to implement message routing functionality to CommandBuffer objects |
(...skipping 14 matching lines...) Expand all Loading... |
181 #endif // defined (ENABLE_GPU) | 194 #endif // defined (ENABLE_GPU) |
182 | 195 |
183 // A collection of transport textures created. | 196 // A collection of transport textures created. |
184 typedef IDMap<TransportTexture, IDMapOwnPointer> TransportTextureMap; | 197 typedef IDMap<TransportTexture, IDMapOwnPointer> TransportTextureMap; |
185 TransportTextureMap transport_textures_; | 198 TransportTextureMap transport_textures_; |
186 | 199 |
187 bool log_messages_; // True if we should log sent and received messages. | 200 bool log_messages_; // True if we should log sent and received messages. |
188 gpu::gles2::DisallowedExtensions disallowed_extensions_; | 201 gpu::gles2::DisallowedExtensions disallowed_extensions_; |
189 GpuWatchdog* watchdog_; | 202 GpuWatchdog* watchdog_; |
190 | 203 |
| 204 ScopedRunnableMethodFactory<GpuChannel> task_factory_; |
| 205 |
191 DISALLOW_COPY_AND_ASSIGN(GpuChannel); | 206 DISALLOW_COPY_AND_ASSIGN(GpuChannel); |
192 }; | 207 }; |
193 | 208 |
194 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 209 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
OLD | NEW |