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

Unified Diff: content/renderer/render_view_impl.cc

Issue 1449353002: OOPIF: Set timer for per-frame UpdateState. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make private Created 5 years, 1 month 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
Index: content/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 216d6187bfe2a132a60258a5c88e025b6b40d577..0e4bde339f0e6c2bf85a457af3c86e5382331e22 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -1487,6 +1487,20 @@ void RenderViewImpl::SendUpdateState() {
routing_id_, page_id_, HistoryEntryToPageState(entry)));
}
+void RenderViewImpl::SendFrameStateUpdates() {
+ // We only use this path in OOPIF-enabled modes.
+ DCHECK(SiteIsolationPolicy::UseSubframeNavigationEntries());
+
+ // Tell each frame with pending state to send its UpdateState message.
+ for (int render_frame_routing_id : frames_with_pending_state_) {
+ RenderFrameImpl* frame =
+ RenderFrameImpl::FromRoutingID(render_frame_routing_id);
+ if (frame)
+ frame->SendUpdateState();
+ }
+ frames_with_pending_state_.clear();
+}
+
void RenderViewImpl::ApplyWebPreferencesInternal(
const WebPreferences& prefs,
blink::WebView* web_view,
@@ -1851,11 +1865,10 @@ gfx::RectF RenderViewImpl::ClientRectToPhysicalWindowRect(
return window_rect;
}
-void RenderViewImpl::StartNavStateSyncTimerIfNecessary() {
- // TODO(creis): Move this to RenderFrameHost. In the meantime, we'll ignore
- // state changes between navigation events in OOPIF-enabled modes.
+void RenderViewImpl::StartNavStateSyncTimerIfNecessary(RenderFrameImpl* frame) {
+ // In OOPIF modes, keep track of which frames have pending updates.
if (SiteIsolationPolicy::UseSubframeNavigationEntries())
- return;
+ frames_with_pending_state_.insert(frame->GetRoutingID());
int delay;
if (send_content_state_immediately_)
@@ -1874,8 +1887,15 @@ void RenderViewImpl::StartNavStateSyncTimerIfNecessary() {
nav_state_sync_timer_.Stop();
}
- nav_state_sync_timer_.Start(FROM_HERE, TimeDelta::FromSeconds(delay), this,
- &RenderViewImpl::SendUpdateState);
+ if (SiteIsolationPolicy::UseSubframeNavigationEntries()) {
+ // In OOPIF modes, tell each frame with pending state to inform the browser.
+ nav_state_sync_timer_.Start(FROM_HERE, TimeDelta::FromSeconds(delay), this,
+ &RenderViewImpl::SendFrameStateUpdates);
+ } else {
+ // By default, send an UpdateState for the current history item.
+ nav_state_sync_timer_.Start(FROM_HERE, TimeDelta::FromSeconds(delay), this,
+ &RenderViewImpl::SendUpdateState);
+ }
}
void RenderViewImpl::setMouseOverURL(const WebURL& url) {
@@ -2136,10 +2156,6 @@ void RenderViewImpl::didChangeIcon(WebLocalFrame* frame,
SendUpdateFaviconURL(urls);
}
-void RenderViewImpl::didUpdateCurrentHistoryItem(WebLocalFrame* frame) {
- StartNavStateSyncTimerIfNecessary();
-}
-
void RenderViewImpl::CheckPreferredSize() {
// We don't always want to send the change messages over IPC, only if we've
// been put in that mode by getting a |ViewMsg_EnablePreferredSizeChangedMode|
@@ -2156,10 +2172,6 @@ void RenderViewImpl::CheckPreferredSize() {
preferred_size_));
}
-void RenderViewImpl::didChangeScrollOffset(WebLocalFrame* frame) {
- StartNavStateSyncTimerIfNecessary();
-}
-
void RenderViewImpl::SendFindReply(int request_id,
int match_count,
int ordinal,
« content/renderer/render_view_browsertest.cc ('K') | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698