| 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/renderer_gl_context.h" | 5 #include "content/renderer/renderer_gl_context.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" |
| 7 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 8 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
| 11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 12 #include "base/shared_memory.h" | 13 #include "base/shared_memory.h" |
| 13 #include "content/common/view_messages.h" | 14 #include "content/common/view_messages.h" |
| 14 #include "content/renderer/command_buffer_proxy.h" | 15 #include "content/renderer/command_buffer_proxy.h" |
| 15 #include "content/renderer/gpu_channel_host.h" | 16 #include "content/renderer/gpu_channel_host.h" |
| 16 #include "content/renderer/gpu_video_service_host.h" | 17 #include "content/renderer/gpu_video_service_host.h" |
| 17 #include "content/renderer/media/gles2_video_decode_context.h" | 18 #include "content/renderer/media/gles2_video_decode_context.h" |
| 18 #include "content/renderer/render_thread.h" | 19 #include "content/renderer/render_thread.h" |
| 19 #include "content/renderer/render_widget.h" | 20 #include "content/renderer/render_widget.h" |
| 20 #include "content/renderer/transport_texture_host.h" | 21 #include "content/renderer/transport_texture_host.h" |
| 21 #include "content/renderer/transport_texture_service.h" | 22 #include "content/renderer/transport_texture_service.h" |
| 22 #include "googleurl/src/gurl.h" | 23 #include "googleurl/src/gurl.h" |
| 23 #include "ipc/ipc_channel_handle.h" | 24 #include "ipc/ipc_channel_handle.h" |
| 24 | 25 |
| 25 #if defined(ENABLE_GPU) | 26 #if defined(ENABLE_GPU) |
| 26 #include "gpu/command_buffer/client/gles2_cmd_helper.h" | 27 #include "gpu/command_buffer/client/gles2_cmd_helper.h" |
| 27 #include "gpu/command_buffer/client/gles2_implementation.h" | 28 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 28 #include "gpu/command_buffer/client/gles2_lib.h" | 29 #include "gpu/command_buffer/client/gles2_lib.h" |
| 29 #include "gpu/command_buffer/common/constants.h" | 30 #include "gpu/command_buffer/common/constants.h" |
| 30 #include "gpu/common/gpu_trace_event.h" | |
| 31 #include "gpu/GLES2/gles2_command_buffer.h" | 31 #include "gpu/GLES2/gles2_command_buffer.h" |
| 32 #endif // ENABLE_GPU | 32 #endif // ENABLE_GPU |
| 33 | 33 |
| 34 namespace { | 34 namespace { |
| 35 | 35 |
| 36 const int32 kCommandBufferSize = 1024 * 1024; | 36 const int32 kCommandBufferSize = 1024 * 1024; |
| 37 // TODO(kbr): make the transfer buffer size configurable via context | 37 // TODO(kbr): make the transfer buffer size configurable via context |
| 38 // creation attributes. | 38 // creation attributes. |
| 39 const int32 kTransferBufferSize = 1024 * 1024; | 39 const int32 kTransferBufferSize = 1024 * 1024; |
| 40 | 40 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 if (context->command_buffer_->GetLastState().error != gpu::error::kNoError) | 283 if (context->command_buffer_->GetLastState().error != gpu::error::kNoError) |
| 284 return false; | 284 return false; |
| 285 } else { | 285 } else { |
| 286 gles2::SetGLContext(NULL); | 286 gles2::SetGLContext(NULL); |
| 287 } | 287 } |
| 288 | 288 |
| 289 return true; | 289 return true; |
| 290 } | 290 } |
| 291 | 291 |
| 292 bool RendererGLContext::SwapBuffers() { | 292 bool RendererGLContext::SwapBuffers() { |
| 293 GPU_TRACE_EVENT0("gpu", "RendererGLContext::SwapBuffers"); | 293 TRACE_EVENT0("gpu", "RendererGLContext::SwapBuffers"); |
| 294 // Don't request latest error status from service. Just use the locally cached | 294 // Don't request latest error status from service. Just use the locally cached |
| 295 // information from the last flush. | 295 // information from the last flush. |
| 296 if (command_buffer_->GetLastState().error != gpu::error::kNoError) | 296 if (command_buffer_->GetLastState().error != gpu::error::kNoError) |
| 297 return false; | 297 return false; |
| 298 | 298 |
| 299 gles2_implementation_->SwapBuffers(); | 299 gles2_implementation_->SwapBuffers(); |
| 300 return true; | 300 return true; |
| 301 } | 301 } |
| 302 | 302 |
| 303 media::VideoDecodeEngine* RendererGLContext::CreateVideoDecodeEngine() { | 303 media::VideoDecodeEngine* RendererGLContext::CreateVideoDecodeEngine() { |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 } | 574 } |
| 575 | 575 |
| 576 bool RendererGLContext::GetChildToParentLatch(uint32* child_to_parent_latch) { | 576 bool RendererGLContext::GetChildToParentLatch(uint32* child_to_parent_latch) { |
| 577 if (parent_.get()) { | 577 if (parent_.get()) { |
| 578 *child_to_parent_latch = child_to_parent_latch_; | 578 *child_to_parent_latch = child_to_parent_latch_; |
| 579 return true; | 579 return true; |
| 580 } | 580 } |
| 581 return false; | 581 return false; |
| 582 } | 582 } |
| 583 | 583 |
| OLD | NEW |