Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(460)

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 1376003002: Make rendering timeouts work even if paint data received early (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cursor
Patch Set: Moved message dispatch mechanism from Blink to content Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
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() {
923 if (new_content_rendering_timeout_) 926 // It is possible for a compositor frame to arrive before the browser is
924 new_content_rendering_timeout_->Start(new_content_rendering_delay_); 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
934 new_content_rendering_timeout_->Start(new_content_rendering_delay_);
925 } 935 }
926 936
927 void RenderWidgetHostImpl::StopNewContentRenderingTimeout() { 937 void RenderWidgetHostImpl::OnFirstPaintAfterLoad() {
928 if (new_content_rendering_timeout_) 938 if (new_content_rendering_timeout_->IsRunning()) {
929 new_content_rendering_timeout_->Stop(); 939 new_content_rendering_timeout_->Stop();
940 } else {
941 received_paint_after_load_ = true;
942 }
930 } 943 }
931 944
932 void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) { 945 void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) {
933 ForwardMouseEventWithLatencyInfo(mouse_event, ui::LatencyInfo()); 946 ForwardMouseEventWithLatencyInfo(mouse_event, ui::LatencyInfo());
934 } 947 }
935 948
936 void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( 949 void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo(
937 const blink::WebMouseEvent& mouse_event, 950 const blink::WebMouseEvent& mouse_event,
938 const ui::LatencyInfo& ui_latency) { 951 const ui::LatencyInfo& ui_latency) {
939 TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardMouseEvent", 952 TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardMouseEvent",
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
1515 Send(new ViewMsg_Move_ACK(routing_id_)); 1528 Send(new ViewMsg_Move_ACK(routing_id_));
1516 } 1529 }
1517 } 1530 }
1518 1531
1519 bool RenderWidgetHostImpl::OnSwapCompositorFrame( 1532 bool RenderWidgetHostImpl::OnSwapCompositorFrame(
1520 const IPC::Message& message) { 1533 const IPC::Message& message) {
1521 // This trace event is used in 1534 // This trace event is used in
1522 // chrome/browser/extensions/api/cast_streaming/performance_test.cc 1535 // chrome/browser/extensions/api/cast_streaming/performance_test.cc
1523 TRACE_EVENT0("test_fps,benchmark", "OnSwapCompositorFrame"); 1536 TRACE_EVENT0("test_fps,benchmark", "OnSwapCompositorFrame");
1524 1537
1525 StopNewContentRenderingTimeout();
1526
1527 ViewHostMsg_SwapCompositorFrame::Param param; 1538 ViewHostMsg_SwapCompositorFrame::Param param;
1528 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, &param)) 1539 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, &param))
1529 return false; 1540 return false;
1530 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); 1541 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame);
1531 uint32_t output_surface_id = base::get<0>(param); 1542 uint32_t output_surface_id = base::get<0>(param);
1532 base::get<1>(param).AssignTo(frame.get()); 1543 base::get<1>(param).AssignTo(frame.get());
1533 std::vector<IPC::Message> messages_to_deliver_with_frame; 1544 std::vector<IPC::Message> messages_to_deliver_with_frame;
1534 messages_to_deliver_with_frame.swap(base::get<2>(param)); 1545 messages_to_deliver_with_frame.swap(base::get<2>(param));
1535 1546
1536 if (!ui::LatencyInfo::Verify(frame->metadata.latency_info, 1547 if (!ui::LatencyInfo::Verify(frame->metadata.latency_info,
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
2189 } 2200 }
2190 2201
2191 #if defined(OS_WIN) 2202 #if defined(OS_WIN)
2192 gfx::NativeViewAccessible 2203 gfx::NativeViewAccessible
2193 RenderWidgetHostImpl::GetParentNativeViewAccessible() { 2204 RenderWidgetHostImpl::GetParentNativeViewAccessible() {
2194 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL; 2205 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL;
2195 } 2206 }
2196 #endif 2207 #endif
2197 2208
2198 } // namespace content 2209 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698