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

Side by Side 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 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/renderer/pepper/pepper_platform_context_3d_impl.h" 5 #include "content/renderer/pepper/pepper_platform_context_3d_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "content/common/gpu/client/gpu_channel_host.h" 8 #include "content/common/gpu/client/gpu_channel_host.h"
9 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 9 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
10 #include "content/renderer/pepper/pepper_parent_context_provider.h" 10 #include "content/renderer/pepper/pepper_parent_context_provider.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 parent_texture_id_ = parent_gles2->MakeTextureId(); 140 parent_texture_id_ = parent_gles2->MakeTextureId();
141 141
142 CommandBufferProxy* parent_command_buffer = 142 CommandBufferProxy* parent_command_buffer =
143 parent_context_->GetCommandBufferProxy(); 143 parent_context_->GetCommandBufferProxy();
144 if (!command_buffer_->SetParent(parent_command_buffer, parent_texture_id_)) 144 if (!command_buffer_->SetParent(parent_command_buffer, parent_texture_id_))
145 return false; 145 return false;
146 146
147 return true; 147 return true;
148 } 148 }
149 149
150 void PlatformContext3DImpl::SetParentContext(
151 PepperParentContextProvider* parent_context_provider) {
152 if (parent_context_.get() && parent_texture_id_ != 0) {
153 // Flush any remaining commands in the parent context to make sure the
154 // texture id accounting stays consistent.
155 gpu::gles2::GLES2Implementation* parent_gles2 =
156 parent_context_->GetImplementation();
157 parent_gles2->helper()->CommandBufferHelper::Flush();
158 parent_gles2->FreeTextureId(parent_texture_id_);
159 parent_context_.reset();
160 parent_texture_id_ = 0;
161 }
162
163 WebGraphicsContext3DCommandBufferImpl* parent_context =
164 parent_context_provider->GetParentContextForPlatformContext3D();
165 if (!parent_context)
166 return;
167
168 parent_context_ = parent_context->AsWeakPtr();
169 // Flush any remaining commands in the parent context to make sure the
170 // texture id accounting stays consistent.
171 gpu::gles2::GLES2Implementation* parent_gles2 =
172 parent_context_->GetImplementation();
173 parent_gles2->helper()->CommandBufferHelper::Flush();
174 parent_texture_id_ = parent_gles2->MakeTextureId();
175
176 CommandBufferProxy* parent_command_buffer =
177 parent_context_->GetCommandBufferProxy();
178 command_buffer_->SetParent(parent_command_buffer, parent_texture_id_);
179 }
180
150 unsigned PlatformContext3DImpl::GetBackingTextureId() { 181 unsigned PlatformContext3DImpl::GetBackingTextureId() {
151 DCHECK(command_buffer_); 182 DCHECK(command_buffer_);
152 return parent_texture_id_; 183 return parent_texture_id_;
153 } 184 }
154 185
155 bool PlatformContext3DImpl::IsOpaque() { 186 bool PlatformContext3DImpl::IsOpaque() {
156 DCHECK(command_buffer_); 187 DCHECK(command_buffer_);
157 return !has_alpha_; 188 return !has_alpha_;
158 } 189 }
159 190
(...skipping 29 matching lines...) Expand all
189 void PlatformContext3DImpl::OnConsoleMessage(const std::string& msg, int id) { 220 void PlatformContext3DImpl::OnConsoleMessage(const std::string& msg, int id) {
190 DCHECK(command_buffer_); 221 DCHECK(command_buffer_);
191 222
192 if (!console_message_callback_.is_null()) 223 if (!console_message_callback_.is_null())
193 console_message_callback_.Run(msg, id); 224 console_message_callback_.Run(msg, id);
194 } 225 }
195 226
196 } // namespace content 227 } // namespace content
197 228
198 #endif // ENABLE_GPU 229 #endif // ENABLE_GPU
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698