| 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 #include "content/renderer/gpu_channel_host.h" | 5 #include "content/renderer/gpu_channel_host.h" |
| 6 | 6 |
| 7 #include "chrome/renderer/render_thread.h" | 7 #include "chrome/renderer/render_thread.h" |
| 8 #include "content/common/child_process.h" | 8 #include "content/common/child_process.h" |
| 9 #include "content/common/gpu_messages.h" | 9 #include "content/common/gpu_messages.h" |
| 10 #include "content/renderer/command_buffer_proxy.h" | 10 #include "content/renderer/command_buffer_proxy.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 if (channel_.get()) | 94 if (channel_.get()) |
| 95 return channel_->Send(message); | 95 return channel_->Send(message); |
| 96 | 96 |
| 97 // Callee takes ownership of message, regardless of whether Send is | 97 // Callee takes ownership of message, regardless of whether Send is |
| 98 // successful. See IPC::Message::Sender. | 98 // successful. See IPC::Message::Sender. |
| 99 delete message; | 99 delete message; |
| 100 return false; | 100 return false; |
| 101 } | 101 } |
| 102 | 102 |
| 103 CommandBufferProxy* GpuChannelHost::CreateViewCommandBuffer( | 103 CommandBufferProxy* GpuChannelHost::CreateViewCommandBuffer( |
| 104 gfx::PluginWindowHandle compositing_surface, |
| 104 int render_view_id, | 105 int render_view_id, |
| 105 const std::string& allowed_extensions, | 106 const std::string& allowed_extensions, |
| 106 const std::vector<int32>& attribs, | 107 const std::vector<int32>& attribs, |
| 107 const GURL& active_url) { | 108 const GURL& active_url) { |
| 108 #if defined(ENABLE_GPU) | 109 #if defined(ENABLE_GPU) |
| 109 // An error occurred. Need to get the host again to reinitialize it. | 110 // An error occurred. Need to get the host again to reinitialize it. |
| 110 if (!channel_.get()) | 111 if (!channel_.get()) |
| 111 return NULL; | 112 return NULL; |
| 112 | 113 |
| 113 GPUCreateCommandBufferConfig init_params; | 114 GPUCreateCommandBufferConfig init_params; |
| 114 init_params.allowed_extensions = allowed_extensions; | 115 init_params.allowed_extensions = allowed_extensions; |
| 115 init_params.attribs = attribs; | 116 init_params.attribs = attribs; |
| 116 init_params.active_url = active_url; | 117 init_params.active_url = active_url; |
| 117 int32 route_id; | 118 int32 route_id; |
| 118 if (!RenderThread::current()->Send( | 119 if (!RenderThread::current()->Send( |
| 119 new GpuHostMsg_CreateViewCommandBuffer( | 120 new GpuHostMsg_CreateViewCommandBuffer( |
| 120 render_view_id, init_params, &route_id))) { | 121 compositing_surface, render_view_id, init_params, &route_id))) { |
| 121 return NULL; | 122 return NULL; |
| 122 } | 123 } |
| 123 | 124 |
| 124 if (route_id == MSG_ROUTING_NONE) | 125 if (route_id == MSG_ROUTING_NONE) |
| 125 return NULL; | 126 return NULL; |
| 126 | 127 |
| 127 CommandBufferProxy* command_buffer = new CommandBufferProxy(this, route_id); | 128 CommandBufferProxy* command_buffer = new CommandBufferProxy(this, route_id); |
| 128 router_.AddRoute(route_id, command_buffer); | 129 router_.AddRoute(route_id, command_buffer); |
| 129 proxies_[route_id] = command_buffer; | 130 proxies_[route_id] = command_buffer; |
| 130 return command_buffer; | 131 return command_buffer; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // Check the proxy has not already been removed after a channel error. | 179 // Check the proxy has not already been removed after a channel error. |
| 179 int route_id = command_buffer->route_id(); | 180 int route_id = command_buffer->route_id(); |
| 180 if (proxies_.find(command_buffer->route_id()) != proxies_.end()) { | 181 if (proxies_.find(command_buffer->route_id()) != proxies_.end()) { |
| 181 proxies_.erase(route_id); | 182 proxies_.erase(route_id); |
| 182 router_.RemoveRoute(route_id); | 183 router_.RemoveRoute(route_id); |
| 183 } | 184 } |
| 184 | 185 |
| 185 delete command_buffer; | 186 delete command_buffer; |
| 186 #endif | 187 #endif |
| 187 } | 188 } |
| OLD | NEW |