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

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

Issue 2770873002: Remove ViewHostMsg_DidFirstPaintAfterLoad (Closed)
Patch Set: Rebased Created 3 years, 9 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 8
9 #include <set> 9 #include <set>
10 #include <tuple> 10 #include <tuple>
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 ignore_input_events_(false), 276 ignore_input_events_(false),
277 text_direction_updated_(false), 277 text_direction_updated_(false),
278 text_direction_(blink::WebTextDirectionLeftToRight), 278 text_direction_(blink::WebTextDirectionLeftToRight),
279 text_direction_canceled_(false), 279 text_direction_canceled_(false),
280 suppress_events_until_keydown_(false), 280 suppress_events_until_keydown_(false),
281 pending_mouse_lock_request_(false), 281 pending_mouse_lock_request_(false),
282 allow_privileged_mouse_lock_(false), 282 allow_privileged_mouse_lock_(false),
283 has_touch_handler_(false), 283 has_touch_handler_(false),
284 is_in_touchpad_gesture_scroll_(false), 284 is_in_touchpad_gesture_scroll_(false),
285 is_in_touchscreen_gesture_scroll_(false), 285 is_in_touchscreen_gesture_scroll_(false),
286 received_paint_after_load_(false),
287 latency_tracker_(), 286 latency_tracker_(),
288 next_browser_snapshot_id_(1), 287 next_browser_snapshot_id_(1),
289 owned_by_render_frame_host_(false), 288 owned_by_render_frame_host_(false),
290 is_focused_(false), 289 is_focused_(false),
291 hung_renderer_delay_( 290 hung_renderer_delay_(
292 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)), 291 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)),
293 hang_monitor_event_type_(blink::WebInputEvent::Undefined), 292 hang_monitor_event_type_(blink::WebInputEvent::Undefined),
294 last_event_type_(blink::WebInputEvent::Undefined), 293 last_event_type_(blink::WebInputEvent::Undefined),
295 new_content_rendering_delay_( 294 new_content_rendering_delay_(
296 base::TimeDelta::FromMilliseconds(kNewContentRenderingDelayMs)), 295 base::TimeDelta::FromMilliseconds(kNewContentRenderingDelayMs)),
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, 562 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged,
564 OnTextInputStateChanged) 563 OnTextInputStateChanged)
565 IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnLockMouse) 564 IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnLockMouse)
566 IPC_MESSAGE_HANDLER(ViewHostMsg_UnlockMouse, OnUnlockMouse) 565 IPC_MESSAGE_HANDLER(ViewHostMsg_UnlockMouse, OnUnlockMouse)
567 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowDisambiguationPopup, 566 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowDisambiguationPopup,
568 OnShowDisambiguationPopup) 567 OnShowDisambiguationPopup)
569 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionBoundsChanged, 568 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionBoundsChanged,
570 OnSelectionBoundsChanged) 569 OnSelectionBoundsChanged)
571 IPC_MESSAGE_HANDLER(InputHostMsg_ImeCompositionRangeChanged, 570 IPC_MESSAGE_HANDLER(InputHostMsg_ImeCompositionRangeChanged,
572 OnImeCompositionRangeChanged) 571 OnImeCompositionRangeChanged)
573 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFirstPaintAfterLoad,
574 OnFirstPaintAfterLoad)
575 IPC_MESSAGE_HANDLER(ViewHostMsg_SetNeedsBeginFrames, OnSetNeedsBeginFrames) 572 IPC_MESSAGE_HANDLER(ViewHostMsg_SetNeedsBeginFrames, OnSetNeedsBeginFrames)
576 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeTouched, OnFocusedNodeTouched) 573 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeTouched, OnFocusedNodeTouched)
577 IPC_MESSAGE_HANDLER(DragHostMsg_StartDragging, OnStartDragging) 574 IPC_MESSAGE_HANDLER(DragHostMsg_StartDragging, OnStartDragging)
578 IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor) 575 IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor)
579 IPC_MESSAGE_UNHANDLED(handled = false) 576 IPC_MESSAGE_UNHANDLED(handled = false)
580 IPC_END_MESSAGE_MAP() 577 IPC_END_MESSAGE_MAP()
581 578
582 if (!handled && input_router_ && input_router_->OnMessageReceived(msg)) 579 if (!handled && input_router_ && input_router_->OnMessageReceived(msg))
583 return true; 580 return true;
584 581
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 hang_monitor_timeout_->Stop(); 985 hang_monitor_timeout_->Stop();
989 RendererIsResponsive(); 986 RendererIsResponsive();
990 } 987 }
991 988
992 void RenderWidgetHostImpl::StartNewContentRenderingTimeout( 989 void RenderWidgetHostImpl::StartNewContentRenderingTimeout(
993 uint32_t next_source_id) { 990 uint32_t next_source_id) {
994 current_content_source_id_ = next_source_id; 991 current_content_source_id_ = next_source_id;
995 // It is possible for a compositor frame to arrive before the browser is 992 // It is possible for a compositor frame to arrive before the browser is
996 // notified about the page being committed, in which case no timer is 993 // notified about the page being committed, in which case no timer is
997 // necessary. 994 // necessary.
998 if (received_paint_after_load_) { 995 if (last_received_content_source_id_ >= current_content_source_id_)
999 received_paint_after_load_ = false;
1000 return; 996 return;
1001 }
1002 997
1003 new_content_rendering_timeout_->Start(new_content_rendering_delay_); 998 new_content_rendering_timeout_->Start(new_content_rendering_delay_);
1004 } 999 }
1005 1000
1006 void RenderWidgetHostImpl::OnFirstPaintAfterLoad() {
1007 if (new_content_rendering_timeout_->IsRunning()) {
1008 new_content_rendering_timeout_->Stop();
1009 } else {
1010 received_paint_after_load_ = true;
1011 }
1012 }
1013
1014 void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) { 1001 void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) {
1015 ForwardMouseEventWithLatencyInfo(mouse_event, 1002 ForwardMouseEventWithLatencyInfo(mouse_event,
1016 ui::LatencyInfo(ui::SourceEventType::OTHER)); 1003 ui::LatencyInfo(ui::SourceEventType::OTHER));
1017 if (owner_delegate_) 1004 if (owner_delegate_)
1018 owner_delegate_->RenderWidgetDidForwardMouseEvent(mouse_event); 1005 owner_delegate_->RenderWidgetDidForwardMouseEvent(mouse_event);
1019 } 1006 }
1020 1007
1021 void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( 1008 void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo(
1022 const blink::WebMouseEvent& mouse_event, 1009 const blink::WebMouseEvent& mouse_event,
1023 const ui::LatencyInfo& ui_latency) { 1010 const ui::LatencyInfo& ui_latency) {
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
1866 << " Expected: size=" << last_frame_size_.ToString() 1853 << " Expected: size=" << last_frame_size_.ToString()
1867 << ",scale=" << last_device_scale_factor_ 1854 << ",scale=" << last_device_scale_factor_
1868 << " Received: size=" << frame_size.ToString() 1855 << " Received: size=" << frame_size.ToString()
1869 << ",scale=" << device_scale_factor; 1856 << ",scale=" << device_scale_factor;
1870 return false; 1857 return false;
1871 } 1858 }
1872 last_local_surface_id_ = local_surface_id; 1859 last_local_surface_id_ = local_surface_id;
1873 last_frame_size_ = frame_size; 1860 last_frame_size_ = frame_size;
1874 last_device_scale_factor_ = device_scale_factor; 1861 last_device_scale_factor_ = device_scale_factor;
1875 1862
1863 last_received_content_source_id_ = frame.metadata.content_source_id;
1864
1876 if (frame.metadata.begin_frame_ack.sequence_number < 1865 if (frame.metadata.begin_frame_ack.sequence_number <
1877 cc::BeginFrameArgs::kStartingFrameNumber) { 1866 cc::BeginFrameArgs::kStartingFrameNumber) {
1878 // Received an invalid ack, renderer misbehaved. 1867 // Received an invalid ack, renderer misbehaved.
1879 bad_message::ReceivedBadMessage( 1868 bad_message::ReceivedBadMessage(
1880 GetProcess(), 1869 GetProcess(),
1881 bad_message::RWH_INVALID_BEGIN_FRAME_ACK_COMPOSITOR_FRAME); 1870 bad_message::RWH_INVALID_BEGIN_FRAME_ACK_COMPOSITOR_FRAME);
1882 return false; 1871 return false;
1883 } 1872 }
1884 // |has_damage| and |remaining_frames| are not transmitted. 1873 // |has_damage| and |remaining_frames| are not transmitted.
1885 frame.metadata.begin_frame_ack.has_damage = true; 1874 frame.metadata.begin_frame_ack.has_damage = true;
(...skipping 22 matching lines...) Expand all
1908 std::move(frame)); 1897 std::move(frame));
1909 view_->DidReceiveRendererFrame(); 1898 view_->DidReceiveRendererFrame();
1910 } else { 1899 } else {
1911 cc::ReturnedResourceArray resources; 1900 cc::ReturnedResourceArray resources;
1912 cc::TransferableResource::ReturnResources(frame.resource_list, &resources); 1901 cc::TransferableResource::ReturnResources(frame.resource_list, &resources);
1913 SendReclaimCompositorResources(routing_id_, compositor_frame_sink_id, 1902 SendReclaimCompositorResources(routing_id_, compositor_frame_sink_id,
1914 process_->GetID(), true /* is_swap_ack */, 1903 process_->GetID(), true /* is_swap_ack */,
1915 resources); 1904 resources);
1916 } 1905 }
1917 1906
1907 // After navigation, if a frame belonging to the new page is received, stop
1908 // the timer that triggers clearing the graphics of the last page.
1909 if (last_received_content_source_id_ >= current_content_source_id_ &&
1910 new_content_rendering_timeout_->IsRunning()) {
1911 new_content_rendering_timeout_->Stop();
1912 }
1913
1918 RenderProcessHost* rph = GetProcess(); 1914 RenderProcessHost* rph = GetProcess();
1919 for (std::vector<IPC::Message>::const_iterator i = 1915 for (std::vector<IPC::Message>::const_iterator i =
1920 messages_to_deliver_with_frame.begin(); 1916 messages_to_deliver_with_frame.begin();
1921 i != messages_to_deliver_with_frame.end(); 1917 i != messages_to_deliver_with_frame.end();
1922 ++i) { 1918 ++i) {
1923 rph->OnMessageReceived(*i); 1919 rph->OnMessageReceived(*i);
1924 if (i->dispatch_error()) 1920 if (i->dispatch_error())
1925 rph->OnBadMessageReceived(*i); 1921 rph->OnBadMessageReceived(*i);
1926 } 1922 }
1927 messages_to_deliver_with_frame.clear(); 1923 messages_to_deliver_with_frame.clear();
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
2646 void RenderWidgetHostImpl::RequestCompositionUpdates(bool immediate_request, 2642 void RenderWidgetHostImpl::RequestCompositionUpdates(bool immediate_request,
2647 bool monitor_updates) { 2643 bool monitor_updates) {
2648 if (!immediate_request && monitor_updates == monitoring_composition_info_) 2644 if (!immediate_request && monitor_updates == monitoring_composition_info_)
2649 return; 2645 return;
2650 monitoring_composition_info_ = monitor_updates; 2646 monitoring_composition_info_ = monitor_updates;
2651 Send(new InputMsg_RequestCompositionUpdates(routing_id_, immediate_request, 2647 Send(new InputMsg_RequestCompositionUpdates(routing_id_, immediate_request,
2652 monitor_updates)); 2648 monitor_updates));
2653 } 2649 }
2654 2650
2655 } // namespace content 2651 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/browser/renderer_host/render_widget_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698