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