| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "gpu/ipc/in_process_command_buffer.h" | 5 #include "gpu/ipc/in_process_command_buffer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 #if defined(OS_WIN) | 1075 #if defined(OS_WIN) |
| 1076 void InProcessCommandBuffer::DidCreateAcceleratedSurfaceChildWindow( | 1076 void InProcessCommandBuffer::DidCreateAcceleratedSurfaceChildWindow( |
| 1077 SurfaceHandle parent_window, | 1077 SurfaceHandle parent_window, |
| 1078 SurfaceHandle child_window) { | 1078 SurfaceHandle child_window) { |
| 1079 // TODO(fsamuel): Implement this. | 1079 // TODO(fsamuel): Implement this. |
| 1080 } | 1080 } |
| 1081 #endif | 1081 #endif |
| 1082 | 1082 |
| 1083 void InProcessCommandBuffer::DidSwapBuffersComplete( | 1083 void InProcessCommandBuffer::DidSwapBuffersComplete( |
| 1084 SwapBuffersCompleteParams params) { | 1084 SwapBuffersCompleteParams params) { |
| 1085 if (!origin_task_runner_) { |
| 1086 DidSwapBuffersCompleteOnOriginThread(std::move(params)); |
| 1087 return; |
| 1088 } |
| 1089 origin_task_runner_->PostTask( |
| 1090 FROM_HERE, |
| 1091 base::Bind(&InProcessCommandBuffer::DidSwapBuffersCompleteOnOriginThread, |
| 1092 client_thread_weak_ptr_, base::Passed(¶ms))); |
| 1093 } |
| 1094 |
| 1095 const gles2::FeatureInfo* InProcessCommandBuffer::GetFeatureInfo() const { |
| 1096 return context_group_->feature_info(); |
| 1097 } |
| 1098 |
| 1099 void InProcessCommandBuffer::SetLatencyInfoCallback( |
| 1100 const LatencyInfoCallback& callback) { |
| 1101 // TODO(fsamuel): Implement this. |
| 1102 } |
| 1103 |
| 1104 void InProcessCommandBuffer::UpdateVSyncParameters(base::TimeTicks timebase, |
| 1105 base::TimeDelta interval) { |
| 1106 if (!origin_task_runner_) { |
| 1107 UpdateVSyncParametersOnOriginThread(timebase, interval); |
| 1108 return; |
| 1109 } |
| 1110 origin_task_runner_->PostTask( |
| 1111 FROM_HERE, |
| 1112 base::Bind(&InProcessCommandBuffer::UpdateVSyncParametersOnOriginThread, |
| 1113 client_thread_weak_ptr_, timebase, interval)); |
| 1114 } |
| 1115 |
| 1116 void InProcessCommandBuffer::DidSwapBuffersCompleteOnOriginThread( |
| 1117 SwapBuffersCompleteParams params) { |
| 1085 #if defined(OS_MACOSX) | 1118 #if defined(OS_MACOSX) |
| 1086 gpu::GpuProcessHostedCALayerTreeParamsMac params_mac; | 1119 gpu::GpuProcessHostedCALayerTreeParamsMac params_mac; |
| 1087 params_mac.ca_context_id = params.ca_context_id; | 1120 params_mac.ca_context_id = params.ca_context_id; |
| 1088 params_mac.fullscreen_low_power_ca_context_valid = | 1121 params_mac.fullscreen_low_power_ca_context_valid = |
| 1089 params.fullscreen_low_power_ca_context_valid; | 1122 params.fullscreen_low_power_ca_context_valid; |
| 1090 params_mac.fullscreen_low_power_ca_context_id = | 1123 params_mac.fullscreen_low_power_ca_context_id = |
| 1091 params.fullscreen_low_power_ca_context_id; | 1124 params.fullscreen_low_power_ca_context_id; |
| 1092 params_mac.io_surface.reset(IOSurfaceLookupFromMachPort(params.io_surface)); | 1125 params_mac.io_surface.reset(IOSurfaceLookupFromMachPort(params.io_surface)); |
| 1093 params_mac.pixel_size = params.pixel_size; | 1126 params_mac.pixel_size = params.pixel_size; |
| 1094 params_mac.scale_factor = params.scale_factor; | 1127 params_mac.scale_factor = params.scale_factor; |
| 1095 params_mac.responses = std::move(params.in_use_responses); | 1128 params_mac.responses = std::move(params.in_use_responses); |
| 1096 gpu::GpuProcessHostedCALayerTreeParamsMac* mac_frame_ptr = ¶ms_mac; | 1129 gpu::GpuProcessHostedCALayerTreeParamsMac* mac_frame_ptr = ¶ms_mac; |
| 1097 #else | 1130 #else |
| 1098 gpu::GpuProcessHostedCALayerTreeParamsMac* mac_frame_ptr = nullptr; | 1131 gpu::GpuProcessHostedCALayerTreeParamsMac* mac_frame_ptr = nullptr; |
| 1099 #endif | 1132 #endif |
| 1100 if (!swap_buffers_completion_callback_.is_null()) { | 1133 if (!swap_buffers_completion_callback_.is_null()) { |
| 1101 if (!ui::LatencyInfo::Verify( | 1134 if (!ui::LatencyInfo::Verify( |
| 1102 params.latency_info, | 1135 params.latency_info, |
| 1103 "InProcessCommandBuffer::DidSwapBuffersComplete")) { | 1136 "InProcessCommandBuffer::DidSwapBuffersComplete")) { |
| 1104 swap_buffers_completion_callback_.Run(std::vector<ui::LatencyInfo>(), | 1137 swap_buffers_completion_callback_.Run(std::vector<ui::LatencyInfo>(), |
| 1105 params.result, mac_frame_ptr); | 1138 params.result, mac_frame_ptr); |
| 1106 } else { | 1139 } else { |
| 1107 swap_buffers_completion_callback_.Run(params.latency_info, params.result, | 1140 swap_buffers_completion_callback_.Run(params.latency_info, params.result, |
| 1108 mac_frame_ptr); | 1141 mac_frame_ptr); |
| 1109 } | 1142 } |
| 1110 } | 1143 } |
| 1111 } | 1144 } |
| 1112 | 1145 |
| 1113 const gles2::FeatureInfo* InProcessCommandBuffer::GetFeatureInfo() const { | 1146 void InProcessCommandBuffer::UpdateVSyncParametersOnOriginThread( |
| 1114 return context_group_->feature_info(); | 1147 base::TimeTicks timebase, |
| 1115 } | 1148 base::TimeDelta interval) { |
| 1116 | |
| 1117 void InProcessCommandBuffer::SetLatencyInfoCallback( | |
| 1118 const LatencyInfoCallback& callback) { | |
| 1119 // TODO(fsamuel): Implement this. | |
| 1120 } | |
| 1121 | |
| 1122 void InProcessCommandBuffer::UpdateVSyncParameters(base::TimeTicks timebase, | |
| 1123 base::TimeDelta interval) { | |
| 1124 if (!update_vsync_parameters_completion_callback_.is_null()) | 1149 if (!update_vsync_parameters_completion_callback_.is_null()) |
| 1125 update_vsync_parameters_completion_callback_.Run(timebase, interval); | 1150 update_vsync_parameters_completion_callback_.Run(timebase, interval); |
| 1126 } | 1151 } |
| 1127 | 1152 |
| 1128 void InProcessCommandBuffer::SetSwapBuffersCompletionCallback( | 1153 void InProcessCommandBuffer::SetSwapBuffersCompletionCallback( |
| 1129 const SwapBuffersCompletionCallback& callback) { | 1154 const SwapBuffersCompletionCallback& callback) { |
| 1130 swap_buffers_completion_callback_ = callback; | 1155 swap_buffers_completion_callback_ = callback; |
| 1131 } | 1156 } |
| 1132 | 1157 |
| 1133 void InProcessCommandBuffer::SetUpdateVSyncParametersCallback( | 1158 void InProcessCommandBuffer::SetUpdateVSyncParametersCallback( |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1176 return wrapped_callback; | 1201 return wrapped_callback; |
| 1177 } | 1202 } |
| 1178 | 1203 |
| 1179 InProcessCommandBuffer::GpuTask::GpuTask(const base::Closure& callback, | 1204 InProcessCommandBuffer::GpuTask::GpuTask(const base::Closure& callback, |
| 1180 uint32_t order_number) | 1205 uint32_t order_number) |
| 1181 : callback(callback), order_number(order_number) {} | 1206 : callback(callback), order_number(order_number) {} |
| 1182 | 1207 |
| 1183 InProcessCommandBuffer::GpuTask::~GpuTask() {} | 1208 InProcessCommandBuffer::GpuTask::~GpuTask() {} |
| 1184 | 1209 |
| 1185 } // namespace gpu | 1210 } // namespace gpu |
| OLD | NEW |