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/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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 } | 373 } |
374 if (!command_buffer_) { | 374 if (!command_buffer_) { |
375 Destroy(); | 375 Destroy(); |
376 return false; | 376 return false; |
377 } | 377 } |
378 | 378 |
379 { | 379 { |
380 TRACE_EVENT0("gpu", | 380 TRACE_EVENT0("gpu", |
381 "RendererGLContext::Initialize::InitializeCommandBuffer"); | 381 "RendererGLContext::Initialize::InitializeCommandBuffer"); |
382 // Initiaize the command buffer. | 382 // Initiaize the command buffer. |
383 if (!command_buffer_->Initialize(kCommandBufferSize)) { | 383 if (!command_buffer_->Initialize()) { |
384 Destroy(); | 384 Destroy(); |
385 return false; | 385 return false; |
386 } | 386 } |
387 } | 387 } |
388 | 388 |
389 command_buffer_->SetChannelErrorCallback( | 389 command_buffer_->SetChannelErrorCallback( |
390 base::Bind(&RendererGLContext::OnContextLost, base::Unretained(this))); | 390 base::Bind(&RendererGLContext::OnContextLost, base::Unretained(this))); |
391 | 391 |
392 // Create the GLES2 helper, which writes the command buffer protocol. | 392 // Create the GLES2 helper, which writes the command buffer protocol. |
393 gles2_helper_ = new gpu::gles2::GLES2CmdHelper(command_buffer_); | 393 gles2_helper_ = new gpu::gles2::GLES2CmdHelper(command_buffer_); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 void RendererGLContext::OnContextLost() { | 464 void RendererGLContext::OnContextLost() { |
465 if (!context_lost_callback_.is_null()) { | 465 if (!context_lost_callback_.is_null()) { |
466 RendererGLContext::ContextLostReason reason = kUnknown; | 466 RendererGLContext::ContextLostReason reason = kUnknown; |
467 if (command_buffer_) { | 467 if (command_buffer_) { |
468 reason = ConvertReason( | 468 reason = ConvertReason( |
469 command_buffer_->GetLastState().context_lost_reason); | 469 command_buffer_->GetLastState().context_lost_reason); |
470 } | 470 } |
471 context_lost_callback_.Run(reason); | 471 context_lost_callback_.Run(reason); |
472 } | 472 } |
473 } | 473 } |
OLD | NEW |