OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 #include "content/common/view_messages.h" | 53 #include "content/common/view_messages.h" |
54 #include "content/public/browser/native_web_keyboard_event.h" | 54 #include "content/public/browser/native_web_keyboard_event.h" |
55 #include "content/public/browser/notification_service.h" | 55 #include "content/public/browser/notification_service.h" |
56 #include "content/public/browser/notification_types.h" | 56 #include "content/public/browser/notification_types.h" |
57 #include "content/public/browser/render_widget_host_iterator.h" | 57 #include "content/public/browser/render_widget_host_iterator.h" |
58 #include "content/public/browser/user_metrics.h" | 58 #include "content/public/browser/user_metrics.h" |
59 #include "content/public/common/content_constants.h" | 59 #include "content/public/common/content_constants.h" |
60 #include "content/public/common/content_switches.h" | 60 #include "content/public/common/content_switches.h" |
61 #include "content/public/common/result_codes.h" | 61 #include "content/public/common/result_codes.h" |
62 #include "content/public/common/web_preferences.h" | 62 #include "content/public/common/web_preferences.h" |
| 63 #include "gpu/GLES2/gl2extchromium.h" |
| 64 #include "gpu/command_buffer/service/gpu_switches.h" |
63 #include "skia/ext/image_operations.h" | 65 #include "skia/ext/image_operations.h" |
64 #include "skia/ext/platform_canvas.h" | 66 #include "skia/ext/platform_canvas.h" |
65 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" | 67 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
66 #include "ui/events/event.h" | 68 #include "ui/events/event.h" |
67 #include "ui/events/keycodes/keyboard_codes.h" | 69 #include "ui/events/keycodes/keyboard_codes.h" |
68 #include "ui/gfx/geometry/vector2d_conversions.h" | 70 #include "ui/gfx/geometry/vector2d_conversions.h" |
69 #include "ui/gfx/size_conversions.h" | 71 #include "ui/gfx/size_conversions.h" |
70 #include "ui/gfx/skbitmap_operations.h" | 72 #include "ui/gfx/skbitmap_operations.h" |
71 #include "ui/snapshot/snapshot.h" | 73 #include "ui/snapshot/snapshot.h" |
72 | 74 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 ignore_input_events_(false), | 181 ignore_input_events_(false), |
180 input_method_active_(false), | 182 input_method_active_(false), |
181 text_direction_updated_(false), | 183 text_direction_updated_(false), |
182 text_direction_(blink::WebTextDirectionLeftToRight), | 184 text_direction_(blink::WebTextDirectionLeftToRight), |
183 text_direction_canceled_(false), | 185 text_direction_canceled_(false), |
184 suppress_next_char_events_(false), | 186 suppress_next_char_events_(false), |
185 pending_mouse_lock_request_(false), | 187 pending_mouse_lock_request_(false), |
186 allow_privileged_mouse_lock_(false), | 188 allow_privileged_mouse_lock_(false), |
187 has_touch_handler_(false), | 189 has_touch_handler_(false), |
188 last_input_number_(static_cast<int64>(GetProcess()->GetID()) << 32), | 190 last_input_number_(static_cast<int64>(GetProcess()->GetID()) << 32), |
| 191 subscribe_uniform_enabled_(false), |
189 next_browser_snapshot_id_(1), | 192 next_browser_snapshot_id_(1), |
190 browser_composite_latency_history_(kBrowserCompositeLatencyHistorySize), | 193 browser_composite_latency_history_(kBrowserCompositeLatencyHistorySize), |
191 weak_factory_(this) { | 194 weak_factory_(this) { |
192 CHECK(delegate_); | 195 CHECK(delegate_); |
193 if (routing_id_ == MSG_ROUTING_NONE) { | 196 if (routing_id_ == MSG_ROUTING_NONE) { |
194 routing_id_ = process_->GetNextRoutingID(); | 197 routing_id_ = process_->GetNextRoutingID(); |
195 surface_id_ = GpuSurfaceTracker::Get()->AddSurfaceForRenderer( | 198 surface_id_ = GpuSurfaceTracker::Get()->AddSurfaceForRenderer( |
196 process_->GetID(), | 199 process_->GetID(), |
197 routing_id_); | 200 routing_id_); |
198 } else { | 201 } else { |
(...skipping 28 matching lines...) Expand all Loading... |
227 | 230 |
228 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( | 231 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
229 IsRenderView() ? RenderViewHost::From(this) : NULL); | 232 IsRenderView() ? RenderViewHost::From(this) : NULL); |
230 if (BrowserPluginGuest::IsGuest(rvh) || | 233 if (BrowserPluginGuest::IsGuest(rvh) || |
231 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 234 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
232 switches::kDisableHangMonitor)) { | 235 switches::kDisableHangMonitor)) { |
233 hang_monitor_timeout_.reset(new TimeoutMonitor( | 236 hang_monitor_timeout_.reset(new TimeoutMonitor( |
234 base::Bind(&RenderWidgetHostImpl::RendererIsUnresponsive, | 237 base::Bind(&RenderWidgetHostImpl::RendererIsUnresponsive, |
235 weak_factory_.GetWeakPtr()))); | 238 weak_factory_.GetWeakPtr()))); |
236 } | 239 } |
| 240 |
| 241 subscribe_uniform_enabled_ = |
| 242 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 243 switches::kEnableSubscribeUniformExtension); |
237 } | 244 } |
238 | 245 |
239 RenderWidgetHostImpl::~RenderWidgetHostImpl() { | 246 RenderWidgetHostImpl::~RenderWidgetHostImpl() { |
240 if (view_weak_) | 247 if (view_weak_) |
241 view_weak_->RenderWidgetHostGone(); | 248 view_weak_->RenderWidgetHostGone(); |
242 SetView(NULL); | 249 SetView(NULL); |
243 | 250 |
244 GpuSurfaceTracker::Get()->RemoveSurface(surface_id_); | 251 GpuSurfaceTracker::Get()->RemoveSurface(surface_id_); |
245 surface_id_ = 0; | 252 surface_id_ = 0; |
246 | 253 |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 } | 899 } |
893 | 900 |
894 if (IgnoreInputEvents()) | 901 if (IgnoreInputEvents()) |
895 return; | 902 return; |
896 | 903 |
897 if (touch_emulator_ && touch_emulator_->HandleMouseEvent(mouse_event)) | 904 if (touch_emulator_ && touch_emulator_->HandleMouseEvent(mouse_event)) |
898 return; | 905 return; |
899 | 906 |
900 input_router_->SendMouseEvent(MouseEventWithLatencyInfo(mouse_event, | 907 input_router_->SendMouseEvent(MouseEventWithLatencyInfo(mouse_event, |
901 latency_info)); | 908 latency_info)); |
| 909 |
| 910 // Pass mouse state to gpu service if the subscribe uniform |
| 911 // extension is enabled. |
| 912 // TODO(orglofch): Only pass mouse information if one of the GL Contexts |
| 913 // is subscribed to GL_MOUSE_POSITION_CHROMIUM |
| 914 if (subscribe_uniform_enabled_) { |
| 915 gpu::ValueState state; |
| 916 state.int_value[0] = mouse_event.x; |
| 917 state.int_value[1] = mouse_event.y; |
| 918 GpuProcessHost::SendOnIO( |
| 919 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
| 920 CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, |
| 921 new GpuMsg_UpdateValueState( |
| 922 process_->GetID(), GL_MOUSE_POSITION_CHROMIUM, state)); |
| 923 } |
902 } | 924 } |
903 | 925 |
904 void RenderWidgetHostImpl::OnPointerEventActivate() { | 926 void RenderWidgetHostImpl::OnPointerEventActivate() { |
905 } | 927 } |
906 | 928 |
907 void RenderWidgetHostImpl::ForwardWheelEvent( | 929 void RenderWidgetHostImpl::ForwardWheelEvent( |
908 const WebMouseWheelEvent& wheel_event) { | 930 const WebMouseWheelEvent& wheel_event) { |
909 ForwardWheelEventWithLatencyInfo(wheel_event, ui::LatencyInfo()); | 931 ForwardWheelEventWithLatencyInfo(wheel_event, ui::LatencyInfo()); |
910 } | 932 } |
911 | 933 |
(...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2443 } | 2465 } |
2444 #endif | 2466 #endif |
2445 | 2467 |
2446 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { | 2468 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { |
2447 if (view_) | 2469 if (view_) |
2448 return view_->PreferredReadbackFormat(); | 2470 return view_->PreferredReadbackFormat(); |
2449 return kN32_SkColorType; | 2471 return kN32_SkColorType; |
2450 } | 2472 } |
2451 | 2473 |
2452 } // namespace content | 2474 } // namespace content |
OLD | NEW |