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 "chrome/browser/renderer_host/render_widget_host_view_views.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_views.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 *surface_handle = surface->Handle(); | 1129 *surface_handle = surface->Handle(); |
1130 | 1130 |
1131 accelerated_surface_containers_[*surface_id] = surface.release(); | 1131 accelerated_surface_containers_[*surface_id] = surface.release(); |
1132 } | 1132 } |
1133 | 1133 |
1134 void RenderWidgetHostViewViews::AcceleratedSurfaceRelease(uint64 surface_id) { | 1134 void RenderWidgetHostViewViews::AcceleratedSurfaceRelease(uint64 surface_id) { |
1135 accelerated_surface_containers_.erase(surface_id); | 1135 accelerated_surface_containers_.erase(surface_id); |
1136 } | 1136 } |
1137 | 1137 |
1138 void RenderWidgetHostViewViews::AcceleratedSurfaceBuffersSwapped( | 1138 void RenderWidgetHostViewViews::AcceleratedSurfaceBuffersSwapped( |
1139 uint64 surface_id, | 1139 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
1140 int32 route_id, | |
1141 int gpu_host_id) { | 1140 int gpu_host_id) { |
1142 SetExternalTexture(accelerated_surface_containers_[surface_id].get()); | 1141 SetExternalTexture(accelerated_surface_containers_[params.surface_id].get()); |
1143 glFlush(); | 1142 glFlush(); |
1144 | 1143 |
1145 if (!GetWidget() || !GetWidget()->GetCompositor()) { | 1144 if (!GetWidget() || !GetWidget()->GetCompositor()) { |
1146 // We have no compositor, so we have no way to display the surface | 1145 // We have no compositor, so we have no way to display the surface |
1147 AcknowledgeSwapBuffers(route_id, gpu_host_id); // Must still send the ACK | 1146 // Must still send the ACK |
| 1147 AcknowledgeSwapBuffers(params.route_id, gpu_host_id); |
1148 } else { | 1148 } else { |
1149 // Add sending an ACK to the list of things to do OnCompositingEnded | 1149 // Add sending an ACK to the list of things to do OnCompositingEnded |
1150 on_compositing_ended_callbacks_.push_back( | 1150 on_compositing_ended_callbacks_.push_back( |
1151 base::Bind(AcknowledgeSwapBuffers, route_id, gpu_host_id)); | 1151 base::Bind(AcknowledgeSwapBuffers, params.route_id, gpu_host_id)); |
1152 ui::Compositor *compositor = GetWidget()->GetCompositor(); | 1152 ui::Compositor *compositor = GetWidget()->GetCompositor(); |
1153 if (!compositor->HasObserver(this)) | 1153 if (!compositor->HasObserver(this)) |
1154 compositor->AddObserver(this); | 1154 compositor->AddObserver(this); |
1155 } | 1155 } |
1156 } | 1156 } |
1157 | 1157 |
1158 void RenderWidgetHostViewViews::OnCompositingEnded(ui::Compositor* compositor) { | 1158 void RenderWidgetHostViewViews::OnCompositingEnded(ui::Compositor* compositor) { |
1159 for (std::vector< base::Callback<void(void)> >::const_iterator | 1159 for (std::vector< base::Callback<void(void)> >::const_iterator |
1160 it = on_compositing_ended_callbacks_.begin(); | 1160 it = on_compositing_ended_callbacks_.begin(); |
1161 it != on_compositing_ended_callbacks_.end(); ++it) { | 1161 it != on_compositing_ended_callbacks_.end(); ++it) { |
1162 it->Run(); | 1162 it->Run(); |
1163 } | 1163 } |
1164 on_compositing_ended_callbacks_.clear(); | 1164 on_compositing_ended_callbacks_.clear(); |
1165 compositor->RemoveObserver(this); | 1165 compositor->RemoveObserver(this); |
1166 } | 1166 } |
1167 | 1167 |
| 1168 #else |
| 1169 |
| 1170 void RenderWidgetHostViewViews::AcceleratedSurfaceBuffersSwapped( |
| 1171 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
| 1172 int gpu_host_id) { |
| 1173 } |
| 1174 |
1168 #endif | 1175 #endif |
OLD | NEW |