diff options
author | davidben <davidben@chromium.org> | 2014-10-07 11:52:04 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-07 18:52:17 +0000 |
commit | a5496d6d37a8e4e571d14256d504b15784274001 (patch) | |
tree | 262c66885cfc539ac067a706e8444de6dbf818a4 /content/browser/frame_host | |
parent | 8831427bce44557656e72995f2e4bdf475eaa022 (diff) | |
download | chromium_src-a5496d6d37a8e4e571d14256d504b15784274001.zip chromium_src-a5496d6d37a8e4e571d14256d504b15784274001.tar.gz chromium_src-a5496d6d37a8e4e571d14256d504b15784274001.tar.bz2 |
Pass ResourceResponse and StreamHandle in CommitNavigation.
Split out from https://codereview.chromium.org/519533002/.
NavigationBeforeCommitInfo is removed in favor of the already existing
ResourceResponse object. In addition, replace the stream URL with a
StreamHandle which maintains ownership. The ownership is transferred
to the UI thread, which will then maintain ownership on behalf of the renderer.
This loses navigation_request_id, so also remove the existing stub code in
NavigationRequest; that will be handled by a UI-thread NavigationURLLoader
object to hide all the IO thread business, including cancellation, from the
UI thread navigation code.
BUG=376015
Review URL: https://codereview.chromium.org/612903004
Cr-Commit-Position: refs/heads/master@{#298531}
Diffstat (limited to 'content/browser/frame_host')
-rw-r--r-- | content/browser/frame_host/navigation_before_commit_info.cc | 12 | ||||
-rw-r--r-- | content/browser/frame_host/navigation_before_commit_info.h | 46 | ||||
-rw-r--r-- | content/browser/frame_host/navigation_request.cc | 56 | ||||
-rw-r--r-- | content/browser/frame_host/navigation_request.h | 14 | ||||
-rw-r--r-- | content/browser/frame_host/navigator.cc | 6 | ||||
-rw-r--r-- | content/browser/frame_host/navigator.h | 6 | ||||
-rw-r--r-- | content/browser/frame_host/navigator_impl.cc | 39 | ||||
-rw-r--r-- | content/browser/frame_host/navigator_impl.h | 6 | ||||
-rw-r--r-- | content/browser/frame_host/navigator_impl_unittest.cc | 103 | ||||
-rw-r--r-- | content/browser/frame_host/render_frame_host_impl.cc | 10 | ||||
-rw-r--r-- | content/browser/frame_host/render_frame_host_impl.h | 5 | ||||
-rw-r--r-- | content/browser/frame_host/render_frame_host_manager.cc | 1 |
12 files changed, 104 insertions, 200 deletions
diff --git a/content/browser/frame_host/navigation_before_commit_info.cc b/content/browser/frame_host/navigation_before_commit_info.cc deleted file mode 100644 index c9fb873..0000000 --- a/content/browser/frame_host/navigation_before_commit_info.cc +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/browser/frame_host/navigation_before_commit_info.h" - -namespace content { - -NavigationBeforeCommitInfo::NavigationBeforeCommitInfo() - : navigation_request_id(-1) {} - -} // namespace content diff --git a/content/browser/frame_host/navigation_before_commit_info.h b/content/browser/frame_host/navigation_before_commit_info.h deleted file mode 100644 index 2a90b1d..0000000 --- a/content/browser/frame_host/navigation_before_commit_info.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_BEFORE_COMMIT_INFO_H_ -#define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_BEFORE_COMMIT_INFO_H_ - -#include <string> - -#include "base/basictypes.h" -#include "base/time/time.h" -#include "content/common/content_export.h" -#include "content/public/common/referrer.h" -#include "url/gurl.h" - -namespace content { - -// PlzNavigate: -// Holds the parameters determined during the load of a navigation request until -// the response is received. Initialized on the IO thread, then passed to the UI -// thread where it should be used to send a FrameMsg_CommitNavigation message to -// the renderer. -struct NavigationBeforeCommitInfo { - CONTENT_EXPORT NavigationBeforeCommitInfo(); - - // The url that is actually being loaded. - GURL navigation_url; - - // A unique blob url to be subsequently requested by the renderer as the main - // resource for the frame, that will be used to find the associated stream of - // data. - GURL stream_url; - - // TODO(clamy): Maybe add the redirect chain if needed by the renderer. - - // The navigationStart time to expose to JS for this navigation. - // TODO(clamy): Add the other values that matter to the Navigation Timing API. - base::TimeTicks browser_navigation_start; - - // The unique ID of this navigation request. - int64 navigation_request_id; -}; - -} // namespace content - -#endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_BEFORE_COMMIT_INFO_H_ diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc index 4e33ea5..8b87b7e 100644 --- a/content/browser/frame_host/navigation_request.cc +++ b/content/browser/frame_host/navigation_request.cc @@ -4,48 +4,16 @@ #include "content/browser/frame_host/navigation_request.h" -#include "base/logging.h" #include "content/browser/frame_host/navigation_request_info.h" -#include "content/browser/loader/resource_dispatcher_host_impl.h" #include "content/common/resource_request_body.h" -#include "content/public/browser/browser_thread.h" namespace content { -namespace { - -// The next available browser-global navigation request ID. -static int64 next_navigation_request_id_ = 0; - -void OnBeginNavigation(const CommonNavigationParams& common_params, - const NavigationRequestInfo& info, - scoped_refptr<ResourceRequestBody> request_body, - int64 navigation_request_id, - int64 frame_tree_node_id) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - ResourceDispatcherHostImpl::Get()->StartNavigationRequest( - common_params, - info, - request_body, - navigation_request_id, - frame_tree_node_id); -} - -void CancelNavigationRequest(int64 navigation_request_id, - int64 frame_tree_node_id) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - ResourceDispatcherHostImpl::Get()->CancelNavigationRequest( - navigation_request_id, frame_tree_node_id); -} - -} // namespace - NavigationRequest::NavigationRequest( - int64 frame_tree_node_id, + FrameTreeNode* frame_tree_node, const CommonNavigationParams& common_params, const CommitNavigationParams& commit_params) - : navigation_request_id_(++next_navigation_request_id_), - frame_tree_node_id_(frame_tree_node_id), + : frame_tree_node_(frame_tree_node), common_params_(common_params), commit_params_(commit_params) { } @@ -57,25 +25,7 @@ void NavigationRequest::BeginNavigation( scoped_ptr<NavigationRequestInfo> info, scoped_refptr<ResourceRequestBody> request_body) { info_ = info.Pass(); - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - BrowserThread::PostTask( - BrowserThread::IO, - FROM_HERE, - base::Bind(&OnBeginNavigation, - common_params_, - *info_, - request_body, - navigation_request_id_, - frame_tree_node_id_)); -} - -void NavigationRequest::CancelNavigation() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - BrowserThread::PostTask( - BrowserThread::IO, - FROM_HERE, - base::Bind(&CancelNavigationRequest, - navigation_request_id_, frame_tree_node_id_)); + NOTIMPLEMENTED(); } } // namespace content diff --git a/content/browser/frame_host/navigation_request.h b/content/browser/frame_host/navigation_request.h index 8f24c75..6f8f37b 100644 --- a/content/browser/frame_host/navigation_request.h +++ b/content/browser/frame_host/navigation_request.h @@ -12,6 +12,8 @@ #include "content/common/navigation_params.h" namespace content { + +class FrameTreeNode; class ResourceRequestBody; struct NavigationRequestInfo; @@ -23,7 +25,7 @@ struct NavigationRequestInfo; // the navigation following its refactoring. class CONTENT_EXPORT NavigationRequest { public: - NavigationRequest(int64 frame_tree_node_id, + NavigationRequest(FrameTreeNode* frame_tree_node, const CommonNavigationParams& common_params, const CommitNavigationParams& commit_params); @@ -35,13 +37,6 @@ class CONTENT_EXPORT NavigationRequest { void BeginNavigation(scoped_ptr<NavigationRequestInfo> info, scoped_refptr<ResourceRequestBody> body); - // Called on the UI thread by the RenderFrameHostManager which owns the - // NavigationRequest whenever this navigation request should be canceled. - void CancelNavigation(); - - int64 frame_tree_node_id() const { return frame_tree_node_id_; } - int64 navigation_request_id() const { return navigation_request_id_; } - CommonNavigationParams& common_params() { return common_params_; } const CommitNavigationParams& commit_params() const { return commit_params_; } @@ -49,8 +44,7 @@ class CONTENT_EXPORT NavigationRequest { NavigationRequestInfo* info_for_test() const { return info_.get(); } private: - const int64 navigation_request_id_; - const int64 frame_tree_node_id_; + FrameTreeNode* frame_tree_node_; // Initialized on creation of the NavigationRequest. Sent to the renderer when // the navigation is ready to commit. diff --git a/content/browser/frame_host/navigator.cc b/content/browser/frame_host/navigator.cc index 3d5eb8f9..3f5d6cb 100644 --- a/content/browser/frame_host/navigator.cc +++ b/content/browser/frame_host/navigator.cc @@ -5,6 +5,7 @@ #include "content/browser/frame_host/navigator.h" #include "base/time/time.h" +#include "content/public/browser/stream_handle.h" namespace content { @@ -22,4 +23,9 @@ base::TimeTicks Navigator::GetCurrentLoadStart() { return base::TimeTicks::Now(); } +void Navigator::CommitNavigation(FrameTreeNode* frame_tree_node, + ResourceResponse* response, + scoped_ptr<StreamHandle> body) { +} + } // namespace content diff --git a/content/browser/frame_host/navigator.h b/content/browser/frame_host/navigator.h index b05b538..cfd394f0 100644 --- a/content/browser/frame_host/navigator.h +++ b/content/browser/frame_host/navigator.h @@ -28,8 +28,9 @@ class NavigationEntryImpl; class NavigationRequest; class NavigatorDelegate; class RenderFrameHostImpl; +class StreamHandle; struct CommonNavigationParams; -struct NavigationBeforeCommitInfo; +struct ResourceResponse; // Implementations of this interface are responsible for performing navigations // in a node of the FrameTree. Its lifetime is bound to all FrameTreeNode @@ -127,7 +128,8 @@ class CONTENT_EXPORT Navigator : public base::RefCounted<Navigator> { // Signal |render_frame_host| that a navigation is ready to commit (the // response to the navigation request has been received). virtual void CommitNavigation(FrameTreeNode* frame_tree_node, - const NavigationBeforeCommitInfo& info) {} + ResourceResponse* response, + scoped_ptr<StreamHandle> body); // PlzNavigate // Cancel a NavigationRequest for |frame_tree_node|. Called when diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc index c74358b..340507b 100644 --- a/content/browser/frame_host/navigator_impl.cc +++ b/content/browser/frame_host/navigator_impl.cc @@ -9,7 +9,6 @@ #include "base/time/time.h" #include "content/browser/frame_host/frame_tree.h" #include "content/browser/frame_host/frame_tree_node.h" -#include "content/browser/frame_host/navigation_before_commit_info.h" #include "content/browser/frame_host/navigation_controller_impl.h" #include "content/browser/frame_host/navigation_entry_impl.h" #include "content/browser/frame_host/navigation_request.h" @@ -30,6 +29,7 @@ #include "content/public/browser/navigation_details.h" #include "content/public/browser/page_navigator.h" #include "content/public/browser/render_view_host.h" +#include "content/public/browser/stream_handle.h" #include "content/public/common/bindings_policy.h" #include "content/public/common/content_client.h" #include "content/public/common/content_switches.h" @@ -730,33 +730,24 @@ void NavigatorImpl::OnBeginNavigation( } // PlzNavigate -void NavigatorImpl::CommitNavigation( - FrameTreeNode* frame_tree_node, - const NavigationBeforeCommitInfo& info) { +void NavigatorImpl::CommitNavigation(FrameTreeNode* frame_tree_node, + ResourceResponse* response, + scoped_ptr<StreamHandle> body) { CHECK(CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableBrowserSideNavigation)); NavigationRequest* navigation_request = navigation_request_map_.get(frame_tree_node->frame_tree_node_id()); DCHECK(navigation_request); - // Ignores navigation commits if the request ID doesn't match the current - // active request. - if (navigation_request->navigation_request_id() != - info.navigation_request_id) { - return; - } - - // Update the navigation url. - navigation_request->common_params().url = info.navigation_url; - // Select an appropriate renderer to commit the navigation. RenderFrameHostImpl* render_frame_host = frame_tree_node->render_manager()->GetFrameHostForNavigation( - info.navigation_url, navigation_request->common_params().transition); + navigation_request->common_params().url, + navigation_request->common_params().transition); CheckWebUIRendererDoesNotDisplayNormalURL( render_frame_host, navigation_request->common_params().url); - render_frame_host->CommitNavigation(info.stream_url, + render_frame_host->CommitNavigation(response, body.Pass(), navigation_request->common_params(), navigation_request->commit_params()); } @@ -765,11 +756,6 @@ void NavigatorImpl::CommitNavigation( void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) { CHECK(CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableBrowserSideNavigation)); - NavigationRequest* navigation_request = - navigation_request_map_.get(frame_tree_node->frame_tree_node_id()); - if (!navigation_request) - return; - navigation_request->CancelNavigation(); navigation_request_map_.erase(frame_tree_node->frame_tree_node_id()); } @@ -812,7 +798,7 @@ bool NavigatorImpl::RequestNavigation( FrameMsg_Navigate_Type::Value navigation_type = GetNavigationType(controller_->GetBrowserContext(), entry, reload_type); scoped_ptr<NavigationRequest> navigation_request(new NavigationRequest( - frame_tree_node_id, + frame_tree_node, CommonNavigationParams(entry.GetURL(), entry.GetReferrer(), entry.GetTransitionType(), @@ -827,17 +813,12 @@ bool NavigatorImpl::RequestNavigation( // TODO(clamy): Check if navigations are blocked and if so store the // parameters. - // If there is an ongoing request it must be canceled. - NavigationRequest* current_request = - navigation_request_map_.get(frame_tree_node_id); - if (current_request) { - current_request->CancelNavigation(); - } - + // If there is an ongoing request, replace it. navigation_request_map_.set(frame_tree_node_id, navigation_request.Pass()); if (frame_tree_node->current_frame_host()->IsRenderFrameLive()) { // TODO(clamy): send a RequestNavigation IPC. + NOTIMPLEMENTED(); return true; } diff --git a/content/browser/frame_host/navigator_impl.h b/content/browser/frame_host/navigator_impl.h index 7c1a10d..f5c09ba 100644 --- a/content/browser/frame_host/navigator_impl.h +++ b/content/browser/frame_host/navigator_impl.h @@ -76,9 +76,9 @@ class CONTENT_EXPORT NavigatorImpl : public Navigator { FrameTreeNode* frame_tree_node, const FrameHostMsg_BeginNavigation_Params& params, const CommonNavigationParams& common_params) override; - virtual void CommitNavigation( - FrameTreeNode* frame_tree_node, - const NavigationBeforeCommitInfo& info) override; + virtual void CommitNavigation(FrameTreeNode* frame_tree_node, + ResourceResponse* response, + scoped_ptr<StreamHandle> body) override; virtual void LogResourceRequestTime( base::TimeTicks timestamp, const GURL& url) override; virtual void CancelNavigation(FrameTreeNode* frame_tree_node) override; diff --git a/content/browser/frame_host/navigator_impl_unittest.cc b/content/browser/frame_host/navigator_impl_unittest.cc index e406515..e9b5452 100644 --- a/content/browser/frame_host/navigator_impl_unittest.cc +++ b/content/browser/frame_host/navigator_impl_unittest.cc @@ -5,7 +5,6 @@ #include "base/command_line.h" #include "base/test/histogram_tester.h" #include "base/time/time.h" -#include "content/browser/frame_host/navigation_before_commit_info.h" #include "content/browser/frame_host/navigation_controller_impl.h" #include "content/browser/frame_host/navigation_entry_impl.h" #include "content/browser/frame_host/navigation_request.h" @@ -15,6 +14,7 @@ #include "content/browser/frame_host/render_frame_host_manager.h" #include "content/browser/site_instance_impl.h" #include "content/common/navigation_params.h" +#include "content/public/browser/stream_handle.h" #include "content/public/common/content_switches.h" #include "content/public/common/url_constants.h" #include "content/public/common/url_utils.h" @@ -25,6 +25,47 @@ namespace content { +namespace { + +// Mocked out stream handle to commit the navigation with. +class TestStreamHandle : public StreamHandle { + public: + TestStreamHandle() : url_("test:stream") {} + + virtual const GURL& GetURL() override { + return url_; + } + + virtual const GURL& GetOriginalURL() override { + NOTREACHED(); + return original_url_; + } + + virtual const std::string& GetMimeType() override { + NOTREACHED(); + return mime_type_; + } + + virtual scoped_refptr<net::HttpResponseHeaders> + GetResponseHeaders() override { + NOTREACHED(); + return NULL; + } + + virtual void AddCloseListener(const base::Closure& callback) override { + NOTREACHED(); + } + + private: + GURL url_; + GURL original_url_; + std::string mime_type_; + + DISALLOW_COPY_AND_ASSIGN(TestStreamHandle); +}; + +} + class NavigatorTest : public RenderViewHostImplTestHarness { public: @@ -76,7 +117,6 @@ TEST_F(NavigatorTest, BrowserSideNavigationBeginNavigation) { const GURL kUrl1("http://www.google.com/"); const GURL kUrl2("http://www.chromium.org/"); const GURL kUrl3("http://www.gmail.com/"); - const int64 kFirstNavRequestID = 1; contents()->NavigateAndCommit(kUrl1); @@ -99,7 +139,6 @@ TEST_F(NavigatorTest, BrowserSideNavigationBeginNavigation) { EXPECT_EQ(kUrl1, subframe_request->info_for_test()->first_party_for_cookies); EXPECT_FALSE(subframe_request->info_for_test()->is_main_frame); EXPECT_TRUE(subframe_request->info_for_test()->parent_is_main_frame); - EXPECT_EQ(kFirstNavRequestID, subframe_request->navigation_request_id()); FrameTreeNode* main_frame_node = contents()->GetMainFrame()->frame_tree_node(); @@ -113,13 +152,11 @@ TEST_F(NavigatorTest, BrowserSideNavigationBeginNavigation) { EXPECT_EQ(kUrl3, main_request->info_for_test()->first_party_for_cookies); EXPECT_TRUE(main_request->info_for_test()->is_main_frame); EXPECT_FALSE(main_request->info_for_test()->parent_is_main_frame); - EXPECT_EQ(kFirstNavRequestID + 1, main_request->navigation_request_id()); } // PlzNavigate: Test that RequestNavigation creates a NavigationRequest and that // RenderFrameHost is not modified when the navigation commits. -TEST_F(NavigatorTest, - BrowserSideNavigationRequestNavigationNoLiveRenderer) { +TEST_F(NavigatorTest, BrowserSideNavigationRequestNavigationNoLiveRenderer) { const GURL kUrl("http://www.google.com/"); EnableBrowserSideNavigation(); @@ -132,10 +169,9 @@ TEST_F(NavigatorTest, RenderFrameHostImpl* rfh = main_test_rfh(); // Now commit the same url. - NavigationBeforeCommitInfo commit_info; - commit_info.navigation_url = kUrl; - commit_info.navigation_request_id = main_request->navigation_request_id(); - node->navigator()->CommitNavigation(node, commit_info); + scoped_refptr<ResourceResponse> response(new ResourceResponse); + node->navigator()->CommitNavigation( + node, response.get(), scoped_ptr<StreamHandle>(new TestStreamHandle)); main_request = GetNavigationRequestForFrameTreeNode(node); // The main RFH should not have been changed, and the renderer should have @@ -147,8 +183,7 @@ TEST_F(NavigatorTest, // PlzNavigate: Test that a new RenderFrameHost is created when doing a cross // site navigation. -TEST_F(NavigatorTest, - BrowserSideNavigationCrossSiteNavigation) { +TEST_F(NavigatorTest, BrowserSideNavigationCrossSiteNavigation) { const GURL kUrl1("http://www.chromium.org/"); const GURL kUrl2("http://www.google.com/"); @@ -165,10 +200,9 @@ TEST_F(NavigatorTest, NavigationRequest* main_request = GetNavigationRequestForFrameTreeNode(node); ASSERT_TRUE(main_request); - NavigationBeforeCommitInfo commit_info; - commit_info.navigation_url = kUrl2; - commit_info.navigation_request_id = main_request->navigation_request_id(); - node->navigator()->CommitNavigation(node, commit_info); + scoped_refptr<ResourceResponse> response(new ResourceResponse); + node->navigator()->CommitNavigation( + node, response.get(), scoped_ptr<StreamHandle>(new TestStreamHandle)); RenderFrameHostImpl* pending_rfh = node->render_manager()->pending_frame_host(); ASSERT_TRUE(pending_rfh); @@ -177,14 +211,9 @@ TEST_F(NavigatorTest, EXPECT_TRUE(pending_rfh->render_view_host()->IsRenderViewLive()); } -// PlzNavigate: Test that a navigation commit is ignored if another request has -// been issued in the meantime. -// TODO(carlosk): add checks to assert that the cancel call was sent to -// ResourceDispatcherHost in the IO thread by extending -// ResourceDispatcherHostDelegate (like in cross_site_transfer_browsertest.cc -// and plugin_browsertest.cc). -TEST_F(NavigatorTest, - BrowserSideNavigationIgnoreStaleNavigationCommit) { +// PlzNavigate: Test that a navigation is cancelled if another request has been +// issued in the meantime. +TEST_F(NavigatorTest, BrowserSideNavigationReplacePendingNavigation) { const GURL kUrl0("http://www.wikipedia.org/"); const GURL kUrl0_site = SiteInstance::GetSiteForURL(browser_context(), kUrl0); const GURL kUrl1("http://www.chromium.org/"); @@ -197,33 +226,25 @@ TEST_F(NavigatorTest, EnableBrowserSideNavigation(); EXPECT_EQ(kUrl0_site, main_test_rfh()->GetSiteInstance()->GetSiteURL()); - // Request navigation to the 1st URL and gather data. + // Request navigation to the 1st URL. SendRequestNavigation(node, kUrl1); main_test_rfh()->SendBeginNavigationWithURL(kUrl1); NavigationRequest* request1 = GetNavigationRequestForFrameTreeNode(node); ASSERT_TRUE(request1); - int64 request_id1 = request1->navigation_request_id(); + EXPECT_EQ(kUrl1, request1->common_params().url); - // Request navigation to the 2nd URL and gather more data. + // Request navigation to the 2nd URL; the NavigationRequest must have been + // replaced by a new one with a different URL. SendRequestNavigation(node, kUrl2); main_test_rfh()->SendBeginNavigationWithURL(kUrl2); NavigationRequest* request2 = GetNavigationRequestForFrameTreeNode(node); ASSERT_TRUE(request2); - int64 request_id2 = request2->navigation_request_id(); - EXPECT_NE(request_id1, request_id2); - - // Confirms that a stale commit is ignored by the Navigator. - NavigationBeforeCommitInfo nbc_info; - nbc_info.navigation_url = kUrl1; - nbc_info.navigation_request_id = request_id1; - node->navigator()->CommitNavigation(node, nbc_info); - EXPECT_FALSE(node->render_manager()->pending_frame_host()); - EXPECT_EQ(kUrl0_site, main_test_rfh()->GetSiteInstance()->GetSiteURL()); + EXPECT_EQ(kUrl2, request2->common_params().url); - // Confirms that a valid, request-matching commit is correctly processed. - nbc_info.navigation_url = kUrl2; - nbc_info.navigation_request_id = request_id2; - node->navigator()->CommitNavigation(node, nbc_info); + // Confirm that the commit corresonds to the new request. + scoped_refptr<ResourceResponse> response(new ResourceResponse); + node->navigator()->CommitNavigation( + node, response.get(), scoped_ptr<StreamHandle>(new TestStreamHandle)); RenderFrameHostImpl* pending_rfh = node->render_manager()->pending_frame_host(); ASSERT_TRUE(pending_rfh); diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc index 5a486b1..cd2d1a0 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc @@ -50,6 +50,7 @@ #include "content/public/browser/desktop_notification_delegate.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_widget_host_view.h" +#include "content/public/browser/stream_handle.h" #include "content/public/browser/user_metrics.h" #include "content/public/common/content_constants.h" #include "content/public/common/content_switches.h" @@ -1379,16 +1380,21 @@ void RenderFrameHostImpl::NotificationClosed(int notification_id) { // PlzNavigate void RenderFrameHostImpl::CommitNavigation( - const GURL& stream_url, + ResourceResponse* response, + scoped_ptr<StreamHandle> body, const CommonNavigationParams& common_params, const CommitNavigationParams& commit_params) { // TODO(clamy): Check if we have to add security checks for the browser plugin // guests. Send(new FrameMsg_CommitNavigation( - routing_id_, stream_url, common_params, commit_params)); + routing_id_, response->head, body->GetURL(), + common_params, commit_params)); // TODO(clamy): Check if we should start the throbber for non javascript urls // here. + + // TODO(davidben): Retain |body| on behalf of the renderer, until the renderer + // is done with it. } void RenderFrameHostImpl::PlatformNotificationPermissionRequestDone( diff --git a/content/browser/frame_host/render_frame_host_impl.h b/content/browser/frame_host/render_frame_host_impl.h index 028fb28..698cae02 100644 --- a/content/browser/frame_host/render_frame_host_impl.h +++ b/content/browser/frame_host/render_frame_host_impl.h @@ -54,6 +54,7 @@ class RenderFrameProxyHost; class RenderProcessHost; class RenderViewHostImpl; class RenderWidgetHostImpl; +class StreamHandle; class TimeoutMonitor; struct CommitNavigationParams; struct ContextMenuParams; @@ -61,6 +62,7 @@ struct CommonNavigationParams; struct GlobalRequestID; struct Referrer; struct RequestNavigationParams; +struct ResourceResponse; struct ShowDesktopNotificationHostMsgParams; struct TransitionLayerData; @@ -347,7 +349,8 @@ class CONTENT_EXPORT RenderFrameHostImpl // PlzNavigate: Indicates that a navigation is ready to commit and can be // handled by this RenderFrame. - void CommitNavigation(const GURL& stream_url, + void CommitNavigation(ResourceResponse* response, + scoped_ptr<StreamHandle> body, const CommonNavigationParams& common_params, const CommitNavigationParams& commit_params); diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc index c9fc8cb..edd5723 100644 --- a/content/browser/frame_host/render_frame_host_manager.cc +++ b/content/browser/frame_host/render_frame_host_manager.cc @@ -15,7 +15,6 @@ #include "content/browser/frame_host/cross_site_transferring_request.h" #include "content/browser/frame_host/debug_urls.h" #include "content/browser/frame_host/interstitial_page_impl.h" -#include "content/browser/frame_host/navigation_before_commit_info.h" #include "content/browser/frame_host/navigation_controller_impl.h" #include "content/browser/frame_host/navigation_entry_impl.h" #include "content/browser/frame_host/navigator.h" |