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 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 *surface_handle = surface->Handle(); | 1137 *surface_handle = surface->Handle(); |
1138 | 1138 |
1139 accelerated_surface_containers_[*surface_id] = surface; | 1139 accelerated_surface_containers_[*surface_id] = surface; |
1140 } | 1140 } |
1141 | 1141 |
1142 void RenderWidgetHostViewViews::AcceleratedSurfaceRelease(uint64 surface_id) { | 1142 void RenderWidgetHostViewViews::AcceleratedSurfaceRelease(uint64 surface_id) { |
1143 accelerated_surface_containers_.erase(surface_id); | 1143 accelerated_surface_containers_.erase(surface_id); |
1144 } | 1144 } |
1145 | 1145 |
1146 void RenderWidgetHostViewViews::AcceleratedSurfaceBuffersSwapped( | 1146 void RenderWidgetHostViewViews::AcceleratedSurfaceBuffersSwapped( |
1147 uint64 surface_id, | 1147 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
1148 int32 route_id, | |
1149 int gpu_host_id) { | 1148 int gpu_host_id) { |
1150 SetExternalTexture(accelerated_surface_containers_[surface_id]->GetTexture()); | 1149 SetExternalTexture( |
| 1150 accelerated_surface_containers_[params.surface_id]->GetTexture()); |
1151 glFlush(); | 1151 glFlush(); |
1152 | 1152 |
1153 if (!GetWidget() || !GetWidget()->GetCompositor()) { | 1153 if (!GetWidget() || !GetWidget()->GetCompositor()) { |
1154 // We have no compositor, so we have no way to display the surface | 1154 // We have no compositor, so we have no way to display the surface |
1155 AcknowledgeSwapBuffers(route_id, gpu_host_id); // Must still send the ACK | 1155 // Must still send the ACK |
| 1156 AcknowledgeSwapBuffers(params.route_id, gpu_host_id); |
1156 } else { | 1157 } else { |
1157 // Add sending an ACK to the list of things to do OnCompositingEnded | 1158 // Add sending an ACK to the list of things to do OnCompositingEnded |
1158 on_compositing_ended_callbacks_.push_back( | 1159 on_compositing_ended_callbacks_.push_back( |
1159 base::Bind(AcknowledgeSwapBuffers, route_id, gpu_host_id)); | 1160 base::Bind(AcknowledgeSwapBuffers, params.route_id, gpu_host_id)); |
1160 ui::Compositor *compositor = GetWidget()->GetCompositor(); | 1161 ui::Compositor *compositor = GetWidget()->GetCompositor(); |
1161 if (!compositor->HasObserver(this)) | 1162 if (!compositor->HasObserver(this)) |
1162 compositor->AddObserver(this); | 1163 compositor->AddObserver(this); |
1163 } | 1164 } |
1164 } | 1165 } |
1165 | 1166 |
1166 void RenderWidgetHostViewViews::OnCompositingEnded(ui::Compositor* compositor) { | 1167 void RenderWidgetHostViewViews::OnCompositingEnded(ui::Compositor* compositor) { |
1167 for (std::vector< base::Callback<void(void)> >::const_iterator | 1168 for (std::vector< base::Callback<void(void)> >::const_iterator |
1168 it = on_compositing_ended_callbacks_.begin(); | 1169 it = on_compositing_ended_callbacks_.begin(); |
1169 it != on_compositing_ended_callbacks_.end(); ++it) { | 1170 it != on_compositing_ended_callbacks_.end(); ++it) { |
1170 it->Run(); | 1171 it->Run(); |
1171 } | 1172 } |
1172 on_compositing_ended_callbacks_.clear(); | 1173 on_compositing_ended_callbacks_.clear(); |
1173 compositor->RemoveObserver(this); | 1174 compositor->RemoveObserver(this); |
1174 } | 1175 } |
1175 | 1176 |
| 1177 #else |
| 1178 |
| 1179 void RenderWidgetHostViewViews::AcceleratedSurfaceBuffersSwapped( |
| 1180 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
| 1181 int gpu_host_id) { |
| 1182 NOTREACHED(); |
| 1183 } |
| 1184 |
1176 #endif | 1185 #endif |
OLD | NEW |