| 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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/renderer_host/accelerated_surface_container_touch.h" | 8 #include "chrome/browser/renderer_host/accelerated_surface_container_touch.h" |
| 9 #include "content/browser/renderer_host/render_widget_host.h" | 9 #include "content/browser/renderer_host/render_widget_host.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFact
ory.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFact
ory.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 // static | 183 // static |
| 184 RenderWidgetHostView* | 184 RenderWidgetHostView* |
| 185 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( | 185 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( |
| 186 gfx::NativeView widget) { | 186 gfx::NativeView widget) { |
| 187 // TODO(beng): Figure out what to do here for Windows/v.o.v. | 187 // TODO(beng): Figure out what to do here for Windows/v.o.v. |
| 188 gpointer user_data = g_object_get_data(G_OBJECT(widget), | 188 gpointer user_data = g_object_get_data(G_OBJECT(widget), |
| 189 kRenderWidgetHostViewKey); | 189 kRenderWidgetHostViewKey); |
| 190 return reinterpret_cast<RenderWidgetHostView*>(user_data); | 190 return reinterpret_cast<RenderWidgetHostView*>(user_data); |
| 191 } | 191 } |
| 192 | 192 |
| 193 gfx::PluginWindowHandle RenderWidgetHostViewViews::GetCompositingSurface() { |
| 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. |
| 196 // As the GPU process creates this surface, we can return any non-zero value. |
| 197 return 1; |
| 198 } |
| 199 |
| 193 void RenderWidgetHostViewViews::AcceleratedSurfaceSetIOSurface( | 200 void RenderWidgetHostViewViews::AcceleratedSurfaceSetIOSurface( |
| 194 int32 width, int32 height, uint64 surface_id) { | 201 int32 width, int32 height, uint64 surface_id) { |
| 195 accelerated_surface_containers_[surface_id] = | 202 accelerated_surface_containers_[surface_id] = |
| 196 new AcceleratedSurfaceContainerTouch( | 203 new AcceleratedSurfaceContainerTouch( |
| 197 static_cast<ui::CompositorGL*>(GetWidget()->GetCompositor()), | 204 static_cast<ui::CompositorGL*>(GetWidget()->GetCompositor()), |
| 198 gfx::Size(width, height), | 205 gfx::Size(width, height), |
| 199 surface_id); | 206 surface_id); |
| 200 } | 207 } |
| 201 | 208 |
| 202 void RenderWidgetHostViewViews::AcceleratedSurfaceRelease(uint64 surface_id) { | 209 void RenderWidgetHostViewViews::AcceleratedSurfaceRelease(uint64 surface_id) { |
| 203 accelerated_surface_containers_.erase(surface_id); | 210 accelerated_surface_containers_.erase(surface_id); |
| 204 } | 211 } |
| 205 | 212 |
| 206 void RenderWidgetHostViewViews::AcceleratedSurfaceBuffersSwapped( | 213 void RenderWidgetHostViewViews::AcceleratedSurfaceBuffersSwapped( |
| 207 uint64 surface_id) { | 214 uint64 surface_id) { |
| 208 SetExternalTexture(accelerated_surface_containers_[surface_id].get()); | 215 SetExternalTexture(accelerated_surface_containers_[surface_id].get()); |
| 209 glFlush(); | 216 glFlush(); |
| 210 } | 217 } |
| OLD | NEW |