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