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

Side by Side Diff: content/renderer/gpu/renderer_gl_context.cc

Issue 8342024: Fixed bugs with Pepper 3D under dynamic GPU switching. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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) 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/gpu/renderer_gl_context.h" 5 #include "content/renderer/gpu/renderer_gl_context.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 last_error_ = SUCCESS; 251 last_error_ = SUCCESS;
252 return old_error; 252 return old_error;
253 } else { 253 } else {
254 // All command buffer errors are unrecoverable. The error is treated as a 254 // All command buffer errors are unrecoverable. The error is treated as a
255 // lost context: destroy the context and create another one. 255 // lost context: destroy the context and create another one.
256 return CONTEXT_LOST; 256 return CONTEXT_LOST;
257 } 257 }
258 } 258 }
259 259
260 bool RendererGLContext::IsCommandBufferContextLost() { 260 bool RendererGLContext::IsCommandBufferContextLost() {
261 // If the channel shut down unexpectedly, let that supersede the
262 // command buffer's state.
263 if (channel_->state() == GpuChannelHost::kLost)
264 return true;
261 gpu::CommandBuffer::State state = command_buffer_->GetLastState(); 265 gpu::CommandBuffer::State state = command_buffer_->GetLastState();
262 return state.error == gpu::error::kLostContext; 266 return state.error == gpu::error::kLostContext;
263 } 267 }
264 268
265 CommandBufferProxy* RendererGLContext::GetCommandBufferProxy() { 269 CommandBufferProxy* RendererGLContext::GetCommandBufferProxy() {
266 return command_buffer_; 270 return command_buffer_;
267 } 271 }
268 272
269 bool RendererGLContext::SetSurfaceVisible(bool visible) { 273 bool RendererGLContext::SetSurfaceVisible(bool visible) {
270 return GetCommandBufferProxy()->SetSurfaceVisible(visible); 274 return GetCommandBufferProxy()->SetSurfaceVisible(visible);
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 void RendererGLContext::OnContextLost() { 464 void RendererGLContext::OnContextLost() {
461 if (!context_lost_callback_.is_null()) { 465 if (!context_lost_callback_.is_null()) {
462 RendererGLContext::ContextLostReason reason = kUnknown; 466 RendererGLContext::ContextLostReason reason = kUnknown;
463 if (command_buffer_) { 467 if (command_buffer_) {
464 reason = ConvertReason( 468 reason = ConvertReason(
465 command_buffer_->GetLastState().context_lost_reason); 469 command_buffer_->GetLastState().context_lost_reason);
466 } 470 }
467 context_lost_callback_.Run(reason); 471 context_lost_callback_.Run(reason);
468 } 472 }
469 } 473 }
OLDNEW
« no previous file with comments | « content/content_renderer.gypi ('k') | content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698