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