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 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <tuple> | 10 #include <tuple> |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
287 owned_by_render_frame_host_(false), | 287 owned_by_render_frame_host_(false), |
288 is_focused_(false), | 288 is_focused_(false), |
289 hung_renderer_delay_( | 289 hung_renderer_delay_( |
290 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)), | 290 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)), |
291 hang_monitor_reason_( | 291 hang_monitor_reason_( |
292 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_UNKNOWN), | 292 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_UNKNOWN), |
293 hang_monitor_event_type_(blink::WebInputEvent::Undefined), | 293 hang_monitor_event_type_(blink::WebInputEvent::Undefined), |
294 last_event_type_(blink::WebInputEvent::Undefined), | 294 last_event_type_(blink::WebInputEvent::Undefined), |
295 new_content_rendering_delay_( | 295 new_content_rendering_delay_( |
296 base::TimeDelta::FromMilliseconds(kNewContentRenderingDelayMs)), | 296 base::TimeDelta::FromMilliseconds(kNewContentRenderingDelayMs)), |
297 current_content_source_id_(0), | |
297 weak_factory_(this) { | 298 weak_factory_(this) { |
298 CHECK(delegate_); | 299 CHECK(delegate_); |
299 CHECK_NE(MSG_ROUTING_NONE, routing_id_); | 300 CHECK_NE(MSG_ROUTING_NONE, routing_id_); |
300 latency_tracker_.SetDelegate(delegate_); | 301 latency_tracker_.SetDelegate(delegate_); |
301 | 302 |
302 #if defined(OS_WIN) | 303 #if defined(OS_WIN) |
303 // Update the display color profile cache so that it is likely to be up to | 304 // Update the display color profile cache so that it is likely to be up to |
304 // date when the renderer process requests the color profile. | 305 // date when the renderer process requests the color profile. |
305 if (gfx::ICCProfile::CachedProfilesNeedUpdate()) { | 306 if (gfx::ICCProfile::CachedProfilesNeedUpdate()) { |
306 base::PostTaskWithTraits( | 307 base::PostTaskWithTraits( |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1003 | 1004 |
1004 void RenderWidgetHostImpl::StopHangMonitorTimeout() { | 1005 void RenderWidgetHostImpl::StopHangMonitorTimeout() { |
1005 if (hang_monitor_timeout_) { | 1006 if (hang_monitor_timeout_) { |
1006 hang_monitor_timeout_->Stop(); | 1007 hang_monitor_timeout_->Stop(); |
1007 hang_monitor_reason_ = | 1008 hang_monitor_reason_ = |
1008 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_UNKNOWN; | 1009 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_UNKNOWN; |
1009 } | 1010 } |
1010 RendererIsResponsive(); | 1011 RendererIsResponsive(); |
1011 } | 1012 } |
1012 | 1013 |
1013 void RenderWidgetHostImpl::StartNewContentRenderingTimeout() { | 1014 void RenderWidgetHostImpl::StartNewContentRenderingTimeout( |
1015 uint32_t next_source_id) { | |
1016 current_content_source_id_ = next_source_id; | |
1014 // It is possible for a compositor frame to arrive before the browser is | 1017 // It is possible for a compositor frame to arrive before the browser is |
1015 // notified about the page being committed, in which case no timer is | 1018 // notified about the page being committed, in which case no timer is |
1016 // necessary. | 1019 // necessary. |
1017 if (received_paint_after_load_) { | 1020 if (received_paint_after_load_) { |
1018 received_paint_after_load_ = false; | 1021 received_paint_after_load_ = false; |
1019 return; | 1022 return; |
1020 } | 1023 } |
1021 | 1024 |
1022 new_content_rendering_timeout_->Start(new_content_rendering_delay_); | 1025 new_content_rendering_timeout_->Start(new_content_rendering_delay_); |
1023 } | 1026 } |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1847 std::vector<ui::LatencyInfo>().swap(frame.metadata.latency_info); | 1850 std::vector<ui::LatencyInfo>().swap(frame.metadata.latency_info); |
1848 } | 1851 } |
1849 | 1852 |
1850 latency_tracker_.OnSwapCompositorFrame(&frame.metadata.latency_info); | 1853 latency_tracker_.OnSwapCompositorFrame(&frame.metadata.latency_info); |
1851 | 1854 |
1852 bool is_mobile_optimized = IsMobileOptimizedFrame(frame.metadata); | 1855 bool is_mobile_optimized = IsMobileOptimizedFrame(frame.metadata); |
1853 input_router_->NotifySiteIsMobileOptimized(is_mobile_optimized); | 1856 input_router_->NotifySiteIsMobileOptimized(is_mobile_optimized); |
1854 if (touch_emulator_) | 1857 if (touch_emulator_) |
1855 touch_emulator_->SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); | 1858 touch_emulator_->SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); |
1856 | 1859 |
1857 if (view_) { | 1860 // Ignore this frame if its content has already been unloaded. |
1861 if (view_ && frame.metadata.content_source_id >= current_content_source_id_) { | |
Charlie Reis
2017/03/01 20:13:29
What if this came from an OOPIF? Is it safe becau
kenrb
2017/03/02 17:08:17
Yes, and done.
| |
1858 view_->OnSwapCompositorFrame(compositor_frame_sink_id, std::move(frame)); | 1862 view_->OnSwapCompositorFrame(compositor_frame_sink_id, std::move(frame)); |
1859 view_->DidReceiveRendererFrame(); | 1863 view_->DidReceiveRendererFrame(); |
1860 } else { | 1864 } else { |
1861 cc::ReturnedResourceArray resources; | 1865 cc::ReturnedResourceArray resources; |
1862 cc::TransferableResource::ReturnResources(frame.resource_list, &resources); | 1866 cc::TransferableResource::ReturnResources(frame.resource_list, &resources); |
1863 SendReclaimCompositorResources(routing_id_, compositor_frame_sink_id, | 1867 SendReclaimCompositorResources(routing_id_, compositor_frame_sink_id, |
1864 process_->GetID(), true /* is_swap_ack */, | 1868 process_->GetID(), true /* is_swap_ack */, |
1865 resources); | 1869 resources); |
1866 } | 1870 } |
1867 | 1871 |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2530 // different from the receiver's. | 2534 // different from the receiver's. |
2531 file_system_file.url = | 2535 file_system_file.url = |
2532 GURL(storage::GetIsolatedFileSystemRootURIString( | 2536 GURL(storage::GetIsolatedFileSystemRootURIString( |
2533 file_system_url.origin(), filesystem_id, std::string()) | 2537 file_system_url.origin(), filesystem_id, std::string()) |
2534 .append(register_name)); | 2538 .append(register_name)); |
2535 file_system_file.filesystem_id = filesystem_id; | 2539 file_system_file.filesystem_id = filesystem_id; |
2536 } | 2540 } |
2537 } | 2541 } |
2538 | 2542 |
2539 } // namespace content | 2543 } // namespace content |
OLD | NEW |