Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(873)

Side by Side Diff: chrome/renderer/gpu_channel_host.cc

Issue 6343006: Route IPC through browser when creating a viewable command buffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nit. Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/gpu_channel_host.h ('k') | chrome/renderer/render_widget_fullscreen_pepper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/renderer/gpu_channel_host.h" 5 #include "chrome/renderer/gpu_channel_host.h"
6 6
7 #include "chrome/common/child_process.h" 7 #include "chrome/common/child_process.h"
8 #include "chrome/common/gpu_create_command_buffer_config.h" 8 #include "chrome/common/gpu_create_command_buffer_config.h"
9 #include "chrome/common/gpu_messages.h" 9 #include "chrome/common/gpu_messages.h"
10 #include "chrome/common/render_messages.h"
10 #include "chrome/renderer/command_buffer_proxy.h" 11 #include "chrome/renderer/command_buffer_proxy.h"
11 #include "chrome/renderer/gpu_video_service_host.h" 12 #include "chrome/renderer/gpu_video_service_host.h"
13 #include "chrome/renderer/render_thread.h"
12 14
13 GpuChannelHost::GpuChannelHost() : state_(kUnconnected) { 15 GpuChannelHost::GpuChannelHost() : state_(kUnconnected) {
14 } 16 }
15 17
16 GpuChannelHost::~GpuChannelHost() { 18 GpuChannelHost::~GpuChannelHost() {
17 } 19 }
18 20
19 void GpuChannelHost::Connect(const IPC::ChannelHandle& channel_handle) { 21 void GpuChannelHost::Connect(const IPC::ChannelHandle& channel_handle) {
20 // Open a channel to the GPU process. 22 // Open a channel to the GPU process.
21 channel_.reset(new IPC::SyncChannel( 23 channel_.reset(new IPC::SyncChannel(
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 if (channel_.get()) 85 if (channel_.get())
84 return channel_->Send(message); 86 return channel_->Send(message);
85 87
86 // Callee takes ownership of message, regardless of whether Send is 88 // Callee takes ownership of message, regardless of whether Send is
87 // successful. See IPC::Message::Sender. 89 // successful. See IPC::Message::Sender.
88 delete message; 90 delete message;
89 return false; 91 return false;
90 } 92 }
91 93
92 CommandBufferProxy* GpuChannelHost::CreateViewCommandBuffer( 94 CommandBufferProxy* GpuChannelHost::CreateViewCommandBuffer(
93 gfx::NativeViewId view,
94 int render_view_id, 95 int render_view_id,
95 const std::string& allowed_extensions, 96 const std::string& allowed_extensions,
96 const std::vector<int32>& attribs) { 97 const std::vector<int32>& attribs) {
97 #if defined(ENABLE_GPU) 98 #if defined(ENABLE_GPU)
98 // An error occurred. Need to get the host again to reinitialize it. 99 // An error occurred. Need to get the host again to reinitialize it.
99 if (!channel_.get()) 100 if (!channel_.get())
100 return NULL; 101 return NULL;
101 102
102 GPUCreateCommandBufferConfig init_params(allowed_extensions, attribs); 103 GPUCreateCommandBufferConfig init_params(allowed_extensions, attribs);
103 int32 route_id; 104 int32 route_id;
104 if (!Send(new GpuChannelMsg_CreateViewCommandBuffer(view, 105 if (!RenderThread::current()->Send(new ViewHostMsg_CreateViewCommandBuffer(
105 render_view_id, 106 render_view_id, init_params, &route_id))) {
106 init_params,
107 &route_id))) {
108 return NULL; 107 return NULL;
109 } 108 }
110 109
111 if (route_id == MSG_ROUTING_NONE) 110 if (route_id == MSG_ROUTING_NONE)
112 return NULL; 111 return NULL;
113 112
114 CommandBufferProxy* command_buffer = new CommandBufferProxy(this, route_id); 113 CommandBufferProxy* command_buffer = new CommandBufferProxy(this, route_id);
115 router_.AddRoute(route_id, command_buffer); 114 router_.AddRoute(route_id, command_buffer);
116 proxies_[route_id] = command_buffer; 115 proxies_[route_id] = command_buffer;
117 return command_buffer; 116 return command_buffer;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // Check the proxy has not already been removed after a channel error. 160 // Check the proxy has not already been removed after a channel error.
162 int route_id = command_buffer->route_id(); 161 int route_id = command_buffer->route_id();
163 if (proxies_.find(command_buffer->route_id()) != proxies_.end()) { 162 if (proxies_.find(command_buffer->route_id()) != proxies_.end()) {
164 proxies_.erase(route_id); 163 proxies_.erase(route_id);
165 router_.RemoveRoute(route_id); 164 router_.RemoveRoute(route_id);
166 } 165 }
167 166
168 delete command_buffer; 167 delete command_buffer;
169 #endif 168 #endif
170 } 169 }
OLDNEW
« no previous file with comments | « chrome/renderer/gpu_channel_host.h ('k') | chrome/renderer/render_widget_fullscreen_pepper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698