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 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 | 979 |
979 void RenderWidgetHostImpl::StopHangMonitorTimeout() { | 980 void RenderWidgetHostImpl::StopHangMonitorTimeout() { |
980 if (hang_monitor_timeout_) { | 981 if (hang_monitor_timeout_) { |
981 hang_monitor_timeout_->Stop(); | 982 hang_monitor_timeout_->Stop(); |
982 hang_monitor_reason_ = | 983 hang_monitor_reason_ = |
983 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_UNKNOWN; | 984 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_UNKNOWN; |
984 } | 985 } |
985 RendererIsResponsive(); | 986 RendererIsResponsive(); |
986 } | 987 } |
987 | 988 |
988 void RenderWidgetHostImpl::StartNewContentRenderingTimeout() { | 989 void RenderWidgetHostImpl::StartNewContentRenderingTimeout( |
| 990 uint32_t next_source_id) { |
| 991 current_content_source_id_ = next_source_id; |
989 // 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 |
990 // 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 |
991 // necessary. | 994 // necessary. |
992 if (received_paint_after_load_) { | 995 if (received_paint_after_load_) { |
993 received_paint_after_load_ = false; | 996 received_paint_after_load_ = false; |
994 return; | 997 return; |
995 } | 998 } |
996 | 999 |
997 new_content_rendering_timeout_->Start(new_content_rendering_delay_); | 1000 new_content_rendering_timeout_->Start(new_content_rendering_delay_); |
998 } | 1001 } |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1822 std::vector<ui::LatencyInfo>().swap(frame.metadata.latency_info); | 1825 std::vector<ui::LatencyInfo>().swap(frame.metadata.latency_info); |
1823 } | 1826 } |
1824 | 1827 |
1825 latency_tracker_.OnSwapCompositorFrame(&frame.metadata.latency_info); | 1828 latency_tracker_.OnSwapCompositorFrame(&frame.metadata.latency_info); |
1826 | 1829 |
1827 bool is_mobile_optimized = IsMobileOptimizedFrame(frame.metadata); | 1830 bool is_mobile_optimized = IsMobileOptimizedFrame(frame.metadata); |
1828 input_router_->NotifySiteIsMobileOptimized(is_mobile_optimized); | 1831 input_router_->NotifySiteIsMobileOptimized(is_mobile_optimized); |
1829 if (touch_emulator_) | 1832 if (touch_emulator_) |
1830 touch_emulator_->SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); | 1833 touch_emulator_->SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); |
1831 | 1834 |
1832 if (view_) { | 1835 // Ignore this frame if its content has already been unloaded. Source ID |
| 1836 // is always zero for an OOPIF because we are only concerned with displaying |
| 1837 // stale graphics on top-level frames. We accept frames that have a source ID |
| 1838 // greater than |current_content_source_id_| because in some cases the first |
| 1839 // compositor frame can arrive before the navigation commit message that |
| 1840 // updates that value. |
| 1841 if (view_ && frame.metadata.content_source_id >= current_content_source_id_) { |
1833 view_->OnSwapCompositorFrame(compositor_frame_sink_id, std::move(frame)); | 1842 view_->OnSwapCompositorFrame(compositor_frame_sink_id, std::move(frame)); |
1834 view_->DidReceiveRendererFrame(); | 1843 view_->DidReceiveRendererFrame(); |
1835 } else { | 1844 } else { |
1836 cc::ReturnedResourceArray resources; | 1845 cc::ReturnedResourceArray resources; |
1837 cc::TransferableResource::ReturnResources(frame.resource_list, &resources); | 1846 cc::TransferableResource::ReturnResources(frame.resource_list, &resources); |
1838 SendReclaimCompositorResources(routing_id_, compositor_frame_sink_id, | 1847 SendReclaimCompositorResources(routing_id_, compositor_frame_sink_id, |
1839 process_->GetID(), true /* is_swap_ack */, | 1848 process_->GetID(), true /* is_swap_ack */, |
1840 resources); | 1849 resources); |
1841 } | 1850 } |
1842 | 1851 |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2505 // different from the receiver's. | 2514 // different from the receiver's. |
2506 file_system_file.url = | 2515 file_system_file.url = |
2507 GURL(storage::GetIsolatedFileSystemRootURIString( | 2516 GURL(storage::GetIsolatedFileSystemRootURIString( |
2508 file_system_url.origin(), filesystem_id, std::string()) | 2517 file_system_url.origin(), filesystem_id, std::string()) |
2509 .append(register_name)); | 2518 .append(register_name)); |
2510 file_system_file.filesystem_id = filesystem_id; | 2519 file_system_file.filesystem_id = filesystem_id; |
2511 } | 2520 } |
2512 } | 2521 } |
2513 | 2522 |
2514 } // namespace content | 2523 } // namespace content |
OLD | NEW |