| 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/gpu_command_buffer_stub.h" | 5 #include "content/common/gpu/gpu_command_buffer_stub.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/hash.h" | 12 #include "base/hash.h" |
| 13 #include "base/json/json_writer.h" | 13 #include "base/json/json_writer.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/shared_memory.h" | 15 #include "base/memory/shared_memory.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "base/trace_event/trace_event.h" | 17 #include "base/trace_event/trace_event.h" |
| 18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
| 19 #include "content/common/gpu/command_buffer_console_message.h" |
| 19 #include "content/common/gpu/gpu_channel.h" | 20 #include "content/common/gpu/gpu_channel.h" |
| 20 #include "content/common/gpu/gpu_channel_manager.h" | 21 #include "content/common/gpu/gpu_channel_manager.h" |
| 21 #include "content/common/gpu/gpu_memory_manager.h" | 22 #include "content/common/gpu/gpu_memory_manager.h" |
| 22 #include "content/common/gpu/gpu_memory_tracking.h" | 23 #include "content/common/gpu/gpu_memory_tracking.h" |
| 23 #include "content/common/gpu/gpu_messages.h" | 24 #include "content/common/gpu/gpu_messages.h" |
| 24 #include "content/common/gpu/gpu_watchdog.h" | 25 #include "content/common/gpu/gpu_watchdog.h" |
| 25 #include "content/common/gpu/image_transport_surface.h" | 26 #include "content/common/gpu/image_transport_surface.h" |
| 26 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" | 27 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" |
| 27 #include "content/common/gpu/media/gpu_video_encode_accelerator.h" | 28 #include "content/common/gpu/media/gpu_video_encode_accelerator.h" |
| 28 #include "content/public/common/content_client.h" | 29 #include "content/public/common/content_client.h" |
| (...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 uint64_t command_buffer_id, | 1019 uint64_t command_buffer_id, |
| 1019 uint64_t release) { | 1020 uint64_t release) { |
| 1020 DCHECK(waiting_for_sync_point_); | 1021 DCHECK(waiting_for_sync_point_); |
| 1021 TRACE_EVENT_ASYNC_END1("gpu", "WaitFenceSync", this, "GpuCommandBufferStub", | 1022 TRACE_EVENT_ASYNC_END1("gpu", "WaitFenceSync", this, "GpuCommandBufferStub", |
| 1022 this); | 1023 this); |
| 1023 PullTextureUpdates(namespace_id, command_buffer_id, release); | 1024 PullTextureUpdates(namespace_id, command_buffer_id, release); |
| 1024 waiting_for_sync_point_ = false; | 1025 waiting_for_sync_point_ = false; |
| 1025 scheduler_->SetScheduled(true); | 1026 scheduler_->SetScheduled(true); |
| 1026 } | 1027 } |
| 1027 | 1028 |
| 1028 void GpuCommandBufferStub::OnCreateImage( | 1029 void GpuCommandBufferStub::OnCreateImage(const CreateImageParams& params) { |
| 1029 const GpuCommandBufferMsg_CreateImage_Params& params) { | |
| 1030 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateImage"); | 1030 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateImage"); |
| 1031 const int32_t id = params.id; | 1031 const int32_t id = params.id; |
| 1032 const gfx::GpuMemoryBufferHandle& handle = params.gpu_memory_buffer; | 1032 const gfx::GpuMemoryBufferHandle& handle = params.gpu_memory_buffer; |
| 1033 const gfx::Size& size = params.size; | 1033 const gfx::Size& size = params.size; |
| 1034 const gfx::BufferFormat& format = params.format; | 1034 const gfx::BufferFormat& format = params.format; |
| 1035 const uint32_t internalformat = params.internal_format; | 1035 const uint32_t internalformat = params.internal_format; |
| 1036 const uint64_t image_release_count = params.image_release_count; | 1036 const uint64_t image_release_count = params.image_release_count; |
| 1037 | 1037 |
| 1038 if (!decoder_) | 1038 if (!decoder_) |
| 1039 return; | 1039 return; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1085 if (!image_manager->LookupImage(id)) { | 1085 if (!image_manager->LookupImage(id)) { |
| 1086 LOG(ERROR) << "Image with ID doesn't exist."; | 1086 LOG(ERROR) << "Image with ID doesn't exist."; |
| 1087 return; | 1087 return; |
| 1088 } | 1088 } |
| 1089 | 1089 |
| 1090 image_manager->RemoveImage(id); | 1090 image_manager->RemoveImage(id); |
| 1091 } | 1091 } |
| 1092 | 1092 |
| 1093 void GpuCommandBufferStub::SendConsoleMessage(int32_t id, | 1093 void GpuCommandBufferStub::SendConsoleMessage(int32_t id, |
| 1094 const std::string& message) { | 1094 const std::string& message) { |
| 1095 GPUCommandBufferConsoleMessage console_message; | 1095 CommandBufferConsoleMessage console_message; |
| 1096 console_message.id = id; | 1096 console_message.id = id; |
| 1097 console_message.message = message; | 1097 console_message.message = message; |
| 1098 IPC::Message* msg = new GpuCommandBufferMsg_ConsoleMsg( | 1098 IPC::Message* msg = new GpuCommandBufferMsg_ConsoleMsg( |
| 1099 route_id_, console_message); | 1099 route_id_, console_message); |
| 1100 msg->set_unblock(true); | 1100 msg->set_unblock(true); |
| 1101 Send(msg); | 1101 Send(msg); |
| 1102 } | 1102 } |
| 1103 | 1103 |
| 1104 void GpuCommandBufferStub::SendCachedShader( | 1104 void GpuCommandBufferStub::SendCachedShader( |
| 1105 const std::string& key, const std::string& shader) { | 1105 const std::string& key, const std::string& shader) { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1179 result)); | 1179 result)); |
| 1180 } | 1180 } |
| 1181 | 1181 |
| 1182 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, | 1182 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, |
| 1183 base::TimeDelta interval) { | 1183 base::TimeDelta interval) { |
| 1184 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, | 1184 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, |
| 1185 interval)); | 1185 interval)); |
| 1186 } | 1186 } |
| 1187 | 1187 |
| 1188 } // namespace content | 1188 } // namespace content |
| OLD | NEW |