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

Unified Diff: content/renderer/render_widget.cc

Issue 2707243005: Discard compositor frames from unloaded web content (Closed)
Patch Set: Add default value for source ID in frame metadata 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_widget.h ('k') | content/test/test_render_view_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index f5f43f07028bb43d883919571d84b0d52a50c28c..6a4442fa9cb31bf7e7676f129c07fdb42836a797 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -378,6 +378,7 @@ RenderWidget::RenderWidget(int32_t widget_routing_id,
focused_pepper_plugin_(nullptr),
time_to_first_active_paint_recorded_(true),
was_shown_time_(base::TimeTicks::Now()),
+ current_content_source_id_(0),
weak_ptr_factory_(this) {
DCHECK_NE(routing_id_, MSG_ROUTING_NONE);
if (!swapped_out)
@@ -1286,6 +1287,7 @@ blink::WebLayerTreeView* RenderWidget::initializeLayerTreeView() {
compositor_->setViewportSize(physical_backing_size_);
OnDeviceScaleFactorChanged();
compositor_->SetDeviceColorSpace(screen_info_.icc_profile.GetColorSpace());
+ compositor_->SetContentSourceId(current_content_source_id_);
// For background pages and certain tests, we don't want to trigger
// CompositorFrameSink creation.
if (compositor_never_visible_ || !RenderThreadImpl::current())
@@ -2300,6 +2302,15 @@ void RenderWidget::startDragging(blink::WebReferrerPolicy policy,
possible_drag_event_info_));
}
+uint32_t RenderWidget::GetContentSourceId() {
+ return current_content_source_id_;
+}
+
+void RenderWidget::IncrementContentSourceId() {
+ if (compositor_)
+ compositor_->SetContentSourceId(++current_content_source_id_);
+}
+
blink::WebWidget* RenderWidget::GetWebWidget() const {
return webwidget_internal_;
}
« no previous file with comments | « content/renderer/render_widget.h ('k') | content/test/test_render_view_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698