| OLD | NEW |
| 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/content_gl_context.h" | 5 #include "content/common/gpu/client/content_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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 } | 272 } |
| 273 | 273 |
| 274 int ContentGLContext::GetContextID() { | 274 int ContentGLContext::GetContextID() { |
| 275 return command_buffer_->GetRouteID(); | 275 return command_buffer_->GetRouteID(); |
| 276 } | 276 } |
| 277 | 277 |
| 278 bool ContentGLContext::SetSurfaceVisible(bool visible) { | 278 bool ContentGLContext::SetSurfaceVisible(bool visible) { |
| 279 return GetCommandBufferProxy()->SetSurfaceVisible(visible); | 279 return GetCommandBufferProxy()->SetSurfaceVisible(visible); |
| 280 } | 280 } |
| 281 | 281 |
| 282 bool ContentGLContext::DiscardBackbuffer() { | |
| 283 return GetCommandBufferProxy()->DiscardBackbuffer(); | |
| 284 } | |
| 285 | |
| 286 bool ContentGLContext::EnsureBackbuffer() { | |
| 287 return GetCommandBufferProxy()->EnsureBackbuffer(); | |
| 288 } | |
| 289 | |
| 290 void ContentGLContext::SetMemoryAllocationChangedCallback( | 282 void ContentGLContext::SetMemoryAllocationChangedCallback( |
| 291 const base::Callback<void(const GpuMemoryAllocationForRenderer&)>& | 283 const base::Callback<void(const GpuMemoryAllocationForRenderer&)>& |
| 292 callback) { | 284 callback) { |
| 293 GetCommandBufferProxy()->SetMemoryAllocationChangedCallback(callback); | 285 GetCommandBufferProxy()->SetMemoryAllocationChangedCallback(callback); |
| 294 } | 286 } |
| 295 | 287 |
| 296 gpu::gles2::GLES2Implementation* ContentGLContext::GetImplementation() { | 288 gpu::gles2::GLES2Implementation* ContentGLContext::GetImplementation() { |
| 297 return gles2_implementation_; | 289 return gles2_implementation_; |
| 298 } | 290 } |
| 299 | 291 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 void ContentGLContext::OnContextLost() { | 463 void ContentGLContext::OnContextLost() { |
| 472 if (!context_lost_callback_.is_null()) { | 464 if (!context_lost_callback_.is_null()) { |
| 473 ContentGLContext::ContextLostReason reason = kUnknown; | 465 ContentGLContext::ContextLostReason reason = kUnknown; |
| 474 if (command_buffer_) { | 466 if (command_buffer_) { |
| 475 reason = ConvertReason( | 467 reason = ConvertReason( |
| 476 command_buffer_->GetLastState().context_lost_reason); | 468 command_buffer_->GetLastState().context_lost_reason); |
| 477 } | 469 } |
| 478 context_lost_callback_.Run(reason); | 470 context_lost_callback_.Run(reason); |
| 479 } | 471 } |
| 480 } | 472 } |
| OLD | NEW |