diff options
author | nasko <nasko@chromium.org> | 2014-11-18 10:18:57 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-18 18:19:23 +0000 |
commit | 78f06bce564a2cfefc41be706606e188ab6cf877 (patch) | |
tree | 31037a30c1424ad5973aacd1e66183c9f826bc42 | |
parent | 651c52db32c31da522c7694d716bbb1dc74d734c (diff) | |
download | chromium_src-78f06bce564a2cfefc41be706606e188ab6cf877.zip chromium_src-78f06bce564a2cfefc41be706606e188ab6cf877.tar.gz chromium_src-78f06bce564a2cfefc41be706606e188ab6cf877.tar.bz2 |
Move NavigateToSwappedOutURL from RenderViewImpl to RenderFrameImpl.
BUG=304341
Review URL: https://codereview.chromium.org/715193004
Cr-Commit-Position: refs/heads/master@{#304642}
-rw-r--r-- | content/renderer/render_frame_impl.cc | 15 | ||||
-rw-r--r-- | content/renderer/render_frame_impl.h | 4 | ||||
-rw-r--r-- | content/renderer/render_view_impl.cc | 17 | ||||
-rw-r--r-- | content/renderer/render_view_impl.h | 4 |
4 files changed, 19 insertions, 21 deletions
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index 028017e..8e70202 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc @@ -1084,6 +1084,19 @@ void RenderFrameImpl::OnNavigate(const FrameMsg_Navigate_Params& params) { render_view_->pending_navigation_params_.reset(); } +void RenderFrameImpl::NavigateToSwappedOutURL() { + // We use loadRequest instead of loadHTMLString because the former commits + // synchronously. Otherwise a new navigation can interrupt the navigation + // to kSwappedOutURL. If that happens to be to the page we had been + // showing, then WebKit will never send a commit and we'll be left spinning. + // Set the is_swapped_out_ bit to true, so IPC filtering is in effect and + // the navigation to swappedout:// is not announced to the browser side. + is_swapped_out_ = true; + GURL swappedOutURL(kSwappedOutURL); + WebURLRequest request(swappedOutURL); + frame_->loadRequest(request); +} + void RenderFrameImpl::BindServiceRegistry( mojo::ScopedMessagePipeHandle service_provider_handle) { service_registry_.BindRemoteServiceProvider(service_provider_handle.Pass()); @@ -1163,7 +1176,7 @@ void RenderFrameImpl::OnSwapOut(int proxy_routing_id) { // TODO(creis): Need to add a better way to do this that avoids running the // beforeunload handler. For now, we just run it a second time silently. if (!is_site_per_process || is_main_frame) - render_view_->NavigateToSwappedOutURL(frame_); + NavigateToSwappedOutURL(); // Let WebKit know that this view is hidden so it can drop resources and // stop compositing. diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h index d2261da..0435553 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h @@ -483,6 +483,10 @@ class CONTENT_EXPORT RenderFrameImpl // this back to private member. void OnNavigate(const FrameMsg_Navigate_Params& params); + // Make this frame show an empty, unscriptable page. + // TODO(nasko): Remove this method once swapped out state is no longer used. + void NavigateToSwappedOutURL(); + // Binds this render frame's service registry to a handle to the remote // service registry. void BindServiceRegistry( diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index d800d6d..7f38d6c 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -835,7 +835,7 @@ void RenderViewImpl::Initialize(RenderViewImplParams* params) { // If we are initially swapped out, navigate to kSwappedOutURL. // This ensures we are in a unique origin that others cannot script. if (is_swapped_out_ && webview()->mainFrame()->isWebLocalFrame()) - NavigateToSwappedOutURL(webview()->mainFrame()); + main_render_frame_->NavigateToSwappedOutURL(); } RenderViewImpl::~RenderViewImpl() { @@ -3252,21 +3252,6 @@ void RenderViewImpl::OnSuppressDialogsUntilSwapOut() { suppress_dialogs_until_swap_out_ = true; } -void RenderViewImpl::NavigateToSwappedOutURL(blink::WebFrame* frame) { - // We use loadRequest instead of loadHTMLString because the former commits - // synchronously. Otherwise a new navigation can interrupt the navigation - // to kSwappedOutURL. If that happens to be to the page we had been - // showing, then WebKit will never send a commit and we'll be left spinning. - // TODO(creis): Until we move this to RenderFrame, we may call this from a - // swapped out RenderFrame while our own is_swapped_out_ is false. - RenderFrameImpl* rf = RenderFrameImpl::FromWebFrame(frame); - CHECK(is_swapped_out_ || rf->is_swapped_out()); - GURL swappedOutURL(kSwappedOutURL); - WebURLRequest request(swappedOutURL); - if (frame->isWebLocalFrame()) - frame->loadRequest(request); -} - void RenderViewImpl::OnClosePage() { FOR_EACH_OBSERVER(RenderViewObserver, observers_, ClosePage()); // TODO(creis): We'd rather use webview()->Close() here, but that currently diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h index c62642d5..6616acd 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h @@ -754,10 +754,6 @@ class CONTENT_EXPORT RenderViewImpl int32 page_id, bool is_reload); - // Make the given |frame| show an empty, unscriptable page. - // TODO(creis): Move this to RenderFrame. - void NavigateToSwappedOutURL(blink::WebFrame* frame); - // If we initiated a navigation, this function will populate |document_state| // with the navigation information saved in OnNavigate(). void PopulateDocumentStateFromPending(DocumentState* document_state); |