| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/hash.h" | 9 #include "base/hash.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "content/common/gpu/gpu_channel.h" | 13 #include "content/common/gpu/gpu_channel.h" |
| 14 #include "content/common/gpu/gpu_channel_manager.h" | 14 #include "content/common/gpu/gpu_channel_manager.h" |
| 15 #include "content/common/gpu/gpu_command_buffer_stub.h" | 15 #include "content/common/gpu/gpu_command_buffer_stub.h" |
| 16 #include "content/common/gpu/gpu_memory_manager.h" | 16 #include "content/common/gpu/gpu_memory_manager.h" |
| 17 #include "content/common/gpu/gpu_memory_tracking.h" | 17 #include "content/common/gpu/gpu_memory_tracking.h" |
| 18 #include "content/common/gpu/gpu_messages.h" | 18 #include "content/common/gpu/gpu_messages.h" |
| 19 #include "content/common/gpu/gpu_watchdog.h" | 19 #include "content/common/gpu/gpu_watchdog.h" |
| 20 #include "content/common/gpu/image_transport_surface.h" | 20 #include "content/common/gpu/image_transport_surface.h" |
| 21 #include "content/common/gpu/media/gl_surface_capturer.h" |
| 21 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" | 22 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" |
| 22 #include "content/common/gpu/sync_point_manager.h" | 23 #include "content/common/gpu/sync_point_manager.h" |
| 23 #include "content/public/common/content_client.h" | 24 #include "content/public/common/content_client.h" |
| 24 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
| 25 #include "gpu/command_buffer/common/constants.h" | 26 #include "gpu/command_buffer/common/constants.h" |
| 26 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 27 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 27 #include "gpu/command_buffer/common/mailbox.h" | 28 #include "gpu/command_buffer/common/mailbox.h" |
| 28 #include "gpu/command_buffer/service/gl_context_virtual.h" | 29 #include "gpu/command_buffer/service/gl_context_virtual.h" |
| 29 #include "gpu/command_buffer/service/gl_state_restorer_impl.h" | 30 #include "gpu/command_buffer/service/gl_state_restorer_impl.h" |
| 30 #include "gpu/command_buffer/service/logger.h" | 31 #include "gpu/command_buffer/service/logger.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetLatencyInfo, OnSetLatencyInfo); | 200 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetLatencyInfo, OnSetLatencyInfo); |
| 200 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled); | 201 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled); |
| 201 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RegisterTransferBuffer, | 202 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RegisterTransferBuffer, |
| 202 OnRegisterTransferBuffer); | 203 OnRegisterTransferBuffer); |
| 203 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyTransferBuffer, | 204 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyTransferBuffer, |
| 204 OnDestroyTransferBuffer); | 205 OnDestroyTransferBuffer); |
| 205 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetTransferBuffer, | 206 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetTransferBuffer, |
| 206 OnGetTransferBuffer); | 207 OnGetTransferBuffer); |
| 207 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoDecoder, | 208 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoDecoder, |
| 208 OnCreateVideoDecoder) | 209 OnCreateVideoDecoder) |
| 210 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateSurfaceCapturer, |
| 211 OnCreateSurfaceCapturer) |
| 209 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetSurfaceVisible, | 212 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetSurfaceVisible, |
| 210 OnSetSurfaceVisible) | 213 OnSetSurfaceVisible) |
| 211 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DiscardBackbuffer, | 214 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DiscardBackbuffer, |
| 212 OnDiscardBackbuffer) | 215 OnDiscardBackbuffer) |
| 213 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_EnsureBackbuffer, | 216 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_EnsureBackbuffer, |
| 214 OnEnsureBackbuffer) | 217 OnEnsureBackbuffer) |
| 215 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RetireSyncPoint, | 218 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RetireSyncPoint, |
| 216 OnRetireSyncPoint) | 219 OnRetireSyncPoint) |
| 217 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPoint, | 220 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPoint, |
| 218 OnSignalSyncPoint) | 221 OnSignalSyncPoint) |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 IPC::Message* reply_message) { | 723 IPC::Message* reply_message) { |
| 721 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateVideoDecoder"); | 724 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateVideoDecoder"); |
| 722 int decoder_route_id = channel_->GenerateRouteID(); | 725 int decoder_route_id = channel_->GenerateRouteID(); |
| 723 GpuVideoDecodeAccelerator* decoder = | 726 GpuVideoDecodeAccelerator* decoder = |
| 724 new GpuVideoDecodeAccelerator(decoder_route_id, this); | 727 new GpuVideoDecodeAccelerator(decoder_route_id, this); |
| 725 decoder->Initialize(profile, reply_message); | 728 decoder->Initialize(profile, reply_message); |
| 726 // decoder is registered as a DestructionObserver of this stub and will | 729 // decoder is registered as a DestructionObserver of this stub and will |
| 727 // self-delete during destruction of this stub. | 730 // self-delete during destruction of this stub. |
| 728 } | 731 } |
| 729 | 732 |
| 733 void GpuCommandBufferStub::OnCreateSurfaceCapturer( |
| 734 IPC::Message* reply_message) { |
| 735 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateSurfaceCapturer"); |
| 736 int capturer_route_id = channel_->GenerateRouteID(); |
| 737 new GLSurfaceCapturer(capturer_route_id, this); |
| 738 // The capturer is registered as a DestructionObserver of this stub and will |
| 739 // self-delete during destruction of this stub. |
| 740 GpuCommandBufferMsg_CreateSurfaceCapturer::WriteReplyParams( |
| 741 reply_message, capturer_route_id); |
| 742 Send(reply_message); |
| 743 } |
| 744 |
| 730 void GpuCommandBufferStub::OnSetSurfaceVisible(bool visible) { | 745 void GpuCommandBufferStub::OnSetSurfaceVisible(bool visible) { |
| 731 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnSetSurfaceVisible"); | 746 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnSetSurfaceVisible"); |
| 732 if (memory_manager_client_state_) | 747 if (memory_manager_client_state_) |
| 733 memory_manager_client_state_->SetVisible(visible); | 748 memory_manager_client_state_->SetVisible(visible); |
| 734 } | 749 } |
| 735 | 750 |
| 736 void GpuCommandBufferStub::OnDiscardBackbuffer() { | 751 void GpuCommandBufferStub::OnDiscardBackbuffer() { |
| 737 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDiscardBackbuffer"); | 752 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDiscardBackbuffer"); |
| 738 if (!surface_.get()) | 753 if (!surface_.get()) |
| 739 return; | 754 return; |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 command_buffer_->GetState().error == gpu::error::kLostContext) | 956 command_buffer_->GetState().error == gpu::error::kLostContext) |
| 942 return; | 957 return; |
| 943 | 958 |
| 944 command_buffer_->SetContextLostReason(gpu::error::kUnknown); | 959 command_buffer_->SetContextLostReason(gpu::error::kUnknown); |
| 945 if (decoder_) | 960 if (decoder_) |
| 946 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); | 961 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); |
| 947 command_buffer_->SetParseError(gpu::error::kLostContext); | 962 command_buffer_->SetParseError(gpu::error::kLostContext); |
| 948 } | 963 } |
| 949 | 964 |
| 950 } // namespace content | 965 } // namespace content |
| OLD | NEW |