| 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/gpu/gpu_channel_host.h" | 9 #include "content/renderer/gpu/gpu_channel_host.h" |
| 10 #include "content/renderer/pepper_platform_context_3d_impl.h" | 10 #include "content/renderer/pepper_platform_context_3d_impl.h" |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 gl->BufferData(GL_ARRAY_BUFFER, | 455 gl->BufferData(GL_ARRAY_BUFFER, |
| 456 sizeof(kTexCoords), | 456 sizeof(kTexCoords), |
| 457 kTexCoords, | 457 kTexCoords, |
| 458 GL_STATIC_DRAW); | 458 GL_STATIC_DRAW); |
| 459 gl->VertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, NULL); | 459 gl->VertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, NULL); |
| 460 gl->EnableVertexAttribArray(0); | 460 gl->EnableVertexAttribArray(0); |
| 461 return true; | 461 return true; |
| 462 } | 462 } |
| 463 | 463 |
| 464 bool RenderWidgetFullscreenPepper::CheckCompositing() { | 464 bool RenderWidgetFullscreenPepper::CheckCompositing() { |
| 465 bool compositing = webwidget_->isAcceleratedCompositingActive(); | 465 bool compositing = |
| 466 if (compositing != is_accelerated_compositing_active_) { | 466 webwidget_ && webwidget_->isAcceleratedCompositingActive(); |
| 467 if (compositing != is_accelerated_compositing_active_) |
| 467 didActivateAcceleratedCompositing(compositing); | 468 didActivateAcceleratedCompositing(compositing); |
| 468 } | |
| 469 return compositing; | 469 return compositing; |
| 470 } | 470 } |
| 471 | 471 |
| 472 void RenderWidgetFullscreenPepper::SwapBuffers() { | 472 void RenderWidgetFullscreenPepper::SwapBuffers() { |
| 473 DCHECK(context_); | 473 DCHECK(context_); |
| 474 OnSwapBuffersPosted(); | 474 OnSwapBuffersPosted(); |
| 475 context_->SwapBuffers(); | 475 context_->SwapBuffers(); |
| 476 } | 476 } |
| 477 | 477 |
| 478 void RenderWidgetFullscreenPepper::OnLostContext( | 478 void RenderWidgetFullscreenPepper::OnLostContext( |
| 479 RendererGLContext::ContextLostReason) { | 479 RendererGLContext::ContextLostReason) { |
| 480 if (!context_) | 480 if (!context_) |
| 481 return; | 481 return; |
| 482 // Destroy the context later, in case we got called from InitContext for | 482 // Destroy the context later, in case we got called from InitContext for |
| 483 // example. We still need to reset context_ now so that a new context gets | 483 // example. We still need to reset context_ now so that a new context gets |
| 484 // created when the plugin recreates its own. | 484 // created when the plugin recreates its own. |
| 485 MessageLoop::current()->PostTask( | 485 MessageLoop::current()->PostTask( |
| 486 FROM_HERE, | 486 FROM_HERE, |
| 487 NewRunnableFunction(DestroyContext, context_, program_, buffer_)); | 487 NewRunnableFunction(DestroyContext, context_, program_, buffer_)); |
| 488 context_ = NULL; | 488 context_ = NULL; |
| 489 program_ = 0; | 489 program_ = 0; |
| 490 buffer_ = 0; | 490 buffer_ = 0; |
| 491 OnSwapBuffersAborted(); | 491 OnSwapBuffersAborted(); |
| 492 CheckCompositing(); |
| 492 } | 493 } |
| 493 | 494 |
| 494 void RenderWidgetFullscreenPepper::OnSwapBuffersCompleteByRendererGLContext() { | 495 void RenderWidgetFullscreenPepper::OnSwapBuffersCompleteByRendererGLContext() { |
| 495 OnSwapBuffersComplete(); | 496 OnSwapBuffersComplete(); |
| 496 } | 497 } |
| OLD | NEW |