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

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

Issue 2770873002: Remove ViewHostMsg_DidFirstPaintAfterLoad (Closed)
Patch Set: Updated unit tests 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 ignore_input_events_(false), 275 ignore_input_events_(false),
276 text_direction_updated_(false), 276 text_direction_updated_(false),
277 text_direction_(blink::WebTextDirectionLeftToRight), 277 text_direction_(blink::WebTextDirectionLeftToRight),
278 text_direction_canceled_(false), 278 text_direction_canceled_(false),
279 suppress_events_until_keydown_(false), 279 suppress_events_until_keydown_(false),
280 pending_mouse_lock_request_(false), 280 pending_mouse_lock_request_(false),
281 allow_privileged_mouse_lock_(false), 281 allow_privileged_mouse_lock_(false),
282 has_touch_handler_(false), 282 has_touch_handler_(false),
283 is_in_touchpad_gesture_scroll_(false), 283 is_in_touchpad_gesture_scroll_(false),
284 is_in_touchscreen_gesture_scroll_(false), 284 is_in_touchscreen_gesture_scroll_(false),
285 received_paint_after_load_(false),
286 latency_tracker_(), 285 latency_tracker_(),
287 next_browser_snapshot_id_(1), 286 next_browser_snapshot_id_(1),
288 owned_by_render_frame_host_(false), 287 owned_by_render_frame_host_(false),
289 is_focused_(false), 288 is_focused_(false),
290 hung_renderer_delay_( 289 hung_renderer_delay_(
291 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)), 290 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)),
292 hang_monitor_event_type_(blink::WebInputEvent::Undefined), 291 hang_monitor_event_type_(blink::WebInputEvent::Undefined),
293 last_event_type_(blink::WebInputEvent::Undefined), 292 last_event_type_(blink::WebInputEvent::Undefined),
294 new_content_rendering_delay_( 293 new_content_rendering_delay_(
295 base::TimeDelta::FromMilliseconds(kNewContentRenderingDelayMs)), 294 base::TimeDelta::FromMilliseconds(kNewContentRenderingDelayMs)),
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, 559 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged,
561 OnTextInputStateChanged) 560 OnTextInputStateChanged)
562 IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnLockMouse) 561 IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnLockMouse)
563 IPC_MESSAGE_HANDLER(ViewHostMsg_UnlockMouse, OnUnlockMouse) 562 IPC_MESSAGE_HANDLER(ViewHostMsg_UnlockMouse, OnUnlockMouse)
564 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowDisambiguationPopup, 563 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowDisambiguationPopup,
565 OnShowDisambiguationPopup) 564 OnShowDisambiguationPopup)
566 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionBoundsChanged, 565 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionBoundsChanged,
567 OnSelectionBoundsChanged) 566 OnSelectionBoundsChanged)
568 IPC_MESSAGE_HANDLER(InputHostMsg_ImeCompositionRangeChanged, 567 IPC_MESSAGE_HANDLER(InputHostMsg_ImeCompositionRangeChanged,
569 OnImeCompositionRangeChanged) 568 OnImeCompositionRangeChanged)
570 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFirstPaintAfterLoad,
571 OnFirstPaintAfterLoad)
572 IPC_MESSAGE_HANDLER(ViewHostMsg_SetNeedsBeginFrames, OnSetNeedsBeginFrames) 569 IPC_MESSAGE_HANDLER(ViewHostMsg_SetNeedsBeginFrames, OnSetNeedsBeginFrames)
573 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeTouched, OnFocusedNodeTouched) 570 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeTouched, OnFocusedNodeTouched)
574 IPC_MESSAGE_HANDLER(DragHostMsg_StartDragging, OnStartDragging) 571 IPC_MESSAGE_HANDLER(DragHostMsg_StartDragging, OnStartDragging)
575 IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor) 572 IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor)
576 IPC_MESSAGE_UNHANDLED(handled = false) 573 IPC_MESSAGE_UNHANDLED(handled = false)
577 IPC_END_MESSAGE_MAP() 574 IPC_END_MESSAGE_MAP()
578 575
579 if (!handled && input_router_ && input_router_->OnMessageReceived(msg)) 576 if (!handled && input_router_ && input_router_->OnMessageReceived(msg))
580 return true; 577 return true;
581 578
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 hang_monitor_timeout_->Stop(); 982 hang_monitor_timeout_->Stop();
986 RendererIsResponsive(); 983 RendererIsResponsive();
987 } 984 }
988 985
989 void RenderWidgetHostImpl::StartNewContentRenderingTimeout( 986 void RenderWidgetHostImpl::StartNewContentRenderingTimeout(
990 uint32_t next_source_id) { 987 uint32_t next_source_id) {
991 current_content_source_id_ = next_source_id; 988 current_content_source_id_ = next_source_id;
992 // It is possible for a compositor frame to arrive before the browser is 989 // It is possible for a compositor frame to arrive before the browser is
993 // notified about the page being committed, in which case no timer is 990 // notified about the page being committed, in which case no timer is
994 // necessary. 991 // necessary.
995 if (received_paint_after_load_) { 992 if (last_received_content_source_id_ >= current_content_source_id_)
996 received_paint_after_load_ = false;
997 return; 993 return;
998 }
999 994
1000 new_content_rendering_timeout_->Start(new_content_rendering_delay_); 995 new_content_rendering_timeout_->Start(new_content_rendering_delay_);
1001 } 996 }
1002 997
1003 void RenderWidgetHostImpl::OnFirstPaintAfterLoad() {
1004 if (new_content_rendering_timeout_->IsRunning()) {
1005 new_content_rendering_timeout_->Stop();
1006 } else {
1007 received_paint_after_load_ = true;
1008 }
1009 }
1010
1011 void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) { 998 void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) {
1012 ForwardMouseEventWithLatencyInfo(mouse_event, 999 ForwardMouseEventWithLatencyInfo(mouse_event,
1013 ui::LatencyInfo(ui::SourceEventType::OTHER)); 1000 ui::LatencyInfo(ui::SourceEventType::OTHER));
1014 if (owner_delegate_) 1001 if (owner_delegate_)
1015 owner_delegate_->RenderWidgetDidForwardMouseEvent(mouse_event); 1002 owner_delegate_->RenderWidgetDidForwardMouseEvent(mouse_event);
1016 } 1003 }
1017 1004
1018 void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( 1005 void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo(
1019 const blink::WebMouseEvent& mouse_event, 1006 const blink::WebMouseEvent& mouse_event,
1020 const ui::LatencyInfo& ui_latency) { 1007 const ui::LatencyInfo& ui_latency) {
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
1844 << " Expected: size=" << last_frame_size_.ToString() 1831 << " Expected: size=" << last_frame_size_.ToString()
1845 << ",scale=" << last_device_scale_factor_ 1832 << ",scale=" << last_device_scale_factor_
1846 << " Received: size=" << frame_size.ToString() 1833 << " Received: size=" << frame_size.ToString()
1847 << ",scale=" << device_scale_factor; 1834 << ",scale=" << device_scale_factor;
1848 return false; 1835 return false;
1849 } 1836 }
1850 last_local_surface_id_ = local_surface_id; 1837 last_local_surface_id_ = local_surface_id;
1851 last_frame_size_ = frame_size; 1838 last_frame_size_ = frame_size;
1852 last_device_scale_factor_ = device_scale_factor; 1839 last_device_scale_factor_ = device_scale_factor;
1853 1840
1841 last_received_content_source_id_ = frame.metadata.content_source_id;
1842
1854 if (frame.metadata.begin_frame_ack.sequence_number < 1843 if (frame.metadata.begin_frame_ack.sequence_number <
1855 cc::BeginFrameArgs::kStartingFrameNumber) { 1844 cc::BeginFrameArgs::kStartingFrameNumber) {
1856 // Received an invalid ack, renderer misbehaved. 1845 // Received an invalid ack, renderer misbehaved.
1857 bad_message::ReceivedBadMessage( 1846 bad_message::ReceivedBadMessage(
1858 GetProcess(), 1847 GetProcess(),
1859 bad_message::RWH_INVALID_BEGIN_FRAME_ACK_COMPOSITOR_FRAME); 1848 bad_message::RWH_INVALID_BEGIN_FRAME_ACK_COMPOSITOR_FRAME);
1860 return false; 1849 return false;
1861 } 1850 }
1862 // |has_damage| and |remaining_frames| are not transmitted. 1851 // |has_damage| and |remaining_frames| are not transmitted.
1863 frame.metadata.begin_frame_ack.has_damage = true; 1852 frame.metadata.begin_frame_ack.has_damage = true;
(...skipping 22 matching lines...) Expand all
1886 std::move(frame)); 1875 std::move(frame));
1887 view_->DidReceiveRendererFrame(); 1876 view_->DidReceiveRendererFrame();
1888 } else { 1877 } else {
1889 cc::ReturnedResourceArray resources; 1878 cc::ReturnedResourceArray resources;
1890 cc::TransferableResource::ReturnResources(frame.resource_list, &resources); 1879 cc::TransferableResource::ReturnResources(frame.resource_list, &resources);
1891 SendReclaimCompositorResources(routing_id_, compositor_frame_sink_id, 1880 SendReclaimCompositorResources(routing_id_, compositor_frame_sink_id,
1892 process_->GetID(), true /* is_swap_ack */, 1881 process_->GetID(), true /* is_swap_ack */,
1893 resources); 1882 resources);
1894 } 1883 }
1895 1884
1885 // After navigation, if a frame belonging to the new page is received, stop
1886 // the timer that triggers clearing the graphics of the last page.
1887 if (last_received_content_source_id_ >= current_content_source_id_ &&
1888 new_content_rendering_timeout_->IsRunning()) {
1889 new_content_rendering_timeout_->Stop();
1890 }
1891
1896 RenderProcessHost* rph = GetProcess(); 1892 RenderProcessHost* rph = GetProcess();
1897 for (std::vector<IPC::Message>::const_iterator i = 1893 for (std::vector<IPC::Message>::const_iterator i =
1898 messages_to_deliver_with_frame.begin(); 1894 messages_to_deliver_with_frame.begin();
1899 i != messages_to_deliver_with_frame.end(); 1895 i != messages_to_deliver_with_frame.end();
1900 ++i) { 1896 ++i) {
1901 rph->OnMessageReceived(*i); 1897 rph->OnMessageReceived(*i);
1902 if (i->dispatch_error()) 1898 if (i->dispatch_error())
1903 rph->OnBadMessageReceived(*i); 1899 rph->OnBadMessageReceived(*i);
1904 } 1900 }
1905 messages_to_deliver_with_frame.clear(); 1901 messages_to_deliver_with_frame.clear();
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
2615 // different from the receiver's. 2611 // different from the receiver's.
2616 file_system_file.url = 2612 file_system_file.url =
2617 GURL(storage::GetIsolatedFileSystemRootURIString( 2613 GURL(storage::GetIsolatedFileSystemRootURIString(
2618 file_system_url.origin(), filesystem_id, std::string()) 2614 file_system_url.origin(), filesystem_id, std::string())
2619 .append(register_name)); 2615 .append(register_name));
2620 file_system_file.filesystem_id = filesystem_id; 2616 file_system_file.filesystem_id = filesystem_id;
2621 } 2617 }
2622 } 2618 }
2623 2619
2624 } // namespace content 2620 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698