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

Side by Side Diff: content/common/gpu/client/gpu_channel_host.cc

Issue 13647014: Attach flag to use virtual context for WebGraphicsContext3D (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove printf... Created 7 years, 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/common/gpu/client/gpu_channel_host.h" 5 #include "content/common/gpu/client/gpu_channel_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 delete message; 125 delete message;
126 return false; 126 return false;
127 } 127 }
128 128
129 CommandBufferProxyImpl* GpuChannelHost::CreateViewCommandBuffer( 129 CommandBufferProxyImpl* GpuChannelHost::CreateViewCommandBuffer(
130 int32 surface_id, 130 int32 surface_id,
131 CommandBufferProxyImpl* share_group, 131 CommandBufferProxyImpl* share_group,
132 const std::string& allowed_extensions, 132 const std::string& allowed_extensions,
133 const std::vector<int32>& attribs, 133 const std::vector<int32>& attribs,
134 const GURL& active_url, 134 const GURL& active_url,
135 bool use_virtual_gl_context,
135 gfx::GpuPreference gpu_preference) { 136 gfx::GpuPreference gpu_preference) {
136 TRACE_EVENT1("gpu", 137 TRACE_EVENT1("gpu",
137 "GpuChannelHost::CreateViewCommandBuffer", 138 "GpuChannelHost::CreateViewCommandBuffer",
138 "surface_id", 139 "surface_id",
139 surface_id); 140 surface_id);
140 141
141 AutoLock lock(context_lock_); 142 AutoLock lock(context_lock_);
142 // An error occurred. Need to get the host again to reinitialize it. 143 // An error occurred. Need to get the host again to reinitialize it.
143 if (!channel_.get()) 144 if (!channel_.get())
144 return NULL; 145 return NULL;
145 146
146 GPUCreateCommandBufferConfig init_params; 147 GPUCreateCommandBufferConfig init_params;
147 init_params.share_group_id = 148 init_params.share_group_id =
148 share_group ? share_group->GetRouteID() : MSG_ROUTING_NONE; 149 share_group ? share_group->GetRouteID() : MSG_ROUTING_NONE;
149 init_params.allowed_extensions = allowed_extensions; 150 init_params.allowed_extensions = allowed_extensions;
150 init_params.attribs = attribs; 151 init_params.attribs = attribs;
151 init_params.active_url = active_url; 152 init_params.active_url = active_url;
152 init_params.gpu_preference = gpu_preference; 153 init_params.gpu_preference = gpu_preference;
154 init_params.use_virtual_gl_context = use_virtual_gl_context;
153 int32 route_id = factory_->CreateViewCommandBuffer(surface_id, init_params); 155 int32 route_id = factory_->CreateViewCommandBuffer(surface_id, init_params);
154 if (route_id == MSG_ROUTING_NONE) 156 if (route_id == MSG_ROUTING_NONE)
155 return NULL; 157 return NULL;
156 158
157 CommandBufferProxyImpl* command_buffer = 159 CommandBufferProxyImpl* command_buffer =
158 new CommandBufferProxyImpl(this, route_id); 160 new CommandBufferProxyImpl(this, route_id);
159 AddRoute(route_id, command_buffer->AsWeakPtr()); 161 AddRoute(route_id, command_buffer->AsWeakPtr());
160 proxies_[route_id] = command_buffer; 162 proxies_[route_id] = command_buffer;
161 return command_buffer; 163 return command_buffer;
162 } 164 }
163 165
164 CommandBufferProxyImpl* GpuChannelHost::CreateOffscreenCommandBuffer( 166 CommandBufferProxyImpl* GpuChannelHost::CreateOffscreenCommandBuffer(
165 const gfx::Size& size, 167 const gfx::Size& size,
166 CommandBufferProxyImpl* share_group, 168 CommandBufferProxyImpl* share_group,
167 const std::string& allowed_extensions, 169 const std::string& allowed_extensions,
168 const std::vector<int32>& attribs, 170 const std::vector<int32>& attribs,
169 const GURL& active_url, 171 const GURL& active_url,
172 bool use_virtual_gl_context,
170 gfx::GpuPreference gpu_preference) { 173 gfx::GpuPreference gpu_preference) {
171 TRACE_EVENT0("gpu", "GpuChannelHost::CreateOffscreenCommandBuffer"); 174 TRACE_EVENT0("gpu", "GpuChannelHost::CreateOffscreenCommandBuffer");
172 175
173 AutoLock lock(context_lock_); 176 AutoLock lock(context_lock_);
174 // An error occurred. Need to get the host again to reinitialize it. 177 // An error occurred. Need to get the host again to reinitialize it.
175 if (!channel_.get()) 178 if (!channel_.get())
176 return NULL; 179 return NULL;
177 180
178 GPUCreateCommandBufferConfig init_params; 181 GPUCreateCommandBufferConfig init_params;
179 init_params.share_group_id = 182 init_params.share_group_id =
180 share_group ? share_group->GetRouteID() : MSG_ROUTING_NONE; 183 share_group ? share_group->GetRouteID() : MSG_ROUTING_NONE;
181 init_params.allowed_extensions = allowed_extensions; 184 init_params.allowed_extensions = allowed_extensions;
182 init_params.attribs = attribs; 185 init_params.attribs = attribs;
183 init_params.active_url = active_url; 186 init_params.active_url = active_url;
184 init_params.gpu_preference = gpu_preference; 187 init_params.gpu_preference = gpu_preference;
188 init_params.use_virtual_gl_context = use_virtual_gl_context;
185 int32 route_id; 189 int32 route_id;
186 if (!Send(new GpuChannelMsg_CreateOffscreenCommandBuffer(size, 190 if (!Send(new GpuChannelMsg_CreateOffscreenCommandBuffer(size,
187 init_params, 191 init_params,
188 &route_id))) { 192 &route_id))) {
189 return NULL; 193 return NULL;
190 } 194 }
191 195
192 if (route_id == MSG_ROUTING_NONE) 196 if (route_id == MSG_ROUTING_NONE)
193 return NULL; 197 return NULL;
194 198
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 const GpuListenerInfo& info = it->second; 398 const GpuListenerInfo& info = it->second;
395 info.loop->PostTask( 399 info.loop->PostTask(
396 FROM_HERE, 400 FROM_HERE,
397 base::Bind(&IPC::Listener::OnChannelError, info.listener)); 401 base::Bind(&IPC::Listener::OnChannelError, info.listener));
398 } 402 }
399 403
400 listeners_.clear(); 404 listeners_.clear();
401 } 405 }
402 406
403 } // namespace content 407 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/gpu_channel_host.h ('k') | content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698