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

Unified Diff: content/renderer/pepper/pepper_platform_context_3d_impl.cc

Issue 10918182: Don't require a recreation of the context when fullscreening (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix style Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/pepper/pepper_platform_context_3d_impl.cc
diff --git a/content/renderer/pepper/pepper_platform_context_3d_impl.cc b/content/renderer/pepper/pepper_platform_context_3d_impl.cc
index b3981bfcf80f9cfd474d80d4606654862012d8b3..3c805382ba447d725ffeaba0ebf31623474904e7 100644
--- a/content/renderer/pepper/pepper_platform_context_3d_impl.cc
+++ b/content/renderer/pepper/pepper_platform_context_3d_impl.cc
@@ -147,6 +147,37 @@ bool PlatformContext3DImpl::Init(const int32* attrib_list,
return true;
}
+void PlatformContext3DImpl::SetParentContext(
+ PepperParentContextProvider* parent_context_provider) {
+ if (parent_context_.get() && parent_texture_id_ != 0) {
+ // Flush any remaining commands in the parent context to make sure the
+ // texture id accounting stays consistent.
+ gpu::gles2::GLES2Implementation* parent_gles2 =
+ parent_context_->GetImplementation();
+ parent_gles2->helper()->CommandBufferHelper::Flush();
+ parent_gles2->FreeTextureId(parent_texture_id_);
+ parent_context_.reset();
+ parent_texture_id_ = 0;
+ }
+
+ WebGraphicsContext3DCommandBufferImpl* parent_context =
+ parent_context_provider->GetParentContextForPlatformContext3D();
+ if (!parent_context)
+ return;
+
+ parent_context_ = parent_context->AsWeakPtr();
+ // Flush any remaining commands in the parent context to make sure the
+ // texture id accounting stays consistent.
+ gpu::gles2::GLES2Implementation* parent_gles2 =
+ parent_context_->GetImplementation();
+ parent_gles2->helper()->CommandBufferHelper::Flush();
+ parent_texture_id_ = parent_gles2->MakeTextureId();
+
+ CommandBufferProxy* parent_command_buffer =
+ parent_context_->GetCommandBufferProxy();
+ command_buffer_->SetParent(parent_command_buffer, parent_texture_id_);
+}
+
unsigned PlatformContext3DImpl::GetBackingTextureId() {
DCHECK(command_buffer_);
return parent_texture_id_;

Powered by Google App Engine
This is Rietveld 408576698