Chromium Code Reviews| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 in_get_backing_store_(false), | 190 in_get_backing_store_(false), |
| 191 ignore_input_events_(false), | 191 ignore_input_events_(false), |
| 192 text_direction_updated_(false), | 192 text_direction_updated_(false), |
| 193 text_direction_(blink::WebTextDirectionLeftToRight), | 193 text_direction_(blink::WebTextDirectionLeftToRight), |
| 194 text_direction_canceled_(false), | 194 text_direction_canceled_(false), |
| 195 suppress_next_char_events_(false), | 195 suppress_next_char_events_(false), |
| 196 pending_mouse_lock_request_(false), | 196 pending_mouse_lock_request_(false), |
| 197 allow_privileged_mouse_lock_(false), | 197 allow_privileged_mouse_lock_(false), |
| 198 has_touch_handler_(false), | 198 has_touch_handler_(false), |
| 199 is_in_gesture_scroll_(false), | 199 is_in_gesture_scroll_(false), |
| 200 received_paint_after_load_(false), | |
| 200 next_browser_snapshot_id_(1), | 201 next_browser_snapshot_id_(1), |
| 201 owned_by_render_frame_host_(false), | 202 owned_by_render_frame_host_(false), |
| 202 is_focused_(false), | 203 is_focused_(false), |
| 203 weak_factory_(this) { | 204 weak_factory_(this) { |
| 204 CHECK(delegate_); | 205 CHECK(delegate_); |
| 205 CHECK_NE(MSG_ROUTING_NONE, routing_id_); | 206 CHECK_NE(MSG_ROUTING_NONE, routing_id_); |
| 206 | 207 |
| 207 std::pair<RoutingIDWidgetMap::iterator, bool> result = | 208 std::pair<RoutingIDWidgetMap::iterator, bool> result = |
| 208 g_routing_id_widget_map.Get().insert(std::make_pair( | 209 g_routing_id_widget_map.Get().insert(std::make_pair( |
| 209 RenderWidgetHostID(process->GetID(), routing_id_), this)); | 210 RenderWidgetHostID(process->GetID(), routing_id_), this)); |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 471 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionBoundsChanged, | 472 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionBoundsChanged, |
| 472 OnSelectionBoundsChanged) | 473 OnSelectionBoundsChanged) |
| 473 #if defined(OS_WIN) | 474 #if defined(OS_WIN) |
| 474 IPC_MESSAGE_HANDLER(ViewHostMsg_WindowlessPluginDummyWindowCreated, | 475 IPC_MESSAGE_HANDLER(ViewHostMsg_WindowlessPluginDummyWindowCreated, |
| 475 OnWindowlessPluginDummyWindowCreated) | 476 OnWindowlessPluginDummyWindowCreated) |
| 476 IPC_MESSAGE_HANDLER(ViewHostMsg_WindowlessPluginDummyWindowDestroyed, | 477 IPC_MESSAGE_HANDLER(ViewHostMsg_WindowlessPluginDummyWindowDestroyed, |
| 477 OnWindowlessPluginDummyWindowDestroyed) | 478 OnWindowlessPluginDummyWindowDestroyed) |
| 478 #endif | 479 #endif |
| 479 IPC_MESSAGE_HANDLER(InputHostMsg_ImeCompositionRangeChanged, | 480 IPC_MESSAGE_HANDLER(InputHostMsg_ImeCompositionRangeChanged, |
| 480 OnImeCompositionRangeChanged) | 481 OnImeCompositionRangeChanged) |
| 482 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFirstPaintAfterLoad, | |
| 483 OnFirstPaintAfterLoad) | |
| 481 IPC_MESSAGE_UNHANDLED(handled = false) | 484 IPC_MESSAGE_UNHANDLED(handled = false) |
| 482 IPC_END_MESSAGE_MAP() | 485 IPC_END_MESSAGE_MAP() |
| 483 | 486 |
| 484 if (!handled && input_router_ && input_router_->OnMessageReceived(msg)) | 487 if (!handled && input_router_ && input_router_->OnMessageReceived(msg)) |
| 485 return true; | 488 return true; |
| 486 | 489 |
| 487 if (!handled && view_ && view_->OnMessageReceived(msg)) | 490 if (!handled && view_ && view_->OnMessageReceived(msg)) |
| 488 return true; | 491 return true; |
| 489 | 492 |
| 490 return handled; | 493 return handled; |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 913 hang_monitor_timeout_->Restart(hung_renderer_delay_); | 916 hang_monitor_timeout_->Restart(hung_renderer_delay_); |
| 914 } | 917 } |
| 915 | 918 |
| 916 void RenderWidgetHostImpl::StopHangMonitorTimeout() { | 919 void RenderWidgetHostImpl::StopHangMonitorTimeout() { |
| 917 if (hang_monitor_timeout_) | 920 if (hang_monitor_timeout_) |
| 918 hang_monitor_timeout_->Stop(); | 921 hang_monitor_timeout_->Stop(); |
| 919 RendererIsResponsive(); | 922 RendererIsResponsive(); |
| 920 } | 923 } |
| 921 | 924 |
| 922 void RenderWidgetHostImpl::StartNewContentRenderingTimeout() { | 925 void RenderWidgetHostImpl::StartNewContentRenderingTimeout() { |
| 926 // It is possible for a compositor frame to arrive before the browser is | |
| 927 // notified about the page being committed, in which case no timer is | |
| 928 // necessary. | |
| 929 if (received_paint_after_load_) { | |
| 930 received_paint_after_load_ = false; | |
| 931 return; | |
| 932 } | |
| 933 | |
| 923 if (new_content_rendering_timeout_) | 934 if (new_content_rendering_timeout_) |
|
Charlie Reis
2015/09/30 21:42:09
Tangentially related: Why do we need the null chec
kenrb
2015/10/01 12:45:09
I guess we don't. I had originally wanted it in th
| |
| 924 new_content_rendering_timeout_->Start(new_content_rendering_delay_); | 935 new_content_rendering_timeout_->Start(new_content_rendering_delay_); |
| 925 } | 936 } |
| 926 | 937 |
| 927 void RenderWidgetHostImpl::StopNewContentRenderingTimeout() { | 938 void RenderWidgetHostImpl::OnFirstPaintAfterLoad() { |
| 928 if (new_content_rendering_timeout_) | 939 if (new_content_rendering_timeout_->IsRunning()) { |
| 929 new_content_rendering_timeout_->Stop(); | 940 new_content_rendering_timeout_->Stop(); |
| 941 } else { | |
| 942 received_paint_after_load_ = true; | |
| 943 } | |
| 930 } | 944 } |
| 931 | 945 |
| 932 void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) { | 946 void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) { |
| 933 ForwardMouseEventWithLatencyInfo(mouse_event, ui::LatencyInfo()); | 947 ForwardMouseEventWithLatencyInfo(mouse_event, ui::LatencyInfo()); |
| 934 } | 948 } |
| 935 | 949 |
| 936 void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( | 950 void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( |
| 937 const blink::WebMouseEvent& mouse_event, | 951 const blink::WebMouseEvent& mouse_event, |
| 938 const ui::LatencyInfo& ui_latency) { | 952 const ui::LatencyInfo& ui_latency) { |
| 939 TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardMouseEvent", | 953 TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardMouseEvent", |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1515 Send(new ViewMsg_Move_ACK(routing_id_)); | 1529 Send(new ViewMsg_Move_ACK(routing_id_)); |
| 1516 } | 1530 } |
| 1517 } | 1531 } |
| 1518 | 1532 |
| 1519 bool RenderWidgetHostImpl::OnSwapCompositorFrame( | 1533 bool RenderWidgetHostImpl::OnSwapCompositorFrame( |
| 1520 const IPC::Message& message) { | 1534 const IPC::Message& message) { |
| 1521 // This trace event is used in | 1535 // This trace event is used in |
| 1522 // chrome/browser/extensions/api/cast_streaming/performance_test.cc | 1536 // chrome/browser/extensions/api/cast_streaming/performance_test.cc |
| 1523 TRACE_EVENT0("test_fps,benchmark", "OnSwapCompositorFrame"); | 1537 TRACE_EVENT0("test_fps,benchmark", "OnSwapCompositorFrame"); |
| 1524 | 1538 |
| 1525 StopNewContentRenderingTimeout(); | |
| 1526 | |
| 1527 ViewHostMsg_SwapCompositorFrame::Param param; | 1539 ViewHostMsg_SwapCompositorFrame::Param param; |
| 1528 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) | 1540 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) |
| 1529 return false; | 1541 return false; |
| 1530 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); | 1542 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); |
| 1531 uint32_t output_surface_id = base::get<0>(param); | 1543 uint32_t output_surface_id = base::get<0>(param); |
| 1532 base::get<1>(param).AssignTo(frame.get()); | 1544 base::get<1>(param).AssignTo(frame.get()); |
| 1533 std::vector<IPC::Message> messages_to_deliver_with_frame; | 1545 std::vector<IPC::Message> messages_to_deliver_with_frame; |
| 1534 messages_to_deliver_with_frame.swap(base::get<2>(param)); | 1546 messages_to_deliver_with_frame.swap(base::get<2>(param)); |
| 1535 | 1547 |
| 1536 if (!ui::LatencyInfo::Verify(frame->metadata.latency_info, | 1548 if (!ui::LatencyInfo::Verify(frame->metadata.latency_info, |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2189 } | 2201 } |
| 2190 | 2202 |
| 2191 #if defined(OS_WIN) | 2203 #if defined(OS_WIN) |
| 2192 gfx::NativeViewAccessible | 2204 gfx::NativeViewAccessible |
| 2193 RenderWidgetHostImpl::GetParentNativeViewAccessible() { | 2205 RenderWidgetHostImpl::GetParentNativeViewAccessible() { |
| 2194 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL; | 2206 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL; |
| 2195 } | 2207 } |
| 2196 #endif | 2208 #endif |
| 2197 | 2209 |
| 2198 } // namespace content | 2210 } // namespace content |
| OLD | NEW |