| Index: content/renderer/render_frame_impl.cc
|
| diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
|
| index 1d26e5940b95c7e048e0c00402c46f46e2753403..aad0d97de1a2f681b29d7297c02ef772cdba89c4 100644
|
| --- a/content/renderer/render_frame_impl.cc
|
| +++ b/content/renderer/render_frame_impl.cc
|
| @@ -52,7 +52,7 @@
|
| #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/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"
|
| @@ -66,7 +66,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"
|
| @@ -757,6 +756,29 @@ bool CanUseWebMediaPlayerImpl(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, int32_t handle_commit_id) override {
|
| + rfi_->ReceiveNavigationDataPipeConsumerHandle(
|
| + std::move(data_consumer_handle), 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
|
| @@ -997,6 +1019,10 @@ RenderFrameImpl::RenderFrameImpl(const CreateParams& params)
|
| media_player_delegate_(NULL),
|
| is_using_lofi_(false),
|
| is_pasting_(false),
|
| + 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));
|
| @@ -4677,17 +4703,62 @@ 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;
|
| + // // 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;
|
| +
|
| + // NavigateInternal(common_params, StartNavigationParams(), request_params,
|
| + // std::move(stream_override));
|
| + 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, int32_t handle_commit_id) {
|
| + latest_handle_ = std::move(data_consumer_handle);
|
| + 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->stream_url = navigation_stream_url;
|
| + stream_override->response = navigation_response;
|
| +
|
| + NavigateInternal(navigation_common_params,
|
| + StartNavigationParams(),
|
| + navigation_request_params,
|
| + std::move(stream_override));
|
| + // no_sync_needed ? mojo::ScopedDataPipeConsumerHandle() : std::move(latest_handle_));
|
| + } 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.
|
| }
|
|
|
| void RenderFrameImpl::OnFailedNavigation(
|
| @@ -6042,6 +6113,10 @@ void RenderFrameImpl::RegisterMojoServices() {
|
| base::Bind(&ImageDownloaderImpl::CreateMojoService,
|
| base::Unretained(this)));
|
| }
|
| +
|
| + GetServiceRegistry()->AddService<DataPipeConsumerHandleReceiver>(
|
| + base::Bind(&DataPipeConsumerHandleReceiverImpl::CreateService,
|
| + base::Unretained(this)));
|
| }
|
|
|
| template <typename Interface>
|
|
|