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 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 913 hang_monitor_timeout_->Restart(hung_renderer_delay_); | 914 hang_monitor_timeout_->Restart(hung_renderer_delay_); |
| 914 } | 915 } |
| 915 | 916 |
| 916 void RenderWidgetHostImpl::StopHangMonitorTimeout() { | 917 void RenderWidgetHostImpl::StopHangMonitorTimeout() { |
| 917 if (hang_monitor_timeout_) | 918 if (hang_monitor_timeout_) |
| 918 hang_monitor_timeout_->Stop(); | 919 hang_monitor_timeout_->Stop(); |
| 919 RendererIsResponsive(); | 920 RendererIsResponsive(); |
| 920 } | 921 } |
| 921 | 922 |
| 922 void RenderWidgetHostImpl::StartNewContentRenderingTimeout() { | 923 void RenderWidgetHostImpl::StartNewContentRenderingTimeout() { |
| 924 // It is possible for a compositor frame to arrive before the browser | |
| 925 // is notified about the page have been committed, in which case | |
|
Charlie Reis
2015/09/30 20:36:19
nit: about the page being committed
kenrb
2015/09/30 21:25:02
Done.
| |
| 926 // no timer is necessary. | |
| 927 if (received_paint_after_load_) { | |
| 928 received_paint_after_load_ = false; | |
| 929 return; | |
| 930 } | |
| 931 | |
| 923 if (new_content_rendering_timeout_) | 932 if (new_content_rendering_timeout_) |
| 924 new_content_rendering_timeout_->Start(new_content_rendering_delay_); | 933 new_content_rendering_timeout_->Start(new_content_rendering_delay_); |
| 925 } | 934 } |
| 926 | 935 |
| 927 void RenderWidgetHostImpl::StopNewContentRenderingTimeout() { | 936 void RenderWidgetHostImpl::StopNewContentRenderingTimeout() { |
|
Charlie Reis
2015/09/30 20:36:19
Can we remove this and just put this code within O
kenrb
2015/09/30 21:25:02
Done.
| |
| 928 if (new_content_rendering_timeout_) | 937 if (new_content_rendering_timeout_) |
| 929 new_content_rendering_timeout_->Stop(); | 938 new_content_rendering_timeout_->Stop(); |
| 930 } | 939 } |
| 931 | 940 |
| 941 void RenderWidgetHostImpl::OnFirstPaintAfterLoad() { | |
| 942 if (new_content_rendering_timeout_->IsRunning()) { | |
| 943 StopNewContentRenderingTimeout(); | |
| 944 } else { | |
| 945 received_paint_after_load_ = true; | |
| 946 } | |
| 947 } | |
| 948 | |
| 932 void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) { | 949 void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) { |
| 933 ForwardMouseEventWithLatencyInfo(mouse_event, ui::LatencyInfo()); | 950 ForwardMouseEventWithLatencyInfo(mouse_event, ui::LatencyInfo()); |
| 934 } | 951 } |
| 935 | 952 |
| 936 void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( | 953 void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( |
| 937 const blink::WebMouseEvent& mouse_event, | 954 const blink::WebMouseEvent& mouse_event, |
| 938 const ui::LatencyInfo& ui_latency) { | 955 const ui::LatencyInfo& ui_latency) { |
| 939 TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardMouseEvent", | 956 TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardMouseEvent", |
| 940 "x", mouse_event.x, "y", mouse_event.y); | 957 "x", mouse_event.x, "y", mouse_event.y); |
| 941 | 958 |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1515 Send(new ViewMsg_Move_ACK(routing_id_)); | 1532 Send(new ViewMsg_Move_ACK(routing_id_)); |
| 1516 } | 1533 } |
| 1517 } | 1534 } |
| 1518 | 1535 |
| 1519 bool RenderWidgetHostImpl::OnSwapCompositorFrame( | 1536 bool RenderWidgetHostImpl::OnSwapCompositorFrame( |
| 1520 const IPC::Message& message) { | 1537 const IPC::Message& message) { |
| 1521 // This trace event is used in | 1538 // This trace event is used in |
| 1522 // chrome/browser/extensions/api/cast_streaming/performance_test.cc | 1539 // chrome/browser/extensions/api/cast_streaming/performance_test.cc |
| 1523 TRACE_EVENT0("test_fps,benchmark", "OnSwapCompositorFrame"); | 1540 TRACE_EVENT0("test_fps,benchmark", "OnSwapCompositorFrame"); |
| 1524 | 1541 |
| 1525 StopNewContentRenderingTimeout(); | |
| 1526 | |
| 1527 ViewHostMsg_SwapCompositorFrame::Param param; | 1542 ViewHostMsg_SwapCompositorFrame::Param param; |
| 1528 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) | 1543 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) |
| 1529 return false; | 1544 return false; |
| 1530 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); | 1545 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); |
| 1531 uint32_t output_surface_id = base::get<0>(param); | 1546 uint32_t output_surface_id = base::get<0>(param); |
| 1532 base::get<1>(param).AssignTo(frame.get()); | 1547 base::get<1>(param).AssignTo(frame.get()); |
| 1533 std::vector<IPC::Message> messages_to_deliver_with_frame; | 1548 std::vector<IPC::Message> messages_to_deliver_with_frame; |
| 1534 messages_to_deliver_with_frame.swap(base::get<2>(param)); | 1549 messages_to_deliver_with_frame.swap(base::get<2>(param)); |
| 1535 | 1550 |
| 1536 if (!ui::LatencyInfo::Verify(frame->metadata.latency_info, | 1551 if (!ui::LatencyInfo::Verify(frame->metadata.latency_info, |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2189 } | 2204 } |
| 2190 | 2205 |
| 2191 #if defined(OS_WIN) | 2206 #if defined(OS_WIN) |
| 2192 gfx::NativeViewAccessible | 2207 gfx::NativeViewAccessible |
| 2193 RenderWidgetHostImpl::GetParentNativeViewAccessible() { | 2208 RenderWidgetHostImpl::GetParentNativeViewAccessible() { |
| 2194 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL; | 2209 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL; |
| 2195 } | 2210 } |
| 2196 #endif | 2211 #endif |
| 2197 | 2212 |
| 2198 } // namespace content | 2213 } // namespace content |
| OLD | NEW |