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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "chrome/browser/renderer_host/accelerated_surface_container_touch.h" | 9 #include "chrome/browser/renderer_host/accelerated_surface_container_touch.h" |
10 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 10 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 return status; | 190 return status; |
191 } | 191 } |
192 | 192 |
193 gfx::PluginWindowHandle RenderWidgetHostViewViews::GetCompositingSurface() { | 193 gfx::PluginWindowHandle RenderWidgetHostViewViews::GetCompositingSurface() { |
194 // On TOUCH_UI builds, the GPU process renders to an offscreen surface | 194 // On TOUCH_UI builds, the GPU process renders to an offscreen surface |
195 // (created by the GPU process), which is later displayed by the browser. | 195 // (created by the GPU process), which is later displayed by the browser. |
196 // As the GPU process creates this surface, we can return any non-zero value. | 196 // As the GPU process creates this surface, we can return any non-zero value. |
197 return 1; | 197 return 1; |
198 } | 198 } |
199 | 199 |
200 void RenderWidgetHostViewViews::AcceleratedSurfaceSetIOSurface( | 200 void RenderWidgetHostViewViews::AcceleratedSurfaceNew( |
201 int32 width, int32 height, uint64 surface_id) { | 201 int32 width, |
202 accelerated_surface_containers_[surface_id] = | 202 int32 height, |
203 AcceleratedSurfaceContainerTouch::CreateAcceleratedSurfaceContainer( | 203 uint64* surface_id, |
204 gfx::Size(width, height), | 204 TransportDIB::Handle* surface_handle) { |
205 surface_id); | 205 scoped_ptr<AcceleratedSurfaceContainerTouch> surface( |
| 206 AcceleratedSurfaceContainerTouch::CreateAcceleratedSurfaceContainer( |
| 207 gfx::Size(width, height))); |
| 208 if (!surface->Initialize(surface_id)) { |
| 209 LOG(ERROR) << "Failed to create AcceleratedSurfaceContainer"; |
| 210 return; |
| 211 } |
| 212 *surface_handle = surface->Handle(); |
| 213 |
| 214 accelerated_surface_containers_[*surface_id] = surface.release(); |
206 } | 215 } |
207 | 216 |
208 void RenderWidgetHostViewViews::AcceleratedSurfaceRelease(uint64 surface_id) { | 217 void RenderWidgetHostViewViews::AcceleratedSurfaceRelease(uint64 surface_id) { |
209 accelerated_surface_containers_.erase(surface_id); | 218 accelerated_surface_containers_.erase(surface_id); |
210 } | 219 } |
211 | 220 |
212 void RenderWidgetHostViewViews::AcceleratedSurfaceBuffersSwapped( | 221 void RenderWidgetHostViewViews::AcceleratedSurfaceBuffersSwapped( |
213 uint64 surface_id, | 222 uint64 surface_id, |
214 int32 route_id, | 223 int32 route_id, |
215 int gpu_host_id) { | 224 int gpu_host_id) { |
(...skipping 16 matching lines...) Expand all Loading... |
232 void RenderWidgetHostViewViews::OnCompositingEnded(ui::Compositor* compositor) { | 241 void RenderWidgetHostViewViews::OnCompositingEnded(ui::Compositor* compositor) { |
233 for (std::vector< base::Callback<void(void)> >::const_iterator | 242 for (std::vector< base::Callback<void(void)> >::const_iterator |
234 it = on_compositing_ended_callbacks_.begin(); | 243 it = on_compositing_ended_callbacks_.begin(); |
235 it != on_compositing_ended_callbacks_.end(); ++it) { | 244 it != on_compositing_ended_callbacks_.end(); ++it) { |
236 it->Run(); | 245 it->Run(); |
237 } | 246 } |
238 on_compositing_ended_callbacks_.clear(); | 247 on_compositing_ended_callbacks_.clear(); |
239 compositor->RemoveObserver(this); | 248 compositor->RemoveObserver(this); |
240 } | 249 } |
241 | 250 |
OLD | NEW |