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

Unified Diff: content/renderer/render_view_impl.h

Issue 689163002: Clean up the page state saving mechanism. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixeds Created 6 years, 2 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_view_browsertest_mac.mm ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view_impl.h
diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h
index 67adc19750321faa4bbb449b288f39b22fdf7cf5..ec971474546f5046dcc5268332df22d48d0449e0 100644
--- a/content/renderer/render_view_impl.h
+++ b/content/renderer/render_view_impl.h
@@ -206,8 +206,8 @@ class CONTENT_EXPORT RenderViewImpl
return renderer_preferences_;
}
- void set_send_content_state_immediately(bool value) {
- send_content_state_immediately_ = value;
+ void set_page_state_sent_immediately(bool value) {
+ page_state_sent_immediately_ = value;
}
MouseLockDispatcher* mouse_lock_dispatcher() {
@@ -310,9 +310,8 @@ class CONTENT_EXPORT RenderViewImpl
void GetWindowSnapshot(const WindowSnapshotCallback& callback);
- // Dispatches the current navigation state to the browser. Called on a
- // periodic timer so we don't send too many messages.
- void SyncNavigationState();
+ // Forces the current page state to be flushed to the browser.
+ void ForcePageStateFlushForTesting();
// Returns the length of the session history of this RenderView. Note that
// this only coincides with the actual length of the session history if this
@@ -465,7 +464,7 @@ class CONTENT_EXPORT RenderViewImpl
const gfx::Point& point) const override;
bool ShouldDisplayScrollbars(int width, int height) const override;
int GetEnabledBindings() const override;
- bool GetContentStateImmediately() const override;
+ bool IsPageStateSentImmediately() const override;
blink::WebPageVisibilityState GetVisibilityState() const override;
void DidStartLoading() override;
void DidStopLoading() override;
@@ -628,9 +627,6 @@ class CONTENT_EXPORT RenderViewImpl
static WindowOpenDisposition NavigationPolicyToDisposition(
blink::WebNavigationPolicy policy);
- void UpdateSessionHistory(blink::WebFrame* frame);
- void SendUpdateState(HistoryEntry* entry);
-
// Sends a message and runs a nested message loop.
bool SendAndRunNestedMessageLoop(IPC::SyncMessage* message);
@@ -780,8 +776,13 @@ class CONTENT_EXPORT RenderViewImpl
const blink::WebRect& selection_rect,
bool final_status_update);
- // Starts nav_state_sync_timer_ if it isn't already running.
- void StartNavStateSyncTimerIfNecessary();
+ // Marks the page state as being changed and in need of being sent to the
+ // browser. (It will be sent on a delay, but that doesn't concern callers.)
+ void MarkPageStateAsDirty();
+
+ // If there is a pending page state update that hasn't yet been sent to the
+ // browser, send it to the browser.
+ void FlushPageState();
#if defined(OS_POSIX) && !defined(OS_MACOSX)
void UpdateFontRenderingFromRendererPrefs();
@@ -838,11 +839,6 @@ class CONTENT_EXPORT RenderViewImpl
HostZoomLevels host_zoom_levels_;
- // Whether content state (such as form state, scroll position and page
- // contents) should be sent to the browser immediately. This is normally
- // false, but set to true by some tests.
- bool send_content_state_immediately_;
-
// Bitwise-ORed set of extra bindings that have been enabled. See
// BindingsPolicy for details.
int enabled_bindings_;
@@ -887,8 +883,18 @@ class CONTENT_EXPORT RenderViewImpl
// TODO(nasko): Move to RenderFrame, as this is per-frame state.
scoped_ptr<FrameMsg_Navigate_Params> pending_navigation_params_;
- // Timer used to delay the updating of nav state (see SyncNavigationState).
- base::OneShotTimer<RenderViewImpl> nav_state_sync_timer_;
+ // Whether the page state (such as form state, scroll position and page
+ // contents) should be sent to the browser immediately. This is normally
+ // false, but is set to true by some tests.
+ bool page_state_sent_immediately_;
+
+ // Whether the page state is dirty (meaning that the browser does not have an
+ // up-to-date copy).
+ bool page_state_dirty_;
+
+ // Timer used to delay the sending of the page state (see
+ // MarkPageStateAsDirty).
+ base::OneShotTimer<RenderViewImpl> page_state_timer_;
// Page IDs ------------------------------------------------------------------
// See documentation in RenderView.
« no previous file with comments | « content/renderer/render_view_browsertest_mac.mm ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698