| Index: content/renderer/render_frame_impl.cc
|
| diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
|
| index 15debe08d42f079668b8ce8611a0b4961d34cff4..3eeb02859d7e26701c4e38ab72e99670e94b18f6 100644
|
| --- a/content/renderer/render_frame_impl.cc
|
| +++ b/content/renderer/render_frame_impl.cc
|
| @@ -52,8 +52,8 @@
|
| #include "content/common/frame_messages.h"
|
| #include "content/common/frame_replication_state.h"
|
| #include "content/common/input_messages.h"
|
| -#include "content/common/navigation_params.h"
|
| #include "content/common/page_messages.h"
|
| +#include "content/common/render_frame_setup.mojom.h"
|
| #include "content/common/savable_subframe.h"
|
| #include "content/common/service_worker/service_worker_types.h"
|
| #include "content/common/site_isolation_policy.h"
|
| @@ -67,7 +67,6 @@
|
| #include "content/public/common/context_menu_params.h"
|
| #include "content/public/common/isolated_world_ids.h"
|
| #include "content/public/common/page_state.h"
|
| -#include "content/public/common/resource_response.h"
|
| #include "content/public/common/url_constants.h"
|
| #include "content/public/common/url_utils.h"
|
| #include "content/public/renderer/browser_plugin_delegate.h"
|
| @@ -782,6 +781,34 @@ bool UseWebMediaPlayerImpl(blink::WebMediaPlayer::LoadType load_type,
|
| }
|
| #endif // defined(OS_ANDROID)
|
|
|
| +class DataPipeConsumerHandleReceiverImpl
|
| + : public DataPipeConsumerHandleReceiver {
|
| + public:
|
| + static void CreateService(
|
| + RenderFrameImpl* rfi,
|
| + mojo::InterfaceRequest<DataPipeConsumerHandleReceiver> request) {
|
| + // No leak here because of mojo::StrongBinding usage.
|
| + new DataPipeConsumerHandleReceiverImpl(rfi, std::move(request));
|
| + }
|
| +
|
| + void ReceiveDataPipeConsumerHandle(
|
| + mojo::ScopedDataPipeConsumerHandle data_consumer_handle,
|
| + int browser_request_id,
|
| + int32_t handle_commit_id) override {
|
| + rfi_->ReceiveNavigationDataPipeConsumerHandle(
|
| + std::move(data_consumer_handle), browser_request_id, handle_commit_id);
|
| + }
|
| +
|
| + private:
|
| + DataPipeConsumerHandleReceiverImpl(
|
| + RenderFrameImpl* rfi,
|
| + mojo::InterfaceRequest<DataPipeConsumerHandleReceiver> request)
|
| + : rfi_(rfi), binding_(this, std::move(request)) {}
|
| +
|
| + RenderFrameImpl* rfi_;
|
| + mojo::StrongBinding<DataPipeConsumerHandleReceiver> binding_;
|
| +};
|
| +
|
| } // namespace
|
|
|
| // static
|
| @@ -1016,6 +1043,11 @@ RenderFrameImpl::RenderFrameImpl(const CreateParams& params)
|
| media_player_delegate_(NULL),
|
| is_using_lofi_(false),
|
| is_pasting_(false),
|
| + latest_browser_request_id_(-1),
|
| + latest_handle_commit_id_(-1),
|
| + handle_render_thread_(nullptr),
|
| + latest_navigation_commit_id_(-1),
|
| + navigation_render_thread_(nullptr),
|
| weak_factory_(this) {
|
| std::pair<RoutingIDFrameMap::iterator, bool> result =
|
| g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this));
|
| @@ -4614,17 +4646,66 @@ void RenderFrameImpl::OnCommitNavigation(
|
| const ResourceResponseHead& response,
|
| const GURL& stream_url,
|
| const CommonNavigationParams& common_params,
|
| - const RequestNavigationParams& request_params) {
|
| + const RequestNavigationParams& request_params,
|
| + int32_t navigation_commit_id) {
|
| CHECK(IsBrowserSideNavigationEnabled());
|
| - // This will override the url requested by the WebURLLoader, as well as
|
| - // provide it with the response to the request.
|
| - scoped_ptr<StreamOverrideParameters> stream_override(
|
| - new StreamOverrideParameters());
|
| - stream_override->stream_url = stream_url;
|
| - stream_override->response = response;
|
| + navigation_response_ = response;
|
| + navigation_stream_url_ = stream_url;
|
| + navigation_common_params_ = common_params;
|
| + navigation_request_params_ = request_params;
|
|
|
| - NavigateInternal(common_params, StartNavigationParams(), request_params,
|
| - std::move(stream_override));
|
| + latest_navigation_commit_id_ = navigation_commit_id;
|
| + navigation_render_thread_ = RenderThreadImpl::current();
|
| + NavigateIfIPCSynched(navigation_commit_id < 0);
|
| +}
|
| +
|
| +// PlzNavigate
|
| +void RenderFrameImpl::ReceiveNavigationDataPipeConsumerHandle(
|
| + mojo::ScopedDataPipeConsumerHandle data_consumer_handle,
|
| + int browser_request_id,
|
| + int32_t handle_commit_id) {
|
| + latest_handle_ = std::move(data_consumer_handle);
|
| + latest_browser_request_id_ = browser_request_id;
|
| + latest_handle_commit_id_ = handle_commit_id;
|
| + handle_render_thread_ = RenderThreadImpl::current();
|
| + RenderFrameImpl::NavigateIfIPCSynched(false);
|
| +}
|
| +
|
| +void RenderFrameImpl::NavigateIfIPCSynched(bool no_sync_needed) {
|
| + if (no_sync_needed ||
|
| + latest_navigation_commit_id_ == latest_handle_commit_id_) {
|
| + LOG(ERROR) << "*** NAVIGATED with commit id: "
|
| + << latest_navigation_commit_id_ << " ***";
|
| + if (navigation_render_thread_ != nullptr &&
|
| + handle_render_thread_ != nullptr &&
|
| + navigation_render_thread_ != handle_render_thread_) {
|
| + LOG(ERROR) << "*** AHHHHHHHHHHHHHHH! THREADS DIFFER !!!! ***";
|
| + }
|
| + // This will override the url requested by the WebURLLoader, as well as
|
| + // provide it with the response to the request.
|
| + scoped_ptr<StreamOverrideParameters> stream_override(
|
| + new StreamOverrideParameters());
|
| + stream_override->response = navigation_response_;
|
| + stream_override->mojo_handle = no_sync_needed
|
| + ? mojo::ScopedDataPipeConsumerHandle()
|
| + : std::move(latest_handle_);
|
| + stream_override->browser_request_id = latest_browser_request_id_;
|
| +
|
| + NavigateInternal(navigation_common_params_, StartNavigationParams(),
|
| + navigation_request_params_, std::move(stream_override));
|
| + } else {
|
| + LOG(ERROR) << "*** Still waiting on the "
|
| + << (latest_navigation_commit_id_ < latest_handle_commit_id_
|
| + ? "NAVIGATION"
|
| + : "HANDLE")
|
| + << " commit id to navigate";
|
| + LOG(ERROR) << "*** latest_navigation_commit_id_ : "
|
| + << latest_navigation_commit_id_;
|
| + LOG(ERROR) << "*** latest_handle_commit_id_ : "
|
| + << latest_handle_commit_id_;
|
| + }
|
| + // TODO: throw away the extra stored data when a newer handle of the other
|
| + // type is received.
|
| }
|
|
|
| // PlzNavigate
|
| @@ -6011,6 +6092,10 @@ void RenderFrameImpl::RegisterMojoServices() {
|
| GetServiceRegistry()->AddService(base::Bind(
|
| &ImageDownloaderImpl::CreateMojoService, base::Unretained(this)));
|
| }
|
| +
|
| + GetServiceRegistry()->AddService<DataPipeConsumerHandleReceiver>(
|
| + base::Bind(&DataPipeConsumerHandleReceiverImpl::CreateService,
|
| + base::Unretained(this)));
|
| }
|
|
|
| template <typename Interface>
|
|
|