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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
226 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( | 226 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
227 IsRenderView() ? RenderViewHost::From(this) : NULL); | 227 IsRenderView() ? RenderViewHost::From(this) : NULL); |
228 if (BrowserPluginGuest::IsGuest(rvh) || | 228 if (BrowserPluginGuest::IsGuest(rvh) || |
229 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 229 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
230 switches::kDisableHangMonitor)) { | 230 switches::kDisableHangMonitor)) { |
231 hang_monitor_timeout_.reset(new TimeoutMonitor( | 231 hang_monitor_timeout_.reset(new TimeoutMonitor( |
232 base::Bind(&RenderWidgetHostImpl::RendererIsUnresponsive, | 232 base::Bind(&RenderWidgetHostImpl::RendererIsUnresponsive, |
233 weak_factory_.GetWeakPtr()))); | 233 weak_factory_.GetWeakPtr()))); |
234 } | 234 } |
235 | 235 |
236 pending_valuebuffer_state_ = new gpu::ValueStateMap(); | |
237 | |
236 subscribe_uniform_enabled_ = | 238 subscribe_uniform_enabled_ = |
237 base::CommandLine::ForCurrentProcess()->HasSwitch( | 239 base::CommandLine::ForCurrentProcess()->HasSwitch( |
238 switches::kEnableSubscribeUniformExtension); | 240 switches::kEnableSubscribeUniformExtension); |
239 } | 241 } |
240 | 242 |
241 RenderWidgetHostImpl::~RenderWidgetHostImpl() { | 243 RenderWidgetHostImpl::~RenderWidgetHostImpl() { |
242 if (view_weak_) | 244 if (view_weak_) |
243 view_weak_->RenderWidgetHostGone(); | 245 view_weak_->RenderWidgetHostGone(); |
244 SetView(NULL); | 246 SetView(NULL); |
245 | 247 |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
897 return; | 899 return; |
898 | 900 |
899 if (touch_emulator_ && touch_emulator_->HandleMouseEvent(mouse_event)) | 901 if (touch_emulator_ && touch_emulator_->HandleMouseEvent(mouse_event)) |
900 return; | 902 return; |
901 | 903 |
902 input_router_->SendMouseEvent(MouseEventWithLatencyInfo(mouse_event, | 904 input_router_->SendMouseEvent(MouseEventWithLatencyInfo(mouse_event, |
903 latency_info)); | 905 latency_info)); |
904 | 906 |
905 // Pass mouse state to gpu service if the subscribe uniform | 907 // Pass mouse state to gpu service if the subscribe uniform |
906 // extension is enabled. | 908 // extension is enabled. |
907 // TODO(orglofch): Only pass mouse information if one of the GL Contexts | |
908 // is subscribed to GL_MOUSE_POSITION_CHROMIUM | |
909 if (subscribe_uniform_enabled_) { | 909 if (subscribe_uniform_enabled_) { |
910 gpu::ValueState state; | 910 gpu::ValueState state; |
911 state.int_value[0] = mouse_event.x; | 911 state.int_value[0] = mouse_event.x; |
912 state.int_value[1] = mouse_event.y; | 912 state.int_value[1] = mouse_event.y; |
913 GpuProcessHost::SendOnIO( | 913 SendUpdateValueState(GL_MOUSE_POSITION_CHROMIUM, state); |
914 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, | |
915 CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, | |
916 new GpuMsg_UpdateValueState( | |
917 process_->GetID(), GL_MOUSE_POSITION_CHROMIUM, state)); | |
918 } | 914 } |
919 } | 915 } |
920 | 916 |
921 void RenderWidgetHostImpl::OnPointerEventActivate() { | 917 void RenderWidgetHostImpl::OnPointerEventActivate() { |
922 } | 918 } |
923 | 919 |
924 void RenderWidgetHostImpl::ForwardWheelEvent( | 920 void RenderWidgetHostImpl::ForwardWheelEvent( |
925 const WebMouseWheelEvent& wheel_event) { | 921 const WebMouseWheelEvent& wheel_event) { |
926 ForwardWheelEventWithLatencyInfo(wheel_event, ui::LatencyInfo()); | 922 ForwardWheelEventWithLatencyInfo(wheel_event, ui::LatencyInfo()); |
927 } | 923 } |
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2348 | 2344 |
2349 void RenderWidgetHostImpl::OnSnapshotDataReceivedAsync( | 2345 void RenderWidgetHostImpl::OnSnapshotDataReceivedAsync( |
2350 int snapshot_id, | 2346 int snapshot_id, |
2351 scoped_refptr<base::RefCountedBytes> png_data) { | 2347 scoped_refptr<base::RefCountedBytes> png_data) { |
2352 if (png_data.get()) | 2348 if (png_data.get()) |
2353 OnSnapshotDataReceived(snapshot_id, png_data->front(), png_data->size()); | 2349 OnSnapshotDataReceived(snapshot_id, png_data->front(), png_data->size()); |
2354 else | 2350 else |
2355 OnSnapshotDataReceived(snapshot_id, NULL, 0); | 2351 OnSnapshotDataReceived(snapshot_id, NULL, 0); |
2356 } | 2352 } |
2357 | 2353 |
2354 void RenderWidgetHostImpl::SendUpdateValueState(unsigned int target, | |
2355 const gpu::ValueState& state) { | |
2356 if (subscription_set_.find(GL_MOUSE_POSITION_CHROMIUM) | |
piman
2014/12/10 06:57:10
s/GL_MOUSE_POSITION_CHROMIUM/target/ in this metho
orglofch
2014/12/10 21:54:48
Done.
| |
2357 != subscription_set_.end()) { | |
2358 GpuProcessHost::SendOnIO( | |
2359 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, | |
2360 CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, | |
2361 new GpuMsg_UpdateValueState( | |
2362 process_->GetID(), GL_MOUSE_POSITION_CHROMIUM, state)); | |
piman
2014/12/10 06:57:10
Actually, I'm realizing, this doesn't make much se
orglofch
2014/12/10 21:54:48
Done. Moved to RenderProcessHost.
| |
2363 } else { | |
2364 // Store the ValueState locally in case a Valuebuffer subscribes to it later | |
2365 pending_valuebuffer_state_->UpdateState(GL_MOUSE_POSITION_CHROMIUM, state); | |
2366 } | |
2367 } | |
2368 | |
2358 // static | 2369 // static |
2359 void RenderWidgetHostImpl::CompositorFrameDrawn( | 2370 void RenderWidgetHostImpl::CompositorFrameDrawn( |
2360 const std::vector<ui::LatencyInfo>& latency_info) { | 2371 const std::vector<ui::LatencyInfo>& latency_info) { |
2361 for (size_t i = 0; i < latency_info.size(); i++) { | 2372 for (size_t i = 0; i < latency_info.size(); i++) { |
2362 std::set<RenderWidgetHostImpl*> rwhi_set; | 2373 std::set<RenderWidgetHostImpl*> rwhi_set; |
2363 for (ui::LatencyInfo::LatencyMap::const_iterator b = | 2374 for (ui::LatencyInfo::LatencyMap::const_iterator b = |
2364 latency_info[i].latency_components.begin(); | 2375 latency_info[i].latency_components.begin(); |
2365 b != latency_info[i].latency_components.end(); | 2376 b != latency_info[i].latency_components.end(); |
2366 ++b) { | 2377 ++b) { |
2367 if (b->first.first == ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT || | 2378 if (b->first.first == ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT || |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2404 ++lc; | 2415 ++lc; |
2405 } | 2416 } |
2406 } | 2417 } |
2407 | 2418 |
2408 // Add newly generated components into the latency info | 2419 // Add newly generated components into the latency info |
2409 for (lc = new_components.begin(); lc != new_components.end(); ++lc) { | 2420 for (lc = new_components.begin(); lc != new_components.end(); ++lc) { |
2410 latency_info->latency_components[lc->first] = lc->second; | 2421 latency_info->latency_components[lc->first] = lc->second; |
2411 } | 2422 } |
2412 } | 2423 } |
2413 | 2424 |
2425 void RenderWidgetHostImpl::OnAddSubscription(unsigned int target) { | |
2426 subscription_set_.insert(target); | |
2427 const gpu::ValueState* state = pending_valuebuffer_state_->GetState(target); | |
2428 if (state) { | |
2429 SendUpdateValueState(target, *state); | |
2430 } | |
2431 } | |
2432 | |
2433 void RenderWidgetHostImpl::OnRemoveSubscription(unsigned int target) { | |
2434 subscription_set_.erase(target); | |
2435 } | |
2436 | |
2414 BrowserAccessibilityManager* | 2437 BrowserAccessibilityManager* |
2415 RenderWidgetHostImpl::GetRootBrowserAccessibilityManager() { | 2438 RenderWidgetHostImpl::GetRootBrowserAccessibilityManager() { |
2416 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL; | 2439 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL; |
2417 } | 2440 } |
2418 | 2441 |
2419 BrowserAccessibilityManager* | 2442 BrowserAccessibilityManager* |
2420 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() { | 2443 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() { |
2421 return delegate_ ? | 2444 return delegate_ ? |
2422 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL; | 2445 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL; |
2423 } | 2446 } |
2424 | 2447 |
2425 #if defined(OS_WIN) | 2448 #if defined(OS_WIN) |
2426 gfx::NativeViewAccessible | 2449 gfx::NativeViewAccessible |
2427 RenderWidgetHostImpl::GetParentNativeViewAccessible() { | 2450 RenderWidgetHostImpl::GetParentNativeViewAccessible() { |
2428 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL; | 2451 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL; |
2429 } | 2452 } |
2430 #endif | 2453 #endif |
2431 | 2454 |
2432 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { | 2455 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { |
2433 if (view_) | 2456 if (view_) |
2434 return view_->PreferredReadbackFormat(); | 2457 return view_->PreferredReadbackFormat(); |
2435 return kN32_SkColorType; | 2458 return kN32_SkColorType; |
2436 } | 2459 } |
2437 | 2460 |
2438 } // namespace content | 2461 } // namespace content |
OLD | NEW |