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

Side by Side Diff: content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc

Issue 1885463003: Remove WebGraphicsContext3DCommandBufferImpl::IsCommandBufferContextLost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sharelost: moreerror Created 4 years, 8 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
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/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 5 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
6 6
7 #include "third_party/khronos/GLES2/gl2.h" 7 #include "third_party/khronos/GLES2/gl2.h"
8 #ifndef GL_GLEXT_PROTOTYPES 8 #ifndef GL_GLEXT_PROTOTYPES
9 #define GL_GLEXT_PROTOTYPES 1 9 #define GL_GLEXT_PROTOTYPES 1
10 #endif 10 #endif
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 command_buffer_.reset(); 310 command_buffer_.reset();
311 311
312 host_ = nullptr; 312 host_ = nullptr;
313 } 313 }
314 314
315 gpu::ContextSupport* 315 gpu::ContextSupport*
316 WebGraphicsContext3DCommandBufferImpl::GetContextSupport() { 316 WebGraphicsContext3DCommandBufferImpl::GetContextSupport() {
317 return real_gl_.get(); 317 return real_gl_.get();
318 } 318 }
319 319
320 bool WebGraphicsContext3DCommandBufferImpl::IsCommandBufferContextLost() {
321 // If the channel shut down unexpectedly, let that supersede the
322 // command buffer's state.
323 if (host_.get() && host_->IsLost())
324 return true;
325 gpu::CommandBuffer::State state = command_buffer_->GetLastState();
326 return gpu::error::IsError(state.error);
327 }
328
329 // static 320 // static
330 WebGraphicsContext3DCommandBufferImpl* 321 WebGraphicsContext3DCommandBufferImpl*
331 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( 322 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
332 gpu::GpuChannelHost* host, 323 gpu::GpuChannelHost* host,
333 const gpu::gles2::ContextCreationAttribHelper& attributes, 324 const gpu::gles2::ContextCreationAttribHelper& attributes,
334 gfx::GpuPreference gpu_preference, 325 gfx::GpuPreference gpu_preference,
335 bool share_resources, 326 bool share_resources,
336 bool automatic_flushes, 327 bool automatic_flushes,
337 const GURL& active_url, 328 const GURL& active_url,
338 const SharedMemoryLimits& limits, 329 const SharedMemoryLimits& limits,
339 WebGraphicsContext3DCommandBufferImpl* share_context) { 330 WebGraphicsContext3DCommandBufferImpl* share_context) {
340 if (!host) 331 DCHECK(host);
341 return NULL;
342
343 if (share_context && share_context->IsCommandBufferContextLost())
344 return NULL;
345
346 return new WebGraphicsContext3DCommandBufferImpl( 332 return new WebGraphicsContext3DCommandBufferImpl(
347 gpu::kNullSurfaceHandle, active_url, host, attributes, gpu_preference, 333 gpu::kNullSurfaceHandle, active_url, host, attributes, gpu_preference,
348 share_resources, automatic_flushes, limits, share_context); 334 share_resources, automatic_flushes, limits, share_context);
349 } 335 }
350 336
351 void WebGraphicsContext3DCommandBufferImpl::OnContextLost() { 337 void WebGraphicsContext3DCommandBufferImpl::OnContextLost() {
352 if (context_lost_callback_) 338 if (context_lost_callback_)
353 context_lost_callback_->onContextLost(); 339 context_lost_callback_->onContextLost();
354 340
355 share_group_->RemoveAllContexts(); 341 share_group_->RemoveAllContexts();
(...skipping 10 matching lines...) Expand all
366 352
367 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage(const char* message, 353 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage(const char* message,
368 int id) { 354 int id) {
369 if (error_message_callback_) { 355 if (error_message_callback_) {
370 blink::WebString str = blink::WebString::fromUTF8(message); 356 blink::WebString str = blink::WebString::fromUTF8(message);
371 error_message_callback_->onErrorMessage(str, id); 357 error_message_callback_->onErrorMessage(str, id);
372 } 358 }
373 } 359 }
374 360
375 } // namespace content 361 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h ('k') | content/renderer/render_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698