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/render_widget_fullscreen_pepper.h" | 5 #include "content/renderer/render_widget_fullscreen_pepper.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "content/common/view_messages.h" | 8 #include "content/common/view_messages.h" |
9 #include "content/renderer/renderer_gl_context.h" | 9 #include "content/renderer/renderer_gl_context.h" |
10 #include "content/renderer/gpu_channel_host.h" | 10 #include "content/renderer/gpu_channel_host.h" |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
294 gl->Viewport(0, 0, size.width(), size.height()); | 294 gl->Viewport(0, 0, size.width(), size.height()); |
295 } | 295 } |
296 RenderWidget::OnResize(size, resizer_rect); | 296 RenderWidget::OnResize(size, resizer_rect); |
297 } | 297 } |
298 | 298 |
299 WebWidget* RenderWidgetFullscreenPepper::CreateWebWidget() { | 299 WebWidget* RenderWidgetFullscreenPepper::CreateWebWidget() { |
300 return new PepperWidget(plugin_, this); | 300 return new PepperWidget(plugin_, this); |
301 } | 301 } |
302 | 302 |
303 void RenderWidgetFullscreenPepper::CreateContext() { | 303 void RenderWidgetFullscreenPepper::CreateContext() { |
304 DCHECK(!context_); | 304 DCHECK(!context_); |
piman
2011/04/15 21:53:33
This can in theory be called before we have the co
| |
305 RenderThread* render_thread = RenderThread::current(); | 305 RenderThread* render_thread = RenderThread::current(); |
306 DCHECK(render_thread); | 306 DCHECK(render_thread); |
307 GpuChannelHost* host = render_thread->EstablishGpuChannelSync( | 307 GpuChannelHost* host = render_thread->EstablishGpuChannelSync( |
308 content::CAUSE_FOR_GPU_LAUNCH_RENDERWIDGETFULLSCREENPEPPER_CREATECONTEXT); | 308 content::CAUSE_FOR_GPU_LAUNCH_RENDERWIDGETFULLSCREENPEPPER_CREATECONTEXT); |
309 if (!host) | 309 if (!host) |
310 return; | 310 return; |
311 const int32 attribs[] = { | 311 const int32 attribs[] = { |
312 RendererGLContext::ALPHA_SIZE, 8, | 312 RendererGLContext::ALPHA_SIZE, 8, |
313 RendererGLContext::DEPTH_SIZE, 0, | 313 RendererGLContext::DEPTH_SIZE, 0, |
314 RendererGLContext::STENCIL_SIZE, 0, | 314 RendererGLContext::STENCIL_SIZE, 0, |
315 RendererGLContext::SAMPLES, 0, | 315 RendererGLContext::SAMPLES, 0, |
316 RendererGLContext::SAMPLE_BUFFERS, 0, | 316 RendererGLContext::SAMPLE_BUFFERS, 0, |
317 RendererGLContext::NONE, | 317 RendererGLContext::NONE, |
318 }; | 318 }; |
319 context_ = RendererGLContext::CreateViewContext( | 319 context_ = RendererGLContext::CreateViewContext( |
320 host, | 320 host, |
321 compositing_surface(), | |
321 routing_id(), | 322 routing_id(), |
322 "GL_OES_packed_depth_stencil GL_OES_depth24", | 323 "GL_OES_packed_depth_stencil GL_OES_depth24", |
323 attribs, | 324 attribs, |
324 active_url_); | 325 active_url_); |
325 if (!context_) | 326 if (!context_) |
326 return; | 327 return; |
327 | 328 |
328 if (!InitContext()) { | 329 if (!InitContext()) { |
329 DestroyContext(context_, program_, buffer_); | 330 DestroyContext(context_, program_, buffer_); |
330 context_ = NULL; | 331 context_ = NULL; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
444 // Destroy the context later, in case we got called from InitContext for | 445 // Destroy the context later, in case we got called from InitContext for |
445 // example. We still need to reset context_ now so that a new context gets | 446 // example. We still need to reset context_ now so that a new context gets |
446 // created when the plugin recreates its own. | 447 // created when the plugin recreates its own. |
447 MessageLoop::current()->PostTask( | 448 MessageLoop::current()->PostTask( |
448 FROM_HERE, | 449 FROM_HERE, |
449 NewRunnableFunction(DestroyContext, context_, program_, buffer_)); | 450 NewRunnableFunction(DestroyContext, context_, program_, buffer_)); |
450 context_ = NULL; | 451 context_ = NULL; |
451 program_ = 0; | 452 program_ = 0; |
452 buffer_ = 0; | 453 buffer_ = 0; |
453 } | 454 } |
OLD | NEW |