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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 in_get_backing_store_(false), | 176 in_get_backing_store_(false), |
177 ignore_input_events_(false), | 177 ignore_input_events_(false), |
178 input_method_active_(false), | 178 input_method_active_(false), |
179 text_direction_updated_(false), | 179 text_direction_updated_(false), |
180 text_direction_(blink::WebTextDirectionLeftToRight), | 180 text_direction_(blink::WebTextDirectionLeftToRight), |
181 text_direction_canceled_(false), | 181 text_direction_canceled_(false), |
182 suppress_next_char_events_(false), | 182 suppress_next_char_events_(false), |
183 pending_mouse_lock_request_(false), | 183 pending_mouse_lock_request_(false), |
184 allow_privileged_mouse_lock_(false), | 184 allow_privileged_mouse_lock_(false), |
185 has_touch_handler_(false), | 185 has_touch_handler_(false), |
186 subscribe_uniform_enabled_(false), | |
187 next_browser_snapshot_id_(1), | 186 next_browser_snapshot_id_(1), |
188 weak_factory_(this) { | 187 weak_factory_(this) { |
189 CHECK(delegate_); | 188 CHECK(delegate_); |
190 if (routing_id_ == MSG_ROUTING_NONE) { | 189 if (routing_id_ == MSG_ROUTING_NONE) { |
191 routing_id_ = process_->GetNextRoutingID(); | 190 routing_id_ = process_->GetNextRoutingID(); |
192 surface_id_ = GpuSurfaceTracker::Get()->AddSurfaceForRenderer( | 191 surface_id_ = GpuSurfaceTracker::Get()->AddSurfaceForRenderer( |
193 process_->GetID(), | 192 process_->GetID(), |
194 routing_id_); | 193 routing_id_); |
195 } else { | 194 } else { |
196 // TODO(piman): This is a O(N) lookup, where we could forward the | 195 // TODO(piman): This is a O(N) lookup, where we could forward the |
(...skipping 29 matching lines...) Expand all Loading... |
226 | 225 |
227 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( | 226 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
228 IsRenderView() ? RenderViewHost::From(this) : NULL); | 227 IsRenderView() ? RenderViewHost::From(this) : NULL); |
229 if (BrowserPluginGuest::IsGuest(rvh) || | 228 if (BrowserPluginGuest::IsGuest(rvh) || |
230 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 229 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
231 switches::kDisableHangMonitor)) { | 230 switches::kDisableHangMonitor)) { |
232 hang_monitor_timeout_.reset(new TimeoutMonitor( | 231 hang_monitor_timeout_.reset(new TimeoutMonitor( |
233 base::Bind(&RenderWidgetHostImpl::RendererIsUnresponsive, | 232 base::Bind(&RenderWidgetHostImpl::RendererIsUnresponsive, |
234 weak_factory_.GetWeakPtr()))); | 233 weak_factory_.GetWeakPtr()))); |
235 } | 234 } |
236 | |
237 subscribe_uniform_enabled_ = | |
238 base::CommandLine::ForCurrentProcess()->HasSwitch( | |
239 switches::kEnableSubscribeUniformExtension); | |
240 } | 235 } |
241 | 236 |
242 RenderWidgetHostImpl::~RenderWidgetHostImpl() { | 237 RenderWidgetHostImpl::~RenderWidgetHostImpl() { |
243 if (view_weak_) | 238 if (view_weak_) |
244 view_weak_->RenderWidgetHostGone(); | 239 view_weak_->RenderWidgetHostGone(); |
245 SetView(NULL); | 240 SetView(NULL); |
246 | 241 |
247 GpuSurfaceTracker::Get()->RemoveSurface(surface_id_); | 242 GpuSurfaceTracker::Get()->RemoveSurface(surface_id_); |
248 surface_id_ = 0; | 243 surface_id_ = 0; |
249 | 244 |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 | 890 |
896 if (touch_emulator_ && touch_emulator_->HandleMouseEvent(mouse_event)) | 891 if (touch_emulator_ && touch_emulator_->HandleMouseEvent(mouse_event)) |
897 return; | 892 return; |
898 | 893 |
899 MouseEventWithLatencyInfo mouse_with_latency(mouse_event, ui_latency); | 894 MouseEventWithLatencyInfo mouse_with_latency(mouse_event, ui_latency); |
900 latency_tracker_.OnInputEvent(mouse_event, &mouse_with_latency.latency); | 895 latency_tracker_.OnInputEvent(mouse_event, &mouse_with_latency.latency); |
901 input_router_->SendMouseEvent(mouse_with_latency); | 896 input_router_->SendMouseEvent(mouse_with_latency); |
902 | 897 |
903 // Pass mouse state to gpu service if the subscribe uniform | 898 // Pass mouse state to gpu service if the subscribe uniform |
904 // extension is enabled. | 899 // extension is enabled. |
905 // TODO(orglofch): Only pass mouse information if one of the GL Contexts | 900 if (process_->SubscribeUniformEnabled()) { |
906 // is subscribed to GL_MOUSE_POSITION_CHROMIUM | |
907 if (subscribe_uniform_enabled_) { | |
908 gpu::ValueState state; | 901 gpu::ValueState state; |
909 state.int_value[0] = mouse_event.x; | 902 state.int_value[0] = mouse_event.x; |
910 state.int_value[1] = mouse_event.y; | 903 state.int_value[1] = mouse_event.y; |
911 GpuProcessHost::SendOnIO( | 904 // TODO(orglofch) Separate the mapping of pending value states to the |
912 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, | 905 // Gpu Service to be per RWH not per process |
913 CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, | 906 process_->SendUpdateValueState(GL_MOUSE_POSITION_CHROMIUM, state); |
914 new GpuMsg_UpdateValueState( | |
915 process_->GetID(), GL_MOUSE_POSITION_CHROMIUM, state)); | |
916 } | 907 } |
917 } | 908 } |
918 | 909 |
919 void RenderWidgetHostImpl::OnPointerEventActivate() { | 910 void RenderWidgetHostImpl::OnPointerEventActivate() { |
920 } | 911 } |
921 | 912 |
922 void RenderWidgetHostImpl::ForwardWheelEvent( | 913 void RenderWidgetHostImpl::ForwardWheelEvent( |
923 const WebMouseWheelEvent& wheel_event) { | 914 const WebMouseWheelEvent& wheel_event) { |
924 ForwardWheelEventWithLatencyInfo(wheel_event, ui::LatencyInfo()); | 915 ForwardWheelEventWithLatencyInfo(wheel_event, ui::LatencyInfo()); |
925 } | 916 } |
(...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2174 } | 2165 } |
2175 #endif | 2166 #endif |
2176 | 2167 |
2177 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { | 2168 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { |
2178 if (view_) | 2169 if (view_) |
2179 return view_->PreferredReadbackFormat(); | 2170 return view_->PreferredReadbackFormat(); |
2180 return kN32_SkColorType; | 2171 return kN32_SkColorType; |
2181 } | 2172 } |
2182 | 2173 |
2183 } // namespace content | 2174 } // namespace content |
OLD | NEW |