Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Side by Side Diff: chrome/browser/renderer_host/render_widget_host_view_views.cc

Issue 8595002: Get rid of gpu_messages.h include in chrome by having the RenderWidgetHostView implementation ask... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix aura/views build Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/gpu/gpu_process_host_ui_shim.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 20 matching lines...) Expand all
31 #include "ui/base/text/text_elider.h" 31 #include "ui/base/text/text_elider.h"
32 #include "ui/gfx/canvas.h" 32 #include "ui/gfx/canvas.h"
33 #include "ui/gfx/canvas_skia.h" 33 #include "ui/gfx/canvas_skia.h"
34 #include "ui/views/ime/input_method.h" 34 #include "ui/views/ime/input_method.h"
35 #include "views/events/event.h" 35 #include "views/events/event.h"
36 #include "views/views_delegate.h" 36 #include "views/views_delegate.h"
37 #include "views/widget/tooltip_manager.h" 37 #include "views/widget/tooltip_manager.h"
38 #include "views/widget/widget.h" 38 #include "views/widget/widget.h"
39 39
40 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) 40 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
41 #include "base/bind.h"
42 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
43 #include "content/browser/renderer_host/accelerated_surface_container_linux.h" 41 #include "content/browser/renderer_host/accelerated_surface_container_linux.h"
44 #include "content/common/gpu/gpu_messages.h"
45 #include "ui/gfx/gl/gl_bindings.h" 42 #include "ui/gfx/gl/gl_bindings.h"
46 #endif 43 #endif
47 44
48 #if defined(TOOLKIT_USES_GTK) 45 #if defined(TOOLKIT_USES_GTK)
49 #include <gdk/gdkx.h> 46 #include <gdk/gdkx.h>
50 #include <gtk/gtk.h> 47 #include <gtk/gtk.h>
51 #include <gtk/gtkwindow.h> 48 #include <gtk/gtkwindow.h>
52 49
53 #include "content/browser/renderer_host/gtk_window_utils.h" 50 #include "content/browser/renderer_host/gtk_window_utils.h"
54 #include "views/widget/native_widget_gtk.h" 51 #include "views/widget/native_widget_gtk.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 WebKit::WebMouseEvent* wmevent) { 89 WebKit::WebMouseEvent* wmevent) {
93 wmevent->timeStampSeconds = base::Time::Now().ToDoubleT(); 90 wmevent->timeStampSeconds = base::Time::Now().ToDoubleT();
94 wmevent->modifiers = WebInputEventFlagsFromViewsEvent(event); 91 wmevent->modifiers = WebInputEventFlagsFromViewsEvent(event);
95 92
96 wmevent->windowX = wmevent->x = event.x(); 93 wmevent->windowX = wmevent->x = event.x();
97 wmevent->windowY = wmevent->y = event.y(); 94 wmevent->windowY = wmevent->y = event.y();
98 wmevent->globalX = wmevent->x + origin.x(); 95 wmevent->globalX = wmevent->x + origin.x();
99 wmevent->globalY = wmevent->y + origin.y(); 96 wmevent->globalY = wmevent->y + origin.y();
100 } 97 }
101 98
102 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
103 void AcknowledgeSwapBuffers(int32 route_id, int gpu_host_id) {
104 // It's possible that gpu_host_id is no longer valid at this point (like if
105 // gpu process was restarted after a crash). SendToGpuHost handles this.
106 GpuProcessHostUIShim::SendToGpuHost(gpu_host_id,
107 new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id));
108 }
109 #endif
110
111 } // namespace 99 } // namespace
112 100
113 RenderWidgetHostViewViews::RenderWidgetHostViewViews(RenderWidgetHost* host) 101 RenderWidgetHostViewViews::RenderWidgetHostViewViews(RenderWidgetHost* host)
114 : host_(host), 102 : host_(host),
115 about_to_validate_and_paint_(false), 103 about_to_validate_and_paint_(false),
116 is_hidden_(false), 104 is_hidden_(false),
117 is_loading_(false), 105 is_loading_(false),
118 native_cursor_(gfx::kNullCursor), 106 native_cursor_(gfx::kNullCursor),
119 is_showing_context_menu_(false), 107 is_showing_context_menu_(false),
120 visually_deemphasized_(false), 108 visually_deemphasized_(false),
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 } 1132 }
1145 1133
1146 void RenderWidgetHostViewViews::AcceleratedSurfaceBuffersSwapped( 1134 void RenderWidgetHostViewViews::AcceleratedSurfaceBuffersSwapped(
1147 uint64 surface_id, 1135 uint64 surface_id,
1148 int32 route_id, 1136 int32 route_id,
1149 int gpu_host_id) { 1137 int gpu_host_id) {
1150 SetExternalTexture(accelerated_surface_containers_[surface_id]->GetTexture()); 1138 SetExternalTexture(accelerated_surface_containers_[surface_id]->GetTexture());
1151 glFlush(); 1139 glFlush();
1152 1140
1153 if (!GetWidget() || !GetWidget()->GetCompositor()) { 1141 if (!GetWidget() || !GetWidget()->GetCompositor()) {
1154 // We have no compositor, so we have no way to display the surface 1142 // 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 1143 // Must still send the ACK.
1144 host_->AcknowledgeSwapBuffers(route_id, gpu_host_id);
1156 } else { 1145 } else {
1157 // Add sending an ACK to the list of things to do OnCompositingEnded 1146 // Add sending an ACK to the list of things to do OnCompositingEnded
1158 on_compositing_ended_callbacks_.push_back( 1147 on_compositing_ended_callbacks_.push_back(
1159 base::Bind(AcknowledgeSwapBuffers, route_id, gpu_host_id)); 1148 base::Bind(&RenderWidgetHost::AcknowledgeSwapBuffers,
1149 base::Unretained(host_), route_id, gpu_host_id));
1160 ui::Compositor *compositor = GetWidget()->GetCompositor(); 1150 ui::Compositor *compositor = GetWidget()->GetCompositor();
1161 if (!compositor->HasObserver(this)) 1151 if (!compositor->HasObserver(this))
1162 compositor->AddObserver(this); 1152 compositor->AddObserver(this);
1163 } 1153 }
1164 } 1154 }
1165 1155
1166 void RenderWidgetHostViewViews::OnCompositingEnded(ui::Compositor* compositor) { 1156 void RenderWidgetHostViewViews::OnCompositingEnded(ui::Compositor* compositor) {
1167 for (std::vector< base::Callback<void(void)> >::const_iterator 1157 for (std::vector< base::Callback<void(void)> >::const_iterator
1168 it = on_compositing_ended_callbacks_.begin(); 1158 it = on_compositing_ended_callbacks_.begin();
1169 it != on_compositing_ended_callbacks_.end(); ++it) { 1159 it != on_compositing_ended_callbacks_.end(); ++it) {
1170 it->Run(); 1160 it->Run();
1171 } 1161 }
1172 on_compositing_ended_callbacks_.clear(); 1162 on_compositing_ended_callbacks_.clear();
1173 compositor->RemoveObserver(this); 1163 compositor->RemoveObserver(this);
1174 } 1164 }
1175 1165
1176 #endif 1166 #endif
OLDNEW
« no previous file with comments | « no previous file | content/browser/gpu/gpu_process_host_ui_shim.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698