Commit 98d9c94e authored by Kunihiko Sakamoto's avatar Kunihiko Sakamoto Committed by Commit Bot

Use CrossVariantMojoReceiver in CreateWebBundleSubresourceLoaderFactory

It's safer, and easier to understand.

Bug: 1082020
Change-Id: I8bd3de0692f66ce53897bd86587f86800394650f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2305819Reviewed-by: default avatarTsuyoshi Horo <horo@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#789809}
parent 4a4dcd8b
......@@ -70,9 +70,7 @@ class WebBundleLoader : public GarbageCollected<WebBundleLoader>,
void DidStartLoadingResponseBody(BytesConsumer& consumer) override {
DCHECK(pending_factory_receiver_);
CreateWebBundleSubresourceLoaderFactory(
mojo::PendingReceiver<network::mojom::URLLoaderFactory>(
pending_factory_receiver_.PassPipe()),
consumer.DrainAsDataPipe());
std::move(pending_factory_receiver_), consumer.DrainAsDataPipe());
// TODO(crbug.com/1082020): Set |failed_| to true on metadata parse error,
// so that "error" event is dispatched.
}
......@@ -88,8 +86,7 @@ class WebBundleLoader : public GarbageCollected<WebBundleLoader>,
// with an empty bundle body so that requests to
// |pending_factory_receiver_| are processed (and fail).
CreateWebBundleSubresourceLoaderFactory(
mojo::PendingReceiver<network::mojom::URLLoaderFactory>(
pending_factory_receiver_.PassPipe()),
std::move(pending_factory_receiver_),
mojo::ScopedDataPipeConsumerHandle());
}
failed_ = true;
......
......@@ -405,7 +405,8 @@ void CreateFactoryOnBackground(
} // namespace
void CreateWebBundleSubresourceLoaderFactory(
mojo::PendingReceiver<network::mojom::URLLoaderFactory> factory_receiver,
CrossVariantMojoReceiver<network::mojom::URLLoaderFactoryInterfaceBase>
factory_receiver,
mojo::ScopedDataPipeConsumerHandle bundle_body) {
auto task_runner = base::ThreadPool::CreateSequencedTaskRunner(
{base::TaskPriority::USER_VISIBLE,
......
......@@ -6,7 +6,8 @@
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_LOADER_FETCH_URL_LOADER_WEB_BUNDLE_SUBRESOURCE_LOADER_H_
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "services/network/public/mojom/url_loader_factory.mojom-forward.h"
#include "services/network/public/mojom/url_loader_factory.mojom-shared.h"
#include "third_party/blink/public/platform/cross_variant_mojo_util.h"
#include "third_party/blink/renderer/platform/platform_export.h"
namespace blink {
......@@ -14,7 +15,8 @@ namespace blink {
// Creates a network::mojom::URLLoaderFactory that can load resources from a
// WebBundle, and binds it to |factory_receiver|.
PLATFORM_EXPORT void CreateWebBundleSubresourceLoaderFactory(
mojo::PendingReceiver<network::mojom::URLLoaderFactory> factory_receiver,
CrossVariantMojoReceiver<network::mojom::URLLoaderFactoryInterfaceBase>
factory_receiver,
mojo::ScopedDataPipeConsumerHandle bundle_body);
} // namespace blink
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment