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

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

Issue 2730203002: Revert of Discard compositor frames from unloaded web content (Closed)
Patch Set: 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
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),
298 weak_factory_(this) { 297 weak_factory_(this) {
299 CHECK(delegate_); 298 CHECK(delegate_);
300 CHECK_NE(MSG_ROUTING_NONE, routing_id_); 299 CHECK_NE(MSG_ROUTING_NONE, routing_id_);
301 latency_tracker_.SetDelegate(delegate_); 300 latency_tracker_.SetDelegate(delegate_);
302 301
303 #if defined(OS_WIN) 302 #if defined(OS_WIN)
304 // Update the display color profile cache so that it is likely to be up to 303 // Update the display color profile cache so that it is likely to be up to
305 // date when the renderer process requests the color profile. 304 // date when the renderer process requests the color profile.
306 if (gfx::ICCProfile::CachedProfilesNeedUpdate()) { 305 if (gfx::ICCProfile::CachedProfilesNeedUpdate()) {
307 base::PostTaskWithTraits( 306 base::PostTaskWithTraits(
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 978
980 void RenderWidgetHostImpl::StopHangMonitorTimeout() { 979 void RenderWidgetHostImpl::StopHangMonitorTimeout() {
981 if (hang_monitor_timeout_) { 980 if (hang_monitor_timeout_) {
982 hang_monitor_timeout_->Stop(); 981 hang_monitor_timeout_->Stop();
983 hang_monitor_reason_ = 982 hang_monitor_reason_ =
984 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_UNKNOWN; 983 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_UNKNOWN;
985 } 984 }
986 RendererIsResponsive(); 985 RendererIsResponsive();
987 } 986 }
988 987
989 void RenderWidgetHostImpl::StartNewContentRenderingTimeout( 988 void RenderWidgetHostImpl::StartNewContentRenderingTimeout() {
990 uint32_t next_source_id) {
991 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 (received_paint_after_load_) {
996 received_paint_after_load_ = false; 993 received_paint_after_load_ = false;
997 return; 994 return;
998 } 995 }
999 996
1000 new_content_rendering_timeout_->Start(new_content_rendering_delay_); 997 new_content_rendering_timeout_->Start(new_content_rendering_delay_);
1001 } 998 }
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
1825 std::vector<ui::LatencyInfo>().swap(frame.metadata.latency_info); 1822 std::vector<ui::LatencyInfo>().swap(frame.metadata.latency_info);
1826 } 1823 }
1827 1824
1828 latency_tracker_.OnSwapCompositorFrame(&frame.metadata.latency_info); 1825 latency_tracker_.OnSwapCompositorFrame(&frame.metadata.latency_info);
1829 1826
1830 bool is_mobile_optimized = IsMobileOptimizedFrame(frame.metadata); 1827 bool is_mobile_optimized = IsMobileOptimizedFrame(frame.metadata);
1831 input_router_->NotifySiteIsMobileOptimized(is_mobile_optimized); 1828 input_router_->NotifySiteIsMobileOptimized(is_mobile_optimized);
1832 if (touch_emulator_) 1829 if (touch_emulator_)
1833 touch_emulator_->SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); 1830 touch_emulator_->SetDoubleTapSupportForPageEnabled(!is_mobile_optimized);
1834 1831
1835 // Ignore this frame if its content has already been unloaded. Source ID 1832 if (view_) {
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_) {
1842 view_->OnSwapCompositorFrame(compositor_frame_sink_id, std::move(frame)); 1833 view_->OnSwapCompositorFrame(compositor_frame_sink_id, std::move(frame));
1843 view_->DidReceiveRendererFrame(); 1834 view_->DidReceiveRendererFrame();
1844 } else { 1835 } else {
1845 cc::ReturnedResourceArray resources; 1836 cc::ReturnedResourceArray resources;
1846 cc::TransferableResource::ReturnResources(frame.resource_list, &resources); 1837 cc::TransferableResource::ReturnResources(frame.resource_list, &resources);
1847 SendReclaimCompositorResources(routing_id_, compositor_frame_sink_id, 1838 SendReclaimCompositorResources(routing_id_, compositor_frame_sink_id,
1848 process_->GetID(), true /* is_swap_ack */, 1839 process_->GetID(), true /* is_swap_ack */,
1849 resources); 1840 resources);
1850 } 1841 }
1851 1842
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
2514 // different from the receiver's. 2505 // different from the receiver's.
2515 file_system_file.url = 2506 file_system_file.url =
2516 GURL(storage::GetIsolatedFileSystemRootURIString( 2507 GURL(storage::GetIsolatedFileSystemRootURIString(
2517 file_system_url.origin(), filesystem_id, std::string()) 2508 file_system_url.origin(), filesystem_id, std::string())
2518 .append(register_name)); 2509 .append(register_name));
2519 file_system_file.filesystem_id = filesystem_id; 2510 file_system_file.filesystem_id = filesystem_id;
2520 } 2511 }
2521 } 2512 }
2522 2513
2523 } // namespace content 2514 } // 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