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

Side by Side Diff: content/renderer/browser_plugin/guest_to_embedder_channel.cc

Issue 10386145: Add the necessary plumbing mechanisms to ensure proper WebGL support inside the <browser> tag, whic… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address comments; clean up; fix bugs. Created 8 years, 7 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
« no previous file with comments | « no previous file | content/renderer/pepper/pepper_platform_context_3d_impl.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) 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/renderer/browser_plugin/guest_to_embedder_channel.h" 5 #include "content/renderer/browser_plugin/guest_to_embedder_channel.h"
6 6
7 #include "base/process_util.h" 7 #include "base/process_util.h"
8 #include "content/common/browser_plugin_messages.h" 8 #include "content/common/browser_plugin_messages.h"
9 #include "content/common/child_process.h" 9 #include "content/common/child_process.h"
10 #include "content/renderer/browser_plugin/browser_plugin_channel_manager.h" 10 #include "content/renderer/browser_plugin/browser_plugin_channel_manager.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 RenderViewImpl* render_view) { 157 RenderViewImpl* render_view) {
158 std::vector<int32_t> attribs; 158 std::vector<int32_t> attribs;
159 attribs.push_back(PP_GRAPHICS3DATTRIB_NONE); 159 attribs.push_back(PP_GRAPHICS3DATTRIB_NONE);
160 160
161 ppapi::HostResource resource; 161 ppapi::HostResource resource;
162 DCHECK(render_view->guest_pp_instance()); 162 DCHECK(render_view->guest_pp_instance());
163 // TODO(fsamuel): Support child contexts. 163 // TODO(fsamuel): Support child contexts.
164 bool success = Send(new PpapiHostMsg_PPBGraphics3D_Create( 164 bool success = Send(new PpapiHostMsg_PPBGraphics3D_Create(
165 ppapi::API_ID_PPB_GRAPHICS_3D, 165 ppapi::API_ID_PPB_GRAPHICS_3D,
166 render_view->guest_pp_instance(), 166 render_view->guest_pp_instance(),
167 offscreen ? render_view->guest_graphics_resource()
168 : ppapi::HostResource(),
piman 2012/05/24 23:10:08 No, you should pass here the WebGraphicsContext3DC
(scshunt) 2012/05/24 23:18:07 I'm going to be changing this up a lot here now th
167 attribs, 169 attribs,
168 &resource)); 170 &resource));
169 if (!success || resource.is_null()) 171 if (!success || resource.is_null())
170 return false; 172 return false;
171 if (!offscreen) { 173 if (!offscreen) {
172 PP_Bool result = PP_FALSE; 174 PP_Bool result = PP_FALSE;
173 Send(new PpapiHostMsg_PPBInstance_BindGraphics( 175 Send(new PpapiHostMsg_PPBInstance_BindGraphics(
174 ppapi::API_ID_PPB_INSTANCE, 176 ppapi::API_ID_PPB_INSTANCE,
175 render_view->guest_pp_instance(), 177 render_view->guest_pp_instance(),
176 resource, 178 resource,
177 &result)); 179 &result));
178 if (result != PP_TRUE) 180 if (result != PP_TRUE)
179 return false; 181 return false;
182 render_view->set_guest_graphics_resource(resource);
piman 2012/05/24 23:10:08 err, what if we have more than 1 "onscreen" contex
(scshunt) 2012/05/24 23:18:07 This is actually an unrelated fix, and is an impro
Fady Samuel 2012/05/24 23:19:00 PpapiCommandBufferProxy knows about its HostResour
180 } 183 }
181 184
182 CommandBufferProxy* command_buffer = 185 CommandBufferProxy* command_buffer =
183 new ppapi::proxy::PpapiCommandBufferProxy(resource, this); 186 new ppapi::proxy::PpapiCommandBufferProxy(resource, this);
184 command_buffer->Initialize(); 187 command_buffer->Initialize();
185 context->InitializeWithCommandBuffer( 188 context->InitializeWithCommandBuffer(
186 command_buffer, 189 command_buffer,
187 attributes, 190 attributes,
188 false /* bind generates resources */); 191 false /* bind generates resources */);
189 render_view->set_guest_graphics_resource(resource);
190 return true; 192 return true;
191 } 193 }
192 194
193 void GuestToEmbedderChannel::AddGuest( 195 void GuestToEmbedderChannel::AddGuest(
194 PP_Instance instance, 196 PP_Instance instance,
195 RenderViewImpl* render_view) { 197 RenderViewImpl* render_view) {
196 DCHECK(instance); 198 DCHECK(instance);
197 DCHECK(render_view_instances_.find(instance) == render_view_instances_.end()); 199 DCHECK(render_view_instances_.find(instance) == render_view_instances_.end());
198 render_view_instances_[instance] = render_view->AsWeakPtr(); 200 render_view_instances_[instance] = render_view->AsWeakPtr();
199 } 201 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 render_view->GetWebView()->handleInputEvent(*web_input_event)); 273 render_view->GetWebView()->handleInputEvent(*web_input_event));
272 } 274 }
273 275
274 void GuestToEmbedderChannel::OnContextLost(PP_Instance instance) { 276 void GuestToEmbedderChannel::OnContextLost(PP_Instance instance) {
275 DCHECK(render_view_instances_.find(instance) != render_view_instances_.end()); 277 DCHECK(render_view_instances_.find(instance) != render_view_instances_.end());
276 RenderViewImpl* render_view = render_view_instances_[instance]; 278 RenderViewImpl* render_view = render_view_instances_[instance];
277 render_view->GetWebView()->loseCompositorContext(1); 279 render_view->GetWebView()->loseCompositorContext(1);
278 } 280 }
279 281
280 } // namespace content 282 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/pepper/pepper_platform_context_3d_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698