Move SharedURLLoaderFactory to services/network/public/cpp/
We want to move |SharedURLLoaderFactory| to make it available to consumers that doesn't depend on content/. This CL is mostly mechanical changes and doesn't affect behaviors. TBR=jam@chromium.org (for fairly mechanical changes of callsites in chrome/). Bug: 796425 Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo Change-Id: Icdaccce5323c7585e26f742e9d0433f0fa1aea4b Reviewed-on: https://chromium-review.googlesource.com/959617 Reviewed-by: Chong Zhang <chongz@chromium.org> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Commit-Queue: Chong Zhang <chongz@chromium.org> Cr-Commit-Position: refs/heads/master@{#542876}
This commit is contained in:
chrome
browser
captive_portal
ui
renderer
content
browser
appcache
download
loader
navigation_url_loader_network_service.ccprefetch_url_loader.ccprefetch_url_loader.hprefetch_url_loader_service.ccprefetch_url_loader_service.h
network_service_restart_browsertest.ccstorage_partition_impl.ccstorage_partition_impl.hurl_loader_factory_getter.ccurl_loader_factory_getter.hweb_package
mock_signed_exchange_handler.ccmock_signed_exchange_handler.hsigned_exchange_cert_fetcher.ccsigned_exchange_cert_fetcher.hsigned_exchange_handler.ccsigned_exchange_handler.hsigned_exchange_url_loader_factory_for_non_network_service.ccsigned_exchange_url_loader_factory_for_non_network_service.hweb_package_loader.ccweb_package_loader.hweb_package_prefetch_handler.ccweb_package_prefetch_handler.hweb_package_request_handler.ccweb_package_request_handler.h
common
single_request_url_loader_factory.ccsingle_request_url_loader_factory.hthrottling_url_loader.ccthrottling_url_loader.hthrottling_url_loader_unittest.ccurl_loader_factory_bundle.ccurl_loader_factory_bundle.hweak_wrapper_shared_url_loader_factory.ccweak_wrapper_shared_url_loader_factory.hwrapper_shared_url_loader_factory.ccwrapper_shared_url_loader_factory.h
public
browser
common
renderer
test
renderer
fetchers
loader
child_url_loader_factory_bundle.ccchild_url_loader_factory_bundle.hresource_dispatcher.ccresource_dispatcher.hsync_load_context.ccsync_load_context.htracked_child_url_loader_factory_bundle.cctracked_child_url_loader_factory_bundle.hweb_url_loader_impl.ccweb_url_loader_impl.hweb_url_loader_impl_unittest.cc
render_frame_impl.ccrender_frame_impl.hservice_worker
service_worker_fetch_context_impl.ccservice_worker_fetch_context_impl.hservice_worker_network_provider.ccservice_worker_network_provider.hservice_worker_provider_context.ccservice_worker_provider_context.hservice_worker_provider_context_unittest.ccservice_worker_subresource_loader.ccservice_worker_subresource_loader.hservice_worker_subresource_loader_unittest.ccworker_fetch_context_impl.ccworker_fetch_context_impl.h
services/network/public/cpp
@@ -14,8 +14,8 @@
|
|||||||
#include "components/captive_portal/captive_portal_detector.h"
|
#include "components/captive_portal/captive_portal_detector.h"
|
||||||
#include "components/keyed_service/core/keyed_service.h"
|
#include "components/keyed_service/core/keyed_service.h"
|
||||||
#include "components/prefs/pref_member.h"
|
#include "components/prefs/pref_member.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
|
||||||
#include "net/base/backoff_entry.h"
|
#include "net/base/backoff_entry.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
#include "url/gurl.h"
|
#include "url/gurl.h"
|
||||||
|
|
||||||
class Profile;
|
class Profile;
|
||||||
@@ -163,7 +163,7 @@ class CaptivePortalService : public KeyedService {
|
|||||||
|
|
||||||
State state_;
|
State state_;
|
||||||
|
|
||||||
scoped_refptr<content::SharedURLLoaderFactory> shared_url_loader_factory_;
|
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory_;
|
||||||
|
|
||||||
// Detector for checking active network for a portal state.
|
// Detector for checking active network for a portal state.
|
||||||
std::unique_ptr<captive_portal::CaptivePortalDetector>
|
std::unique_ptr<captive_portal::CaptivePortalDetector>
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
#include <Cocoa/Cocoa.h>
|
#include <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
#include "base/memory/ref_counted.h"
|
#include "base/memory/ref_counted.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
|
|
||||||
class AccountAvatarFetcherBridge;
|
class AccountAvatarFetcherBridge;
|
||||||
@class CredentialItemButton;
|
@class CredentialItemButton;
|
||||||
@@ -17,12 +17,12 @@ class GURL;
|
|||||||
// Handles retrieving avatar images for credential items.
|
// Handles retrieving avatar images for credential items.
|
||||||
@interface AccountAvatarFetcherManager : NSObject {
|
@interface AccountAvatarFetcherManager : NSObject {
|
||||||
std::vector<std::unique_ptr<AccountAvatarFetcherBridge>> bridges_;
|
std::vector<std::unique_ptr<AccountAvatarFetcherBridge>> bridges_;
|
||||||
scoped_refptr<content::SharedURLLoaderFactory> loaderFactory_;
|
scoped_refptr<network::SharedURLLoaderFactory> loaderFactory_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initializes a manager with the specified URL loader factory.
|
// Initializes a manager with the specified URL loader factory.
|
||||||
- (id)initWithLoaderFactory:
|
- (id)initWithLoaderFactory:
|
||||||
(scoped_refptr<content::SharedURLLoaderFactory>)loaderFactory;
|
(scoped_refptr<network::SharedURLLoaderFactory>)loaderFactory;
|
||||||
|
|
||||||
// Retrieves the image located at |avatarURL| and updates |view| if successful.
|
// Retrieves the image located at |avatarURL| and updates |view| if successful.
|
||||||
- (void)fetchAvatar:(const GURL&)avatarURL forView:(CredentialItemButton*)view;
|
- (void)fetchAvatar:(const GURL&)avatarURL forView:(CredentialItemButton*)view;
|
||||||
|
@@ -55,7 +55,7 @@ void AccountAvatarFetcherBridge::UpdateAvatar(const gfx::ImageSkia& image) {
|
|||||||
@implementation AccountAvatarFetcherManager
|
@implementation AccountAvatarFetcherManager
|
||||||
|
|
||||||
- (id)initWithLoaderFactory:
|
- (id)initWithLoaderFactory:
|
||||||
(scoped_refptr<content::SharedURLLoaderFactory>)loaderFactory {
|
(scoped_refptr<network::SharedURLLoaderFactory>)loaderFactory {
|
||||||
if ((self = [super init])) {
|
if ((self = [super init])) {
|
||||||
loaderFactory_ = std::move(loaderFactory);
|
loaderFactory_ = std::move(loaderFactory);
|
||||||
}
|
}
|
||||||
|
@@ -82,7 +82,7 @@ class AccountChooserViewControllerTest : public CocoaTest,
|
|||||||
// PasswordPromptBridgeInterface:
|
// PasswordPromptBridgeInterface:
|
||||||
void PerformClose() override;
|
void PerformClose() override;
|
||||||
PasswordDialogController* GetDialogController() override;
|
PasswordDialogController* GetDialogController() override;
|
||||||
scoped_refptr<content::SharedURLLoaderFactory> GetURLLoaderFactory()
|
scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory()
|
||||||
const override;
|
const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -122,7 +122,7 @@ AccountChooserViewControllerTest::GetDialogController() {
|
|||||||
return &dialog_controller_;
|
return &dialog_controller_;
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_refptr<content::SharedURLLoaderFactory>
|
scoped_refptr<network::SharedURLLoaderFactory>
|
||||||
AccountChooserViewControllerTest::GetURLLoaderFactory() const {
|
AccountChooserViewControllerTest::GetURLLoaderFactory() const {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@@ -41,7 +41,7 @@ class AutoSigninPromptViewControllerTest : public PasswordPromptBridgeInterface,
|
|||||||
// PasswordPromptBridgeInterface:
|
// PasswordPromptBridgeInterface:
|
||||||
void PerformClose() override;
|
void PerformClose() override;
|
||||||
PasswordDialogController* GetDialogController() override;
|
PasswordDialogController* GetDialogController() override;
|
||||||
scoped_refptr<content::SharedURLLoaderFactory> GetURLLoaderFactory()
|
scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory()
|
||||||
const override;
|
const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -71,7 +71,7 @@ AutoSigninPromptViewControllerTest::GetDialogController() {
|
|||||||
return &dialog_controller_;
|
return &dialog_controller_;
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_refptr<content::SharedURLLoaderFactory>
|
scoped_refptr<network::SharedURLLoaderFactory>
|
||||||
AutoSigninPromptViewControllerTest::GetURLLoaderFactory() const {
|
AutoSigninPromptViewControllerTest::GetURLLoaderFactory() const {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
#ifndef CHROME_BROWSER_UI_COCOA_PASSWORDS_PASSWORD_PROMPT_BRIDGE_INTERFACE_H_
|
#ifndef CHROME_BROWSER_UI_COCOA_PASSWORDS_PASSWORD_PROMPT_BRIDGE_INTERFACE_H_
|
||||||
#define CHROME_BROWSER_UI_COCOA_PASSWORDS_PASSWORD_PROMPT_BRIDGE_INTERFACE_H_
|
#define CHROME_BROWSER_UI_COCOA_PASSWORDS_PASSWORD_PROMPT_BRIDGE_INTERFACE_H_
|
||||||
|
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
|
|
||||||
class PasswordDialogController;
|
class PasswordDialogController;
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ class PasswordPromptBridgeInterface {
|
|||||||
virtual PasswordDialogController* GetDialogController() = 0;
|
virtual PasswordDialogController* GetDialogController() = 0;
|
||||||
|
|
||||||
// Returns the URL loader factory for fetching the avatars.
|
// Returns the URL loader factory for fetching the avatars.
|
||||||
virtual scoped_refptr<content::SharedURLLoaderFactory> GetURLLoaderFactory()
|
virtual scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory()
|
||||||
const = 0;
|
const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -36,7 +36,7 @@ class PasswordPromptViewBridge : public AccountChooserPrompt,
|
|||||||
// PasswordPromptBridgeInterface:
|
// PasswordPromptBridgeInterface:
|
||||||
void PerformClose() override;
|
void PerformClose() override;
|
||||||
PasswordDialogController* GetDialogController() override;
|
PasswordDialogController* GetDialogController() override;
|
||||||
scoped_refptr<content::SharedURLLoaderFactory> GetURLLoaderFactory()
|
scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory()
|
||||||
const override;
|
const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -58,7 +58,7 @@ PasswordPromptViewBridge::GetDialogController() {
|
|||||||
return controller_;
|
return controller_;
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_refptr<content::SharedURLLoaderFactory>
|
scoped_refptr<network::SharedURLLoaderFactory>
|
||||||
PasswordPromptViewBridge::GetURLLoaderFactory() const {
|
PasswordPromptViewBridge::GetURLLoaderFactory() const {
|
||||||
return content::BrowserContext::GetDefaultStoragePartition(
|
return content::BrowserContext::GetDefaultStoragePartition(
|
||||||
Profile::FromBrowserContext(web_contents_->GetBrowserContext()))
|
Profile::FromBrowserContext(web_contents_->GetBrowserContext()))
|
||||||
|
@@ -85,7 +85,7 @@ class DevToolsDataSource : public content::URLDataSource {
|
|||||||
using GotDataCallback = content::URLDataSource::GotDataCallback;
|
using GotDataCallback = content::URLDataSource::GotDataCallback;
|
||||||
|
|
||||||
explicit DevToolsDataSource(
|
explicit DevToolsDataSource(
|
||||||
scoped_refptr<content::SharedURLLoaderFactory> url_loader_factory)
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory)
|
||||||
: url_loader_factory_(std::move(url_loader_factory)) {}
|
: url_loader_factory_(std::move(url_loader_factory)) {}
|
||||||
|
|
||||||
// content::URLDataSource implementation.
|
// content::URLDataSource implementation.
|
||||||
@@ -144,7 +144,7 @@ class DevToolsDataSource : public content::URLDataSource {
|
|||||||
DISALLOW_COPY_AND_ASSIGN(PendingRequest);
|
DISALLOW_COPY_AND_ASSIGN(PendingRequest);
|
||||||
};
|
};
|
||||||
|
|
||||||
scoped_refptr<content::SharedURLLoaderFactory> url_loader_factory_;
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
|
||||||
std::list<PendingRequest> pending_requests_;
|
std::list<PendingRequest> pending_requests_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(DevToolsDataSource);
|
DISALLOW_COPY_AND_ASSIGN(DevToolsDataSource);
|
||||||
|
@@ -39,6 +39,7 @@
|
|||||||
#include "ipc/ipc_message_macros.h"
|
#include "ipc/ipc_message_macros.h"
|
||||||
#include "net/base/net_errors.h"
|
#include "net/base/net_errors.h"
|
||||||
#include "net/traffic_annotation/network_traffic_annotation.h"
|
#include "net/traffic_annotation/network_traffic_annotation.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
#include "third_party/WebKit/public/common/associated_interfaces/associated_interface_provider.h"
|
#include "third_party/WebKit/public/common/associated_interfaces/associated_interface_provider.h"
|
||||||
#include "third_party/WebKit/public/common/associated_interfaces/associated_interface_registry.h"
|
#include "third_party/WebKit/public/common/associated_interfaces/associated_interface_registry.h"
|
||||||
#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
|
#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
|
||||||
|
@@ -12,7 +12,6 @@
|
|||||||
#include "content/browser/appcache/appcache_url_loader_request.h"
|
#include "content/browser/appcache/appcache_url_loader_request.h"
|
||||||
#include "content/browser/url_loader_factory_getter.h"
|
#include "content/browser/url_loader_factory_getter.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
|
||||||
#include "mojo/public/cpp/bindings/binding.h"
|
#include "mojo/public/cpp/bindings/binding.h"
|
||||||
#include "mojo/public/cpp/bindings/binding_set.h"
|
#include "mojo/public/cpp/bindings/binding_set.h"
|
||||||
#include "mojo/public/cpp/bindings/interface_ptr.h"
|
#include "mojo/public/cpp/bindings/interface_ptr.h"
|
||||||
@@ -20,6 +19,7 @@
|
|||||||
#include "net/url_request/url_request.h"
|
#include "net/url_request/url_request.h"
|
||||||
#include "services/network/public/cpp/resource_request.h"
|
#include "services/network/public/cpp/resource_request.h"
|
||||||
#include "services/network/public/cpp/resource_response.h"
|
#include "services/network/public/cpp/resource_response.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
|
@@ -216,7 +216,7 @@ DownloadManagerImpl::UniqueUrlDownloadHandlerPtr BeginResourceDownload(
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory;
|
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory;
|
||||||
if (params->url().SchemeIs(url::kBlobScheme)) {
|
if (params->url().SchemeIs(url::kBlobScheme)) {
|
||||||
network::mojom::URLLoaderFactoryPtrInfo url_loader_factory_ptr_info;
|
network::mojom::URLLoaderFactoryPtrInfo url_loader_factory_ptr_info;
|
||||||
storage::BlobURLLoaderFactory::Create(
|
storage::BlobURLLoaderFactory::Create(
|
||||||
|
@@ -11,8 +11,8 @@
|
|||||||
#include "content/browser/download/resource_downloader.h"
|
#include "content/browser/download/resource_downloader.h"
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
#include "content/public/common/content_features.h"
|
#include "content/public/common/content_features.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
|
||||||
#include "services/network/public/cpp/features.h"
|
#include "services/network/public/cpp/features.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
namespace {
|
namespace {
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
#include "content/browser/download/download_utils.h"
|
#include "content/browser/download/download_utils.h"
|
||||||
|
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
|
|
||||||
namespace network {
|
namespace network {
|
||||||
struct ResourceResponseHead;
|
struct ResourceResponseHead;
|
||||||
@@ -65,7 +65,7 @@ std::unique_ptr<ResourceDownloader> ResourceDownloader::BeginDownload(
|
|||||||
base::WeakPtr<UrlDownloadHandler::Delegate> delegate,
|
base::WeakPtr<UrlDownloadHandler::Delegate> delegate,
|
||||||
std::unique_ptr<download::DownloadUrlParameters> params,
|
std::unique_ptr<download::DownloadUrlParameters> params,
|
||||||
std::unique_ptr<network::ResourceRequest> request,
|
std::unique_ptr<network::ResourceRequest> request,
|
||||||
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory,
|
||||||
const GURL& site_url,
|
const GURL& site_url,
|
||||||
const GURL& tab_url,
|
const GURL& tab_url,
|
||||||
const GURL& tab_referrer_url,
|
const GURL& tab_referrer_url,
|
||||||
@@ -124,7 +124,7 @@ ResourceDownloader::ResourceDownloader(
|
|||||||
ResourceDownloader::~ResourceDownloader() = default;
|
ResourceDownloader::~ResourceDownloader() = default;
|
||||||
|
|
||||||
void ResourceDownloader::Start(
|
void ResourceDownloader::Start(
|
||||||
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory,
|
||||||
std::unique_ptr<download::DownloadUrlParameters> download_url_parameters,
|
std::unique_ptr<download::DownloadUrlParameters> download_url_parameters,
|
||||||
bool is_parallel_request) {
|
bool is_parallel_request) {
|
||||||
callback_ = download_url_parameters->callback();
|
callback_ = download_url_parameters->callback();
|
||||||
|
@@ -12,9 +12,11 @@
|
|||||||
#include "services/network/public/cpp/resource_request.h"
|
#include "services/network/public/cpp/resource_request.h"
|
||||||
#include "services/network/public/mojom/url_loader.mojom.h"
|
#include "services/network/public/mojom/url_loader.mojom.h"
|
||||||
|
|
||||||
namespace content {
|
namespace network {
|
||||||
|
|
||||||
class SharedURLLoaderFactory;
|
class SharedURLLoaderFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace content {
|
||||||
|
|
||||||
// Class for handing the download of a url.
|
// Class for handing the download of a url.
|
||||||
class ResourceDownloader : public UrlDownloadHandler,
|
class ResourceDownloader : public UrlDownloadHandler,
|
||||||
@@ -25,7 +27,7 @@ class ResourceDownloader : public UrlDownloadHandler,
|
|||||||
base::WeakPtr<UrlDownloadHandler::Delegate> delegate,
|
base::WeakPtr<UrlDownloadHandler::Delegate> delegate,
|
||||||
std::unique_ptr<download::DownloadUrlParameters> download_url_parameters,
|
std::unique_ptr<download::DownloadUrlParameters> download_url_parameters,
|
||||||
std::unique_ptr<network::ResourceRequest> request,
|
std::unique_ptr<network::ResourceRequest> request,
|
||||||
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory,
|
||||||
const GURL& site_url,
|
const GURL& site_url,
|
||||||
const GURL& tab_url,
|
const GURL& tab_url,
|
||||||
const GURL& tab_referrer_url,
|
const GURL& tab_referrer_url,
|
||||||
@@ -65,7 +67,7 @@ class ResourceDownloader : public UrlDownloadHandler,
|
|||||||
private:
|
private:
|
||||||
// Helper method to start the network request.
|
// Helper method to start the network request.
|
||||||
void Start(
|
void Start(
|
||||||
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory,
|
||||||
std::unique_ptr<download::DownloadUrlParameters> download_url_parameters,
|
std::unique_ptr<download::DownloadUrlParameters> download_url_parameters,
|
||||||
bool is_parallel_request);
|
bool is_parallel_request);
|
||||||
|
|
||||||
|
@@ -578,7 +578,7 @@ class NavigationURLLoaderNetworkService::URLLoaderRequestController
|
|||||||
// TODO(https://crbug.com/796425): We temporarily wrap raw
|
// TODO(https://crbug.com/796425): We temporarily wrap raw
|
||||||
// mojom::URLLoaderFactory pointers into SharedURLLoaderFactory. Need to
|
// mojom::URLLoaderFactory pointers into SharedURLLoaderFactory. Need to
|
||||||
// further refactor the factory getters to avoid this.
|
// further refactor the factory getters to avoid this.
|
||||||
scoped_refptr<SharedURLLoaderFactory> factory;
|
scoped_refptr<network::SharedURLLoaderFactory> factory;
|
||||||
DCHECK_EQ(handlers_.size(), handler_index_);
|
DCHECK_EQ(handlers_.size(), handler_index_);
|
||||||
if (resource_request_->url.SchemeIs(url::kBlobScheme)) {
|
if (resource_request_->url.SchemeIs(url::kBlobScheme)) {
|
||||||
factory = base::MakeRefCounted<WeakWrapperSharedURLLoaderFactory>(
|
factory = base::MakeRefCounted<WeakWrapperSharedURLLoaderFactory>(
|
||||||
|
@@ -7,9 +7,9 @@
|
|||||||
#include "base/feature_list.h"
|
#include "base/feature_list.h"
|
||||||
#include "content/browser/web_package/web_package_prefetch_handler.h"
|
#include "content/browser/web_package/web_package_prefetch_handler.h"
|
||||||
#include "content/public/common/content_features.h"
|
#include "content/public/common/content_features.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
|
||||||
#include "net/url_request/url_request_context_getter.h"
|
#include "net/url_request/url_request_context_getter.h"
|
||||||
#include "services/network/public/cpp/features.h"
|
#include "services/network/public/cpp/features.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ PrefetchURLLoader::PrefetchURLLoader(
|
|||||||
const network::ResourceRequest& resource_request,
|
const network::ResourceRequest& resource_request,
|
||||||
network::mojom::URLLoaderClientPtr client,
|
network::mojom::URLLoaderClientPtr client,
|
||||||
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
|
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
|
||||||
scoped_refptr<SharedURLLoaderFactory> network_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory,
|
||||||
URLLoaderThrottlesGetter url_loader_throttles_getter,
|
URLLoaderThrottlesGetter url_loader_throttles_getter,
|
||||||
ResourceContext* resource_context,
|
ResourceContext* resource_context,
|
||||||
scoped_refptr<net::URLRequestContextGetter> request_context_getter)
|
scoped_refptr<net::URLRequestContextGetter> request_context_getter)
|
||||||
|
@@ -19,10 +19,13 @@ namespace net {
|
|||||||
class URLRequestContextGetter;
|
class URLRequestContextGetter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace network {
|
||||||
|
class SharedURLLoaderFactory;
|
||||||
|
}
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
|
|
||||||
class ResourceContext;
|
class ResourceContext;
|
||||||
class SharedURLLoaderFactory;
|
|
||||||
class URLLoaderThrottle;
|
class URLLoaderThrottle;
|
||||||
class WebPackagePrefetchHandler;
|
class WebPackagePrefetchHandler;
|
||||||
|
|
||||||
@@ -46,7 +49,7 @@ class CONTENT_EXPORT PrefetchURLLoader
|
|||||||
const network::ResourceRequest& resource_request,
|
const network::ResourceRequest& resource_request,
|
||||||
network::mojom::URLLoaderClientPtr client,
|
network::mojom::URLLoaderClientPtr client,
|
||||||
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
|
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
|
||||||
scoped_refptr<SharedURLLoaderFactory> network_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory,
|
||||||
URLLoaderThrottlesGetter url_loader_throttles_getter,
|
URLLoaderThrottlesGetter url_loader_throttles_getter,
|
||||||
ResourceContext* resource_context,
|
ResourceContext* resource_context,
|
||||||
scoped_refptr<net::URLRequestContextGetter> request_context_getter);
|
scoped_refptr<net::URLRequestContextGetter> request_context_getter);
|
||||||
@@ -85,7 +88,7 @@ class CONTENT_EXPORT PrefetchURLLoader
|
|||||||
|
|
||||||
void OnNetworkConnectionError();
|
void OnNetworkConnectionError();
|
||||||
|
|
||||||
scoped_refptr<SharedURLLoaderFactory> network_loader_factory_;
|
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory_;
|
||||||
|
|
||||||
// For the actual request.
|
// For the actual request.
|
||||||
network::mojom::URLLoaderPtr loader_;
|
network::mojom::URLLoaderPtr loader_;
|
||||||
|
@@ -12,11 +12,11 @@
|
|||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
#include "content/public/common/content_client.h"
|
#include "content/public/common/content_client.h"
|
||||||
#include "content/public/common/resource_type.h"
|
#include "content/public/common/resource_type.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
|
||||||
#include "content/public/common/url_loader_throttle.h"
|
#include "content/public/common/url_loader_throttle.h"
|
||||||
#include "mojo/public/cpp/bindings/strong_binding.h"
|
#include "mojo/public/cpp/bindings/strong_binding.h"
|
||||||
#include "net/url_request/url_request_context_getter.h"
|
#include "net/url_request/url_request_context_getter.h"
|
||||||
#include "services/network/public/cpp/features.h"
|
#include "services/network/public/cpp/features.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ void PrefetchURLLoaderService::CreateLoaderAndStart(
|
|||||||
const network::ResourceRequest& resource_request,
|
const network::ResourceRequest& resource_request,
|
||||||
network::mojom::URLLoaderClientPtr client,
|
network::mojom::URLLoaderClientPtr client,
|
||||||
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
|
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
|
||||||
scoped_refptr<SharedURLLoaderFactory> network_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory,
|
||||||
int frame_tree_node_id) {
|
int frame_tree_node_id) {
|
||||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||||
DCHECK_EQ(RESOURCE_TYPE_PREFETCH, resource_request.resource_type);
|
DCHECK_EQ(RESOURCE_TYPE_PREFETCH, resource_request.resource_type);
|
||||||
|
@@ -18,10 +18,13 @@ namespace net {
|
|||||||
class URLRequestContextGetter;
|
class URLRequestContextGetter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace network {
|
||||||
|
class SharedURLLoaderFactory;
|
||||||
|
}
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
|
|
||||||
class ResourceContext;
|
class ResourceContext;
|
||||||
class SharedURLLoaderFactory;
|
|
||||||
class URLLoaderFactoryGetter;
|
class URLLoaderFactoryGetter;
|
||||||
class URLLoaderThrottle;
|
class URLLoaderThrottle;
|
||||||
|
|
||||||
@@ -59,7 +62,7 @@ class CONTENT_EXPORT PrefetchURLLoaderService final
|
|||||||
const network::ResourceRequest& resource_request,
|
const network::ResourceRequest& resource_request,
|
||||||
network::mojom::URLLoaderClientPtr client,
|
network::mojom::URLLoaderClientPtr client,
|
||||||
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
|
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
|
||||||
scoped_refptr<SharedURLLoaderFactory> network_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory,
|
||||||
int frame_tree_node_id = -1);
|
int frame_tree_node_id = -1);
|
||||||
|
|
||||||
// Register a callback that is fired right before a prefetch load is started
|
// Register a callback that is fired right before a prefetch load is started
|
||||||
|
@@ -30,7 +30,7 @@ namespace content {
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
using SharedURLLoaderFactoryGetterCallback =
|
using SharedURLLoaderFactoryGetterCallback =
|
||||||
base::OnceCallback<scoped_refptr<SharedURLLoaderFactory>()>;
|
base::OnceCallback<scoped_refptr<network::SharedURLLoaderFactory>()>;
|
||||||
|
|
||||||
network::mojom::NetworkContextPtr CreateNetworkContext() {
|
network::mojom::NetworkContextPtr CreateNetworkContext() {
|
||||||
network::mojom::NetworkContextPtr network_context;
|
network::mojom::NetworkContextPtr network_context;
|
||||||
@@ -91,15 +91,16 @@ int LoadBasicRequestOnUIThread(
|
|||||||
return simple_loader->NetError();
|
return simple_loader->NetError();
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_refptr<SharedURLLoaderFactory> GetSharedFactoryOnIOThread(
|
scoped_refptr<network::SharedURLLoaderFactory> GetSharedFactoryOnIOThread(
|
||||||
SharedURLLoaderFactoryGetterCallback shared_url_loader_factory_getter) {
|
SharedURLLoaderFactoryGetterCallback shared_url_loader_factory_getter) {
|
||||||
scoped_refptr<SharedURLLoaderFactory> shared_factory;
|
scoped_refptr<network::SharedURLLoaderFactory> shared_factory;
|
||||||
base::RunLoop run_loop;
|
base::RunLoop run_loop;
|
||||||
BrowserThread::PostTaskAndReply(
|
BrowserThread::PostTaskAndReply(
|
||||||
BrowserThread::IO, FROM_HERE,
|
BrowserThread::IO, FROM_HERE,
|
||||||
base::BindOnce(
|
base::BindOnce(
|
||||||
[](SharedURLLoaderFactoryGetterCallback getter,
|
[](SharedURLLoaderFactoryGetterCallback getter,
|
||||||
scoped_refptr<SharedURLLoaderFactory>* shared_factory_ptr) {
|
scoped_refptr<network::SharedURLLoaderFactory>*
|
||||||
|
shared_factory_ptr) {
|
||||||
*shared_factory_ptr = std::move(getter).Run();
|
*shared_factory_ptr = std::move(getter).Run();
|
||||||
},
|
},
|
||||||
std::move(shared_url_loader_factory_getter),
|
std::move(shared_url_loader_factory_getter),
|
||||||
@@ -109,24 +110,25 @@ scoped_refptr<SharedURLLoaderFactory> GetSharedFactoryOnIOThread(
|
|||||||
return shared_factory;
|
return shared_factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_refptr<SharedURLLoaderFactory> GetSharedFactoryOnIOThread(
|
scoped_refptr<network::SharedURLLoaderFactory> GetSharedFactoryOnIOThread(
|
||||||
URLLoaderFactoryGetter* url_loader_factory_getter) {
|
URLLoaderFactoryGetter* url_loader_factory_getter) {
|
||||||
return GetSharedFactoryOnIOThread(
|
return GetSharedFactoryOnIOThread(
|
||||||
base::BindOnce(&URLLoaderFactoryGetter::GetNetworkFactory,
|
base::BindOnce(&URLLoaderFactoryGetter::GetNetworkFactory,
|
||||||
base::Unretained(url_loader_factory_getter)));
|
base::Unretained(url_loader_factory_getter)));
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_refptr<SharedURLLoaderFactory> GetSharedFactoryOnIOThread(
|
scoped_refptr<network::SharedURLLoaderFactory> GetSharedFactoryOnIOThread(
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> info) {
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo> info) {
|
||||||
return GetSharedFactoryOnIOThread(
|
return GetSharedFactoryOnIOThread(base::BindOnce(
|
||||||
base::BindOnce(&SharedURLLoaderFactory::Create, std::move(info)));
|
&network::SharedURLLoaderFactory::Create, std::move(info)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReleaseOnIOThread(scoped_refptr<SharedURLLoaderFactory> shared_factory) {
|
void ReleaseOnIOThread(
|
||||||
|
scoped_refptr<network::SharedURLLoaderFactory> shared_factory) {
|
||||||
BrowserThread::PostTask(
|
BrowserThread::PostTask(
|
||||||
BrowserThread::IO, FROM_HERE,
|
BrowserThread::IO, FROM_HERE,
|
||||||
base::BindOnce(
|
base::BindOnce(
|
||||||
[](scoped_refptr<SharedURLLoaderFactory> factory) {
|
[](scoped_refptr<network::SharedURLLoaderFactory> factory) {
|
||||||
factory = nullptr;
|
factory = nullptr;
|
||||||
},
|
},
|
||||||
std::move(shared_factory)));
|
std::move(shared_factory)));
|
||||||
@@ -343,7 +345,7 @@ IN_PROC_BROWSER_TEST_F(NetworkServiceRestartBrowserTest,
|
|||||||
scoped_refptr<URLLoaderFactoryGetter> url_loader_factory_getter =
|
scoped_refptr<URLLoaderFactoryGetter> url_loader_factory_getter =
|
||||||
partition->url_loader_factory_getter();
|
partition->url_loader_factory_getter();
|
||||||
|
|
||||||
scoped_refptr<SharedURLLoaderFactory> shared_factory =
|
scoped_refptr<network::SharedURLLoaderFactory> shared_factory =
|
||||||
GetSharedFactoryOnIOThread(url_loader_factory_getter.get());
|
GetSharedFactoryOnIOThread(url_loader_factory_getter.get());
|
||||||
EXPECT_EQ(net::OK,
|
EXPECT_EQ(net::OK,
|
||||||
LoadBasicRequestOnIOThread(shared_factory.get(), GetTestURL()));
|
LoadBasicRequestOnIOThread(shared_factory.get(), GetTestURL()));
|
||||||
@@ -372,7 +374,7 @@ IN_PROC_BROWSER_TEST_F(NetworkServiceRestartBrowserTest,
|
|||||||
StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>(
|
StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>(
|
||||||
BrowserContext::GetDefaultStoragePartition(browser_context()));
|
BrowserContext::GetDefaultStoragePartition(browser_context()));
|
||||||
|
|
||||||
scoped_refptr<SharedURLLoaderFactory> shared_factory =
|
scoped_refptr<network::SharedURLLoaderFactory> shared_factory =
|
||||||
GetSharedFactoryOnIOThread(partition->url_loader_factory_getter().get());
|
GetSharedFactoryOnIOThread(partition->url_loader_factory_getter().get());
|
||||||
|
|
||||||
EXPECT_EQ(net::OK,
|
EXPECT_EQ(net::OK,
|
||||||
@@ -402,7 +404,7 @@ IN_PROC_BROWSER_TEST_F(NetworkServiceRestartBrowserTest,
|
|||||||
std::make_unique<ShellBrowserContext>(true, nullptr);
|
std::make_unique<ShellBrowserContext>(true, nullptr);
|
||||||
auto* partition = static_cast<StoragePartitionImpl*>(
|
auto* partition = static_cast<StoragePartitionImpl*>(
|
||||||
BrowserContext::GetDefaultStoragePartition(browser_context.get()));
|
BrowserContext::GetDefaultStoragePartition(browser_context.get()));
|
||||||
scoped_refptr<content::SharedURLLoaderFactory> shared_factory(
|
scoped_refptr<network::SharedURLLoaderFactory> shared_factory(
|
||||||
GetSharedFactoryOnIOThread(partition->url_loader_factory_getter().get()));
|
GetSharedFactoryOnIOThread(partition->url_loader_factory_getter().get()));
|
||||||
|
|
||||||
EXPECT_EQ(net::OK,
|
EXPECT_EQ(net::OK,
|
||||||
@@ -486,7 +488,7 @@ IN_PROC_BROWSER_TEST_F(NetworkServiceRestartBrowserTest,
|
|||||||
std::make_unique<ShellBrowserContext>(true, nullptr);
|
std::make_unique<ShellBrowserContext>(true, nullptr);
|
||||||
auto* partition =
|
auto* partition =
|
||||||
BrowserContext::GetDefaultStoragePartition(browser_context.get());
|
BrowserContext::GetDefaultStoragePartition(browser_context.get());
|
||||||
scoped_refptr<content::SharedURLLoaderFactory> factory(
|
scoped_refptr<network::SharedURLLoaderFactory> factory(
|
||||||
partition->GetURLLoaderFactoryForBrowserProcess());
|
partition->GetURLLoaderFactoryForBrowserProcess());
|
||||||
|
|
||||||
EXPECT_EQ(net::OK, LoadBasicRequestOnUIThread(factory.get(), GetTestURL()));
|
EXPECT_EQ(net::OK, LoadBasicRequestOnUIThread(factory.get(), GetTestURL()));
|
||||||
@@ -503,7 +505,7 @@ IN_PROC_BROWSER_TEST_F(NetworkServiceRestartBrowserTest,
|
|||||||
IN_PROC_BROWSER_TEST_F(NetworkServiceRestartBrowserTest, BrowserIOFactory) {
|
IN_PROC_BROWSER_TEST_F(NetworkServiceRestartBrowserTest, BrowserIOFactory) {
|
||||||
auto* partition =
|
auto* partition =
|
||||||
BrowserContext::GetDefaultStoragePartition(browser_context());
|
BrowserContext::GetDefaultStoragePartition(browser_context());
|
||||||
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory =
|
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory =
|
||||||
GetSharedFactoryOnIOThread(
|
GetSharedFactoryOnIOThread(
|
||||||
partition->GetURLLoaderFactoryForBrowserProcessIOThread());
|
partition->GetURLLoaderFactoryForBrowserProcessIOThread());
|
||||||
|
|
||||||
@@ -537,7 +539,7 @@ IN_PROC_BROWSER_TEST_F(NetworkServiceRestartBrowserTest,
|
|||||||
|
|
||||||
browser_context.reset();
|
browser_context.reset();
|
||||||
|
|
||||||
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory =
|
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory =
|
||||||
GetSharedFactoryOnIOThread(std::move(shared_url_loader_factory_info));
|
GetSharedFactoryOnIOThread(std::move(shared_url_loader_factory_info));
|
||||||
|
|
||||||
EXPECT_EQ(net::ERR_FAILED,
|
EXPECT_EQ(net::ERR_FAILED,
|
||||||
@@ -556,7 +558,7 @@ IN_PROC_BROWSER_TEST_F(NetworkServiceRestartBrowserTest,
|
|||||||
std::make_unique<ShellBrowserContext>(true, nullptr);
|
std::make_unique<ShellBrowserContext>(true, nullptr);
|
||||||
auto* partition =
|
auto* partition =
|
||||||
BrowserContext::GetDefaultStoragePartition(browser_context.get());
|
BrowserContext::GetDefaultStoragePartition(browser_context.get());
|
||||||
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory =
|
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory =
|
||||||
GetSharedFactoryOnIOThread(
|
GetSharedFactoryOnIOThread(
|
||||||
partition->GetURLLoaderFactoryForBrowserProcessIOThread());
|
partition->GetURLLoaderFactoryForBrowserProcessIOThread());
|
||||||
|
|
||||||
|
@@ -291,7 +291,7 @@ class StoragePartitionImpl::NetworkContextOwner {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class StoragePartitionImpl::URLLoaderFactoryForBrowserProcess
|
class StoragePartitionImpl::URLLoaderFactoryForBrowserProcess
|
||||||
: public SharedURLLoaderFactory {
|
: public network::SharedURLLoaderFactory {
|
||||||
public:
|
public:
|
||||||
explicit URLLoaderFactoryForBrowserProcess(
|
explicit URLLoaderFactoryForBrowserProcess(
|
||||||
StoragePartitionImpl* storage_partition)
|
StoragePartitionImpl* storage_partition)
|
||||||
@@ -316,7 +316,7 @@ class StoragePartitionImpl::URLLoaderFactoryForBrowserProcess
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SharedURLLoaderFactory implementation:
|
// SharedURLLoaderFactory implementation:
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> Clone() override {
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo> Clone() override {
|
||||||
NOTREACHED() << "This isn't supported. If you need a SharedURLLoaderFactory"
|
NOTREACHED() << "This isn't supported. If you need a SharedURLLoaderFactory"
|
||||||
" on the IO thread, get it from URLLoaderFactoryGetter.";
|
" on the IO thread, get it from URLLoaderFactoryGetter.";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -729,7 +729,7 @@ network::mojom::NetworkContext* StoragePartitionImpl::GetNetworkContext() {
|
|||||||
return network_context_.get();
|
return network_context_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_refptr<SharedURLLoaderFactory>
|
scoped_refptr<network::SharedURLLoaderFactory>
|
||||||
StoragePartitionImpl::GetURLLoaderFactoryForBrowserProcess() {
|
StoragePartitionImpl::GetURLLoaderFactoryForBrowserProcess() {
|
||||||
if (!shared_url_loader_factory_for_browser_process_) {
|
if (!shared_url_loader_factory_for_browser_process_) {
|
||||||
shared_url_loader_factory_for_browser_process_ =
|
shared_url_loader_factory_for_browser_process_ =
|
||||||
@@ -738,7 +738,7 @@ StoragePartitionImpl::GetURLLoaderFactoryForBrowserProcess() {
|
|||||||
return shared_url_loader_factory_for_browser_process_;
|
return shared_url_loader_factory_for_browser_process_;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo>
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
|
||||||
StoragePartitionImpl::GetURLLoaderFactoryForBrowserProcessIOThread() {
|
StoragePartitionImpl::GetURLLoaderFactoryForBrowserProcessIOThread() {
|
||||||
return url_loader_factory_getter_->GetNetworkFactoryInfo();
|
return url_loader_factory_getter_->GetNetworkFactoryInfo();
|
||||||
}
|
}
|
||||||
|
@@ -91,9 +91,9 @@ class CONTENT_EXPORT StoragePartitionImpl
|
|||||||
net::URLRequestContextGetter* GetURLRequestContext() override;
|
net::URLRequestContextGetter* GetURLRequestContext() override;
|
||||||
net::URLRequestContextGetter* GetMediaURLRequestContext() override;
|
net::URLRequestContextGetter* GetMediaURLRequestContext() override;
|
||||||
network::mojom::NetworkContext* GetNetworkContext() override;
|
network::mojom::NetworkContext* GetNetworkContext() override;
|
||||||
scoped_refptr<SharedURLLoaderFactory> GetURLLoaderFactoryForBrowserProcess()
|
scoped_refptr<network::SharedURLLoaderFactory>
|
||||||
override;
|
GetURLLoaderFactoryForBrowserProcess() override;
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo>
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
|
||||||
GetURLLoaderFactoryForBrowserProcessIOThread() override;
|
GetURLLoaderFactoryForBrowserProcessIOThread() override;
|
||||||
network::mojom::CookieManager* GetCookieManagerForBrowserProcess() override;
|
network::mojom::CookieManager* GetCookieManagerForBrowserProcess() override;
|
||||||
storage::QuotaManager* GetQuotaManager() override;
|
storage::QuotaManager* GetQuotaManager() override;
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/lazy_instance.h"
|
#include "base/lazy_instance.h"
|
||||||
#include "content/browser/storage_partition_impl.h"
|
#include "content/browser/storage_partition_impl.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
#include "services/network/public/mojom/network_service.mojom.h"
|
#include "services/network/public/mojom/network_service.mojom.h"
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
@@ -18,7 +18,7 @@ base::LazyInstance<URLLoaderFactoryGetter::GetNetworkFactoryCallback>::Leaky
|
|||||||
}
|
}
|
||||||
|
|
||||||
class URLLoaderFactoryGetter::URLLoaderFactoryForIOThreadInfo
|
class URLLoaderFactoryGetter::URLLoaderFactoryForIOThreadInfo
|
||||||
: public SharedURLLoaderFactoryInfo {
|
: public network::SharedURLLoaderFactoryInfo {
|
||||||
public:
|
public:
|
||||||
URLLoaderFactoryForIOThreadInfo() = default;
|
URLLoaderFactoryForIOThreadInfo() = default;
|
||||||
explicit URLLoaderFactoryForIOThreadInfo(
|
explicit URLLoaderFactoryForIOThreadInfo(
|
||||||
@@ -32,7 +32,7 @@ class URLLoaderFactoryGetter::URLLoaderFactoryForIOThreadInfo
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
// SharedURLLoaderFactoryInfo implementation.
|
// SharedURLLoaderFactoryInfo implementation.
|
||||||
scoped_refptr<SharedURLLoaderFactory> CreateFactory() override;
|
scoped_refptr<network::SharedURLLoaderFactory> CreateFactory() override;
|
||||||
|
|
||||||
scoped_refptr<URLLoaderFactoryGetter> factory_getter_;
|
scoped_refptr<URLLoaderFactoryGetter> factory_getter_;
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ class URLLoaderFactoryGetter::URLLoaderFactoryForIOThreadInfo
|
|||||||
};
|
};
|
||||||
|
|
||||||
class URLLoaderFactoryGetter::URLLoaderFactoryForIOThread
|
class URLLoaderFactoryGetter::URLLoaderFactoryForIOThread
|
||||||
: public SharedURLLoaderFactory {
|
: public network::SharedURLLoaderFactory {
|
||||||
public:
|
public:
|
||||||
explicit URLLoaderFactoryForIOThread(
|
explicit URLLoaderFactoryForIOThread(
|
||||||
scoped_refptr<URLLoaderFactoryGetter> factory_getter)
|
scoped_refptr<URLLoaderFactoryGetter> factory_getter)
|
||||||
@@ -72,7 +72,7 @@ class URLLoaderFactoryGetter::URLLoaderFactoryForIOThread
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SharedURLLoaderFactory implementation:
|
// SharedURLLoaderFactory implementation:
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> Clone() override {
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo> Clone() override {
|
||||||
NOTREACHED() << "This isn't supported. If you need a SharedURLLoaderFactory"
|
NOTREACHED() << "This isn't supported. If you need a SharedURLLoaderFactory"
|
||||||
" on the UI thread, get it from StoragePartition.";
|
" on the UI thread, get it from StoragePartition.";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -87,7 +87,7 @@ class URLLoaderFactoryGetter::URLLoaderFactoryForIOThread
|
|||||||
DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryForIOThread);
|
DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryForIOThread);
|
||||||
};
|
};
|
||||||
|
|
||||||
scoped_refptr<SharedURLLoaderFactory>
|
scoped_refptr<network::SharedURLLoaderFactory>
|
||||||
URLLoaderFactoryGetter::URLLoaderFactoryForIOThreadInfo::CreateFactory() {
|
URLLoaderFactoryGetter::URLLoaderFactoryForIOThreadInfo::CreateFactory() {
|
||||||
auto other = std::make_unique<URLLoaderFactoryForIOThreadInfo>();
|
auto other = std::make_unique<URLLoaderFactoryForIOThreadInfo>();
|
||||||
other->factory_getter_ = std::move(factory_getter_);
|
other->factory_getter_ = std::move(factory_getter_);
|
||||||
@@ -122,14 +122,14 @@ void URLLoaderFactoryGetter::OnStoragePartitionDestroyed() {
|
|||||||
partition_ = nullptr;
|
partition_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_refptr<SharedURLLoaderFactory>
|
scoped_refptr<network::SharedURLLoaderFactory>
|
||||||
URLLoaderFactoryGetter::GetNetworkFactory() {
|
URLLoaderFactoryGetter::GetNetworkFactory() {
|
||||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||||
return base::MakeRefCounted<URLLoaderFactoryForIOThread>(
|
return base::MakeRefCounted<URLLoaderFactoryForIOThread>(
|
||||||
base::WrapRefCounted(this));
|
base::WrapRefCounted(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo>
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
|
||||||
URLLoaderFactoryGetter::GetNetworkFactoryInfo() {
|
URLLoaderFactoryGetter::GetNetworkFactoryInfo() {
|
||||||
return std::make_unique<URLLoaderFactoryForIOThreadInfo>(
|
return std::make_unique<URLLoaderFactoryForIOThreadInfo>(
|
||||||
base::WrapRefCounted(this));
|
base::WrapRefCounted(this));
|
||||||
|
@@ -12,10 +12,13 @@
|
|||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
||||||
|
|
||||||
namespace content {
|
namespace network {
|
||||||
|
|
||||||
class SharedURLLoaderFactoryInfo;
|
class SharedURLLoaderFactoryInfo;
|
||||||
class SharedURLLoaderFactory;
|
class SharedURLLoaderFactory;
|
||||||
|
} // namespace network
|
||||||
|
|
||||||
|
namespace content {
|
||||||
|
|
||||||
class StoragePartitionImpl;
|
class StoragePartitionImpl;
|
||||||
|
|
||||||
// Holds on to URLLoaderFactory for a given StoragePartition and allows code
|
// Holds on to URLLoaderFactory for a given StoragePartition and allows code
|
||||||
@@ -39,12 +42,13 @@ class URLLoaderFactoryGetter
|
|||||||
// Called on the IO thread to get a shared wrapper to this
|
// Called on the IO thread to get a shared wrapper to this
|
||||||
// URLLoaderFactoryGetter, which can be used to access the URLLoaderFactory
|
// URLLoaderFactoryGetter, which can be used to access the URLLoaderFactory
|
||||||
// to the network service and supports auto-reconnect after crash.
|
// to the network service and supports auto-reconnect after crash.
|
||||||
CONTENT_EXPORT scoped_refptr<SharedURLLoaderFactory> GetNetworkFactory();
|
CONTENT_EXPORT scoped_refptr<network::SharedURLLoaderFactory>
|
||||||
|
GetNetworkFactory();
|
||||||
|
|
||||||
// Called on the UI thread to get an info that holds a reference to this
|
// Called on the UI thread to get an info that holds a reference to this
|
||||||
// URLLoaderFactoryGetter, which can be used to construct a similar
|
// URLLoaderFactoryGetter, which can be used to construct a similar
|
||||||
// SharedURLLoaderFactory as returned from |GetNetworkFactory()| on IO thread.
|
// SharedURLLoaderFactory as returned from |GetNetworkFactory()| on IO thread.
|
||||||
CONTENT_EXPORT std::unique_ptr<SharedURLLoaderFactoryInfo>
|
CONTENT_EXPORT std::unique_ptr<network::SharedURLLoaderFactoryInfo>
|
||||||
GetNetworkFactoryInfo();
|
GetNetworkFactoryInfo();
|
||||||
|
|
||||||
// Called on the IO thread. Will clone the internal factory to the network
|
// Called on the IO thread. Will clone the internal factory to the network
|
||||||
|
@@ -52,7 +52,7 @@ std::unique_ptr<SignedExchangeHandler> MockSignedExchangeHandlerFactory::Create(
|
|||||||
std::unique_ptr<net::SourceStream> body,
|
std::unique_ptr<net::SourceStream> body,
|
||||||
ExchangeHeadersCallback headers_callback,
|
ExchangeHeadersCallback headers_callback,
|
||||||
url::Origin request_initiator,
|
url::Origin request_initiator,
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
||||||
URLLoaderThrottlesGetter url_loader_throttles_getter) {
|
URLLoaderThrottlesGetter url_loader_throttles_getter) {
|
||||||
return std::make_unique<MockSignedExchangeHandler>(
|
return std::make_unique<MockSignedExchangeHandler>(
|
||||||
error_, request_url_, mime_type_, response_headers_, std::move(body),
|
error_, request_url_, mime_type_, response_headers_, std::move(body),
|
||||||
|
@@ -50,7 +50,7 @@ class MockSignedExchangeHandlerFactory final
|
|||||||
std::unique_ptr<net::SourceStream> body,
|
std::unique_ptr<net::SourceStream> body,
|
||||||
ExchangeHeadersCallback headers_callback,
|
ExchangeHeadersCallback headers_callback,
|
||||||
url::Origin request_initiator,
|
url::Origin request_initiator,
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
||||||
URLLoaderThrottlesGetter url_loader_throttles_getter) override;
|
URLLoaderThrottlesGetter url_loader_throttles_getter) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -8,12 +8,12 @@
|
|||||||
#include "base/strings/string_piece.h"
|
#include "base/strings/string_piece.h"
|
||||||
#include "content/common/throttling_url_loader.h"
|
#include "content/common/throttling_url_loader.h"
|
||||||
#include "content/public/common/resource_type.h"
|
#include "content/public/common/resource_type.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
|
||||||
#include "content/public/common/url_loader_throttle.h"
|
#include "content/public/common/url_loader_throttle.h"
|
||||||
#include "ipc/ipc_message.h"
|
#include "ipc/ipc_message.h"
|
||||||
#include "mojo/public/cpp/system/simple_watcher.h"
|
#include "mojo/public/cpp/system/simple_watcher.h"
|
||||||
#include "net/base/load_flags.h"
|
#include "net/base/load_flags.h"
|
||||||
#include "net/http/http_status_code.h"
|
#include "net/http/http_status_code.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ bool Consume3Bytes(base::StringPiece* data, uint32_t* out) {
|
|||||||
// static
|
// static
|
||||||
std::unique_ptr<SignedExchangeCertFetcher>
|
std::unique_ptr<SignedExchangeCertFetcher>
|
||||||
SignedExchangeCertFetcher::CreateAndStart(
|
SignedExchangeCertFetcher::CreateAndStart(
|
||||||
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory,
|
||||||
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
|
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
|
||||||
const GURL& cert_url,
|
const GURL& cert_url,
|
||||||
url::Origin request_initiator,
|
url::Origin request_initiator,
|
||||||
@@ -155,7 +155,7 @@ SignedExchangeCertFetcher::GetCertChainFromMessage(base::StringPiece message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SignedExchangeCertFetcher::SignedExchangeCertFetcher(
|
SignedExchangeCertFetcher::SignedExchangeCertFetcher(
|
||||||
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory,
|
||||||
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
|
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
|
||||||
const GURL& cert_url,
|
const GURL& cert_url,
|
||||||
url::Origin request_initiator,
|
url::Origin request_initiator,
|
||||||
|
@@ -21,13 +21,16 @@ namespace net {
|
|||||||
class X509Certificate;
|
class X509Certificate;
|
||||||
} // namespace net
|
} // namespace net
|
||||||
|
|
||||||
|
namespace network {
|
||||||
|
class SharedURLLoaderFactory;
|
||||||
|
} // namespace network
|
||||||
|
|
||||||
namespace mojo {
|
namespace mojo {
|
||||||
class SimpleWatcher;
|
class SimpleWatcher;
|
||||||
} // namespace mojo
|
} // namespace mojo
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
|
|
||||||
class SharedURLLoaderFactory;
|
|
||||||
class ThrottlingURLLoader;
|
class ThrottlingURLLoader;
|
||||||
class URLLoaderThrottle;
|
class URLLoaderThrottle;
|
||||||
|
|
||||||
@@ -43,7 +46,7 @@ class CONTENT_EXPORT SignedExchangeCertFetcher
|
|||||||
// with null. If the returned fetcher is destructed before the |callback| is
|
// with null. If the returned fetcher is destructed before the |callback| is
|
||||||
// called, the request will be canceled and the |callback| will no be called.
|
// called, the request will be canceled and the |callback| will no be called.
|
||||||
static std::unique_ptr<SignedExchangeCertFetcher> CreateAndStart(
|
static std::unique_ptr<SignedExchangeCertFetcher> CreateAndStart(
|
||||||
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory,
|
||||||
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
|
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
|
||||||
const GURL& cert_url,
|
const GURL& cert_url,
|
||||||
url::Origin request_initiator,
|
url::Origin request_initiator,
|
||||||
@@ -68,7 +71,7 @@ class CONTENT_EXPORT SignedExchangeCertFetcher
|
|||||||
static base::ScopedClosureRunner SetMaxCertSizeForTest(size_t max_cert_size);
|
static base::ScopedClosureRunner SetMaxCertSizeForTest(size_t max_cert_size);
|
||||||
|
|
||||||
SignedExchangeCertFetcher(
|
SignedExchangeCertFetcher(
|
||||||
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory,
|
||||||
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
|
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
|
||||||
const GURL& cert_url,
|
const GURL& cert_url,
|
||||||
url::Origin request_initiator,
|
url::Origin request_initiator,
|
||||||
@@ -96,7 +99,7 @@ class CONTENT_EXPORT SignedExchangeCertFetcher
|
|||||||
mojo::ScopedDataPipeConsumerHandle body) override;
|
mojo::ScopedDataPipeConsumerHandle body) override;
|
||||||
void OnComplete(const network::URLLoaderCompletionStatus& status) override;
|
void OnComplete(const network::URLLoaderCompletionStatus& status) override;
|
||||||
|
|
||||||
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory_;
|
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory_;
|
||||||
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles_;
|
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles_;
|
||||||
std::unique_ptr<network::ResourceRequest> resource_request_;
|
std::unique_ptr<network::ResourceRequest> resource_request_;
|
||||||
CertificateCallback callback_;
|
CertificateCallback callback_;
|
||||||
|
@@ -11,7 +11,6 @@
|
|||||||
#include "content/browser/web_package/signed_exchange_header.h"
|
#include "content/browser/web_package/signed_exchange_header.h"
|
||||||
#include "content/browser/web_package/signed_exchange_signature_verifier.h"
|
#include "content/browser/web_package/signed_exchange_signature_verifier.h"
|
||||||
#include "content/public/common/content_features.h"
|
#include "content/public/common/content_features.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
|
||||||
#include "content/public/common/url_loader_throttle.h"
|
#include "content/public/common/url_loader_throttle.h"
|
||||||
#include "mojo/public/cpp/system/string_data_pipe_producer.h"
|
#include "mojo/public/cpp/system/string_data_pipe_producer.h"
|
||||||
#include "net/base/io_buffer.h"
|
#include "net/base/io_buffer.h"
|
||||||
@@ -25,6 +24,7 @@
|
|||||||
#include "net/url_request/url_request_context_getter.h"
|
#include "net/url_request/url_request_context_getter.h"
|
||||||
#include "services/network/public/cpp/features.h"
|
#include "services/network/public/cpp/features.h"
|
||||||
#include "services/network/public/cpp/resource_response.h"
|
#include "services/network/public/cpp/resource_response.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
#include "services/network/public/cpp/url_loader_completion_status.h"
|
#include "services/network/public/cpp/url_loader_completion_status.h"
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
@@ -51,7 +51,7 @@ SignedExchangeHandler::SignedExchangeHandler(
|
|||||||
std::unique_ptr<net::SourceStream> body,
|
std::unique_ptr<net::SourceStream> body,
|
||||||
ExchangeHeadersCallback headers_callback,
|
ExchangeHeadersCallback headers_callback,
|
||||||
url::Origin request_initiator,
|
url::Origin request_initiator,
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
||||||
URLLoaderThrottlesGetter url_loader_throttles_getter,
|
URLLoaderThrottlesGetter url_loader_throttles_getter,
|
||||||
scoped_refptr<net::URLRequestContextGetter> request_context_getter)
|
scoped_refptr<net::URLRequestContextGetter> request_context_getter)
|
||||||
: headers_callback_(std::move(headers_callback)),
|
: headers_callback_(std::move(headers_callback)),
|
||||||
|
@@ -11,13 +11,13 @@
|
|||||||
#include "base/optional.h"
|
#include "base/optional.h"
|
||||||
#include "content/browser/web_package/signed_exchange_header.h"
|
#include "content/browser/web_package/signed_exchange_header.h"
|
||||||
#include "content/common/content_export.h"
|
#include "content/common/content_export.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
|
||||||
#include "mojo/public/cpp/system/data_pipe.h"
|
#include "mojo/public/cpp/system/data_pipe.h"
|
||||||
#include "net/base/completion_callback.h"
|
#include "net/base/completion_callback.h"
|
||||||
#include "net/cert/cert_verifier.h"
|
#include "net/cert/cert_verifier.h"
|
||||||
#include "net/cert/cert_verify_result.h"
|
#include "net/cert/cert_verify_result.h"
|
||||||
#include "net/log/net_log_with_source.h"
|
#include "net/log/net_log_with_source.h"
|
||||||
#include "net/ssl/ssl_info.h"
|
#include "net/ssl/ssl_info.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
#include "url/gurl.h"
|
#include "url/gurl.h"
|
||||||
#include "url/origin.h"
|
#include "url/origin.h"
|
||||||
|
|
||||||
@@ -31,12 +31,12 @@ class X509Certificate;
|
|||||||
} // namespace net
|
} // namespace net
|
||||||
|
|
||||||
namespace network {
|
namespace network {
|
||||||
|
class SharedURLLoaderFactory;
|
||||||
struct ResourceResponseHead;
|
struct ResourceResponseHead;
|
||||||
}
|
} // namespace network
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
|
|
||||||
class SharedURLLoaderFactory;
|
|
||||||
class SignedExchangeCertFetcher;
|
class SignedExchangeCertFetcher;
|
||||||
class URLLoaderThrottle;
|
class URLLoaderThrottle;
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ class CONTENT_EXPORT SignedExchangeHandler {
|
|||||||
std::unique_ptr<net::SourceStream> body,
|
std::unique_ptr<net::SourceStream> body,
|
||||||
ExchangeHeadersCallback headers_callback,
|
ExchangeHeadersCallback headers_callback,
|
||||||
url::Origin request_initiator,
|
url::Origin request_initiator,
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
||||||
URLLoaderThrottlesGetter url_loader_throttles_getter,
|
URLLoaderThrottlesGetter url_loader_throttles_getter,
|
||||||
scoped_refptr<net::URLRequestContextGetter> request_context_getter);
|
scoped_refptr<net::URLRequestContextGetter> request_context_getter);
|
||||||
~SignedExchangeHandler();
|
~SignedExchangeHandler();
|
||||||
@@ -111,7 +111,7 @@ class CONTENT_EXPORT SignedExchangeHandler {
|
|||||||
|
|
||||||
// Used to create |cert_fetcher_|.
|
// Used to create |cert_fetcher_|.
|
||||||
url::Origin request_initiator_;
|
url::Origin request_initiator_;
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory_;
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
|
||||||
// This getter is guaranteed to be valid at least until the headers callback
|
// This getter is guaranteed to be valid at least until the headers callback
|
||||||
// is run.
|
// is run.
|
||||||
URLLoaderThrottlesGetter url_loader_throttles_getter_;
|
URLLoaderThrottlesGetter url_loader_throttles_getter_;
|
||||||
@@ -145,7 +145,7 @@ class SignedExchangeHandlerFactory {
|
|||||||
std::unique_ptr<net::SourceStream> body,
|
std::unique_ptr<net::SourceStream> body,
|
||||||
SignedExchangeHandler::ExchangeHeadersCallback headers_callback,
|
SignedExchangeHandler::ExchangeHeadersCallback headers_callback,
|
||||||
url::Origin request_initiator,
|
url::Origin request_initiator,
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
||||||
SignedExchangeHandler::URLLoaderThrottlesGetter
|
SignedExchangeHandler::URLLoaderThrottlesGetter
|
||||||
url_loader_throttles_getter) = 0;
|
url_loader_throttles_getter) = 0;
|
||||||
};
|
};
|
||||||
|
@@ -50,7 +50,7 @@ void SignedExchangeURLLoaderFactoryForNonNetworkService::CreateLoaderAndStart(
|
|||||||
std::move(client), traffic_annotation);
|
std::move(client), traffic_annotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo>
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
|
||||||
SignedExchangeURLLoaderFactoryForNonNetworkService::Clone() {
|
SignedExchangeURLLoaderFactoryForNonNetworkService::Clone() {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
#define CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_URL_LOADER_FACTORY_FOR_NON_NETWORK_SERVICE_H_
|
#define CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_URL_LOADER_FACTORY_FOR_NON_NETWORK_SERVICE_H_
|
||||||
|
|
||||||
#include "content/public/common/resource_type.h"
|
#include "content/public/common/resource_type.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
|
|
||||||
namespace net {
|
namespace net {
|
||||||
class URLRequestContextGetter;
|
class URLRequestContextGetter;
|
||||||
@@ -19,7 +19,7 @@ class ResourceContext;
|
|||||||
// A URLLoaderFactory used for fetching certificate of signed HTTP exchange
|
// A URLLoaderFactory used for fetching certificate of signed HTTP exchange
|
||||||
// when NetworkService is not enabled.
|
// when NetworkService is not enabled.
|
||||||
class SignedExchangeURLLoaderFactoryForNonNetworkService
|
class SignedExchangeURLLoaderFactoryForNonNetworkService
|
||||||
: public SharedURLLoaderFactory {
|
: public network::SharedURLLoaderFactory {
|
||||||
public:
|
public:
|
||||||
SignedExchangeURLLoaderFactoryForNonNetworkService(
|
SignedExchangeURLLoaderFactoryForNonNetworkService(
|
||||||
ResourceContext* resource_context,
|
ResourceContext* resource_context,
|
||||||
@@ -34,7 +34,7 @@ class SignedExchangeURLLoaderFactoryForNonNetworkService
|
|||||||
network::mojom::URLLoaderClientPtr client,
|
network::mojom::URLLoaderClientPtr client,
|
||||||
const net::MutableNetworkTrafficAnnotationTag&
|
const net::MutableNetworkTrafficAnnotationTag&
|
||||||
traffic_annotation) override;
|
traffic_annotation) override;
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> Clone() override;
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo> Clone() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
~SignedExchangeURLLoaderFactoryForNonNetworkService() override;
|
~SignedExchangeURLLoaderFactoryForNonNetworkService() override;
|
||||||
|
@@ -12,11 +12,11 @@
|
|||||||
#include "content/browser/loader/source_stream_to_data_pipe.h"
|
#include "content/browser/loader/source_stream_to_data_pipe.h"
|
||||||
#include "content/browser/web_package/signed_exchange_handler.h"
|
#include "content/browser/web_package/signed_exchange_handler.h"
|
||||||
#include "content/public/common/content_features.h"
|
#include "content/public/common/content_features.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
|
||||||
#include "net/cert/cert_status_flags.h"
|
#include "net/cert/cert_status_flags.h"
|
||||||
#include "net/http/http_util.h"
|
#include "net/http/http_util.h"
|
||||||
#include "net/url_request/url_request_context_getter.h"
|
#include "net/url_request/url_request_context_getter.h"
|
||||||
#include "services/network/public/cpp/features.h"
|
#include "services/network/public/cpp/features.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
#include "services/network/public/cpp/url_loader_completion_status.h"
|
#include "services/network/public/cpp/url_loader_completion_status.h"
|
||||||
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ WebPackageLoader::WebPackageLoader(
|
|||||||
network::mojom::URLLoaderClientEndpointsPtr endpoints,
|
network::mojom::URLLoaderClientEndpointsPtr endpoints,
|
||||||
url::Origin request_initiator,
|
url::Origin request_initiator,
|
||||||
uint32_t url_loader_options,
|
uint32_t url_loader_options,
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
||||||
URLLoaderThrottlesGetter url_loader_throttles_getter,
|
URLLoaderThrottlesGetter url_loader_throttles_getter,
|
||||||
scoped_refptr<net::URLRequestContextGetter> request_context_getter)
|
scoped_refptr<net::URLRequestContextGetter> request_context_getter)
|
||||||
: original_response_timing_info_(
|
: original_response_timing_info_(
|
||||||
|
@@ -20,9 +20,12 @@ class SourceStream;
|
|||||||
class URLRequestContextGetter;
|
class URLRequestContextGetter;
|
||||||
} // namespace net
|
} // namespace net
|
||||||
|
|
||||||
|
namespace network {
|
||||||
|
class SharedURLLoaderFactory;
|
||||||
|
} // namespace network
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
|
|
||||||
class SharedURLLoaderFactory;
|
|
||||||
class SignedExchangeHandler;
|
class SignedExchangeHandler;
|
||||||
class SignedExchangeHandlerFactory;
|
class SignedExchangeHandlerFactory;
|
||||||
class URLLoaderThrottle;
|
class URLLoaderThrottle;
|
||||||
@@ -45,7 +48,7 @@ class WebPackageLoader final : public network::mojom::URLLoaderClient,
|
|||||||
network::mojom::URLLoaderClientEndpointsPtr endpoints,
|
network::mojom::URLLoaderClientEndpointsPtr endpoints,
|
||||||
url::Origin request_initiator,
|
url::Origin request_initiator,
|
||||||
uint32_t url_loader_options,
|
uint32_t url_loader_options,
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
||||||
URLLoaderThrottlesGetter url_loader_throttles_getter,
|
URLLoaderThrottlesGetter url_loader_throttles_getter,
|
||||||
scoped_refptr<net::URLRequestContextGetter> request_context_getter);
|
scoped_refptr<net::URLRequestContextGetter> request_context_getter);
|
||||||
~WebPackageLoader() override;
|
~WebPackageLoader() override;
|
||||||
@@ -124,7 +127,7 @@ class WebPackageLoader final : public network::mojom::URLLoaderClient,
|
|||||||
|
|
||||||
url::Origin request_initiator_;
|
url::Origin request_initiator_;
|
||||||
const uint32_t url_loader_options_;
|
const uint32_t url_loader_options_;
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory_;
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
|
||||||
URLLoaderThrottlesGetter url_loader_throttles_getter_;
|
URLLoaderThrottlesGetter url_loader_throttles_getter_;
|
||||||
scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
|
scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@ WebPackagePrefetchHandler::WebPackagePrefetchHandler(
|
|||||||
const network::ResourceResponseHead& response,
|
const network::ResourceResponseHead& response,
|
||||||
network::mojom::URLLoaderPtr network_loader,
|
network::mojom::URLLoaderPtr network_loader,
|
||||||
network::mojom::URLLoaderClientRequest network_client_request,
|
network::mojom::URLLoaderClientRequest network_client_request,
|
||||||
scoped_refptr<SharedURLLoaderFactory> network_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory,
|
||||||
url::Origin request_initiator,
|
url::Origin request_initiator,
|
||||||
URLLoaderThrottlesGetter loader_throttles_getter,
|
URLLoaderThrottlesGetter loader_throttles_getter,
|
||||||
ResourceContext* resource_context,
|
ResourceContext* resource_context,
|
||||||
@@ -45,7 +45,7 @@ WebPackagePrefetchHandler::WebPackagePrefetchHandler(
|
|||||||
std::move(network_client_request));
|
std::move(network_client_request));
|
||||||
network::mojom::URLLoaderClientPtr client;
|
network::mojom::URLLoaderClientPtr client;
|
||||||
loader_client_binding_.Bind(mojo::MakeRequest(&client));
|
loader_client_binding_.Bind(mojo::MakeRequest(&client));
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory;
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory;
|
||||||
if (!base::FeatureList::IsEnabled(network::features::kNetworkService)) {
|
if (!base::FeatureList::IsEnabled(network::features::kNetworkService)) {
|
||||||
url_loader_factory = base::MakeRefCounted<
|
url_loader_factory = base::MakeRefCounted<
|
||||||
SignedExchangeURLLoaderFactoryForNonNetworkService>(
|
SignedExchangeURLLoaderFactoryForNonNetworkService>(
|
||||||
|
@@ -13,11 +13,14 @@ namespace net {
|
|||||||
class URLRequestContextGetter;
|
class URLRequestContextGetter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace network {
|
||||||
|
class SharedURLLoaderFactory;
|
||||||
|
}
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
|
|
||||||
class ResourceContext;
|
class ResourceContext;
|
||||||
class URLLoaderThrottle;
|
class URLLoaderThrottle;
|
||||||
class SharedURLLoaderFactory;
|
|
||||||
class WebPackageLoader;
|
class WebPackageLoader;
|
||||||
|
|
||||||
// Attached to each PrefetchURLLoader if the prefetch is for a signed exchange.
|
// Attached to each PrefetchURLLoader if the prefetch is for a signed exchange.
|
||||||
@@ -37,7 +40,7 @@ class WebPackagePrefetchHandler final : public network::mojom::URLLoaderClient {
|
|||||||
const network::ResourceResponseHead& response,
|
const network::ResourceResponseHead& response,
|
||||||
network::mojom::URLLoaderPtr network_loader,
|
network::mojom::URLLoaderPtr network_loader,
|
||||||
network::mojom::URLLoaderClientRequest network_client_request,
|
network::mojom::URLLoaderClientRequest network_client_request,
|
||||||
scoped_refptr<SharedURLLoaderFactory> network_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory,
|
||||||
url::Origin request_initiator,
|
url::Origin request_initiator,
|
||||||
URLLoaderThrottlesGetter loader_throttles_getter,
|
URLLoaderThrottlesGetter loader_throttles_getter,
|
||||||
ResourceContext* resource_context,
|
ResourceContext* resource_context,
|
||||||
|
@@ -11,11 +11,11 @@
|
|||||||
#include "content/browser/web_package/web_package_loader.h"
|
#include "content/browser/web_package/web_package_loader.h"
|
||||||
#include "content/common/throttling_url_loader.h"
|
#include "content/common/throttling_url_loader.h"
|
||||||
#include "content/public/common/content_features.h"
|
#include "content/public/common/content_features.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
|
||||||
#include "mojo/public/cpp/bindings/strong_binding.h"
|
#include "mojo/public/cpp/bindings/strong_binding.h"
|
||||||
#include "net/http/http_response_headers.h"
|
#include "net/http/http_response_headers.h"
|
||||||
#include "net/url_request/url_request_context_getter.h"
|
#include "net/url_request/url_request_context_getter.h"
|
||||||
#include "services/network/public/cpp/resource_response.h"
|
#include "services/network/public/cpp/resource_response.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
#include "services/network/public/mojom/url_loader.mojom.h"
|
#include "services/network/public/mojom/url_loader.mojom.h"
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
@@ -30,7 +30,7 @@ bool WebPackageRequestHandler::IsSupportedMimeType(
|
|||||||
WebPackageRequestHandler::WebPackageRequestHandler(
|
WebPackageRequestHandler::WebPackageRequestHandler(
|
||||||
url::Origin request_initiator,
|
url::Origin request_initiator,
|
||||||
uint32_t url_loader_options,
|
uint32_t url_loader_options,
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
||||||
URLLoaderThrottlesGetter url_loader_throttles_getter,
|
URLLoaderThrottlesGetter url_loader_throttles_getter,
|
||||||
scoped_refptr<net::URLRequestContextGetter> request_context_getter)
|
scoped_refptr<net::URLRequestContextGetter> request_context_getter)
|
||||||
: request_initiator_(std::move(request_initiator)),
|
: request_initiator_(std::move(request_initiator)),
|
||||||
|
@@ -14,9 +14,12 @@ namespace net {
|
|||||||
class URLRequestContextGetter;
|
class URLRequestContextGetter;
|
||||||
} // namespace net
|
} // namespace net
|
||||||
|
|
||||||
|
namespace network {
|
||||||
|
class SharedURLLoaderFactory;
|
||||||
|
} // namespace network
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
|
|
||||||
class SharedURLLoaderFactory;
|
|
||||||
class URLLoaderThrottle;
|
class URLLoaderThrottle;
|
||||||
class WebPackageLoader;
|
class WebPackageLoader;
|
||||||
|
|
||||||
@@ -30,7 +33,7 @@ class WebPackageRequestHandler final : public URLLoaderRequestHandler {
|
|||||||
WebPackageRequestHandler(
|
WebPackageRequestHandler(
|
||||||
url::Origin request_initiator,
|
url::Origin request_initiator,
|
||||||
uint32_t url_loader_options,
|
uint32_t url_loader_options,
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
||||||
URLLoaderThrottlesGetter url_loader_throttles_getter,
|
URLLoaderThrottlesGetter url_loader_throttles_getter,
|
||||||
scoped_refptr<net::URLRequestContextGetter> request_context_getter);
|
scoped_refptr<net::URLRequestContextGetter> request_context_getter);
|
||||||
~WebPackageRequestHandler() override;
|
~WebPackageRequestHandler() override;
|
||||||
@@ -56,7 +59,7 @@ class WebPackageRequestHandler final : public URLLoaderRequestHandler {
|
|||||||
|
|
||||||
url::Origin request_initiator_;
|
url::Origin request_initiator_;
|
||||||
const uint32_t url_loader_options_;
|
const uint32_t url_loader_options_;
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory_;
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
|
||||||
URLLoaderThrottlesGetter url_loader_throttles_getter_;
|
URLLoaderThrottlesGetter url_loader_throttles_getter_;
|
||||||
scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
|
scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
|
||||||
|
|
||||||
|
@@ -57,14 +57,14 @@ class SingleRequestURLLoaderFactory::HandlerState
|
|||||||
};
|
};
|
||||||
|
|
||||||
class SingleRequestURLLoaderFactory::FactoryInfo
|
class SingleRequestURLLoaderFactory::FactoryInfo
|
||||||
: public SharedURLLoaderFactoryInfo {
|
: public network::SharedURLLoaderFactoryInfo {
|
||||||
public:
|
public:
|
||||||
explicit FactoryInfo(scoped_refptr<HandlerState> state)
|
explicit FactoryInfo(scoped_refptr<HandlerState> state)
|
||||||
: state_(std::move(state)) {}
|
: state_(std::move(state)) {}
|
||||||
~FactoryInfo() override = default;
|
~FactoryInfo() override = default;
|
||||||
|
|
||||||
// SharedURLLoaderFactoryInfo:
|
// SharedURLLoaderFactoryInfo:
|
||||||
scoped_refptr<SharedURLLoaderFactory> CreateFactory() override {
|
scoped_refptr<network::SharedURLLoaderFactory> CreateFactory() override {
|
||||||
return new SingleRequestURLLoaderFactory(std::move(state_));
|
return new SingleRequestURLLoaderFactory(std::move(state_));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ void SingleRequestURLLoaderFactory::CreateLoaderAndStart(
|
|||||||
state_->HandleRequest(std::move(loader), std::move(client));
|
state_->HandleRequest(std::move(loader), std::move(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo>
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
|
||||||
SingleRequestURLLoaderFactory::Clone() {
|
SingleRequestURLLoaderFactory::Clone() {
|
||||||
return std::make_unique<FactoryInfo>(state_);
|
return std::make_unique<FactoryInfo>(state_);
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
#ifndef CONTENT_COMMON_SINGLE_REQUEST_URL_LOADER_FACTORY_H_
|
#ifndef CONTENT_COMMON_SINGLE_REQUEST_URL_LOADER_FACTORY_H_
|
||||||
#define CONTENT_COMMON_SINGLE_REQUEST_URL_LOADER_FACTORY_H_
|
#define CONTENT_COMMON_SINGLE_REQUEST_URL_LOADER_FACTORY_H_
|
||||||
|
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
|
|
||||||
#include "base/memory/ref_counted.h"
|
#include "base/memory/ref_counted.h"
|
||||||
#include "services/network/public/mojom/url_loader.mojom.h"
|
#include "services/network/public/mojom/url_loader.mojom.h"
|
||||||
@@ -15,7 +15,7 @@ namespace content {
|
|||||||
// An implementation of SharedURLLoaderFactory which handles only a single
|
// An implementation of SharedURLLoaderFactory which handles only a single
|
||||||
// request. It's an error to call CreateLoaderAndStart() more than a total of
|
// request. It's an error to call CreateLoaderAndStart() more than a total of
|
||||||
// one time across this object or any of its clones.
|
// one time across this object or any of its clones.
|
||||||
class SingleRequestURLLoaderFactory : public SharedURLLoaderFactory {
|
class SingleRequestURLLoaderFactory : public network::SharedURLLoaderFactory {
|
||||||
public:
|
public:
|
||||||
using RequestHandler =
|
using RequestHandler =
|
||||||
base::OnceCallback<void(network::mojom::URLLoaderRequest,
|
base::OnceCallback<void(network::mojom::URLLoaderRequest,
|
||||||
@@ -32,7 +32,7 @@ class SingleRequestURLLoaderFactory : public SharedURLLoaderFactory {
|
|||||||
network::mojom::URLLoaderClientPtr client,
|
network::mojom::URLLoaderClientPtr client,
|
||||||
const net::MutableNetworkTrafficAnnotationTag&
|
const net::MutableNetworkTrafficAnnotationTag&
|
||||||
traffic_annotation) override;
|
traffic_annotation) override;
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> Clone() override;
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo> Clone() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class FactoryInfo;
|
class FactoryInfo;
|
||||||
|
@@ -109,7 +109,7 @@ class ThrottlingURLLoader::ForwardingThrottleDelegate
|
|||||||
};
|
};
|
||||||
|
|
||||||
ThrottlingURLLoader::StartInfo::StartInfo(
|
ThrottlingURLLoader::StartInfo::StartInfo(
|
||||||
scoped_refptr<SharedURLLoaderFactory> in_url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> in_url_loader_factory,
|
||||||
int32_t in_routing_id,
|
int32_t in_routing_id,
|
||||||
int32_t in_request_id,
|
int32_t in_request_id,
|
||||||
uint32_t in_options,
|
uint32_t in_options,
|
||||||
@@ -150,7 +150,7 @@ ThrottlingURLLoader::PriorityInfo::~PriorityInfo() = default;
|
|||||||
|
|
||||||
// static
|
// static
|
||||||
std::unique_ptr<ThrottlingURLLoader> ThrottlingURLLoader::CreateLoaderAndStart(
|
std::unique_ptr<ThrottlingURLLoader> ThrottlingURLLoader::CreateLoaderAndStart(
|
||||||
scoped_refptr<SharedURLLoaderFactory> factory,
|
scoped_refptr<network::SharedURLLoaderFactory> factory,
|
||||||
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
|
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
|
||||||
int32_t routing_id,
|
int32_t routing_id,
|
||||||
int32_t request_id,
|
int32_t request_id,
|
||||||
@@ -219,7 +219,7 @@ ThrottlingURLLoader::ThrottlingURLLoader(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ThrottlingURLLoader::Start(
|
void ThrottlingURLLoader::Start(
|
||||||
scoped_refptr<SharedURLLoaderFactory> factory,
|
scoped_refptr<network::SharedURLLoaderFactory> factory,
|
||||||
int32_t routing_id,
|
int32_t routing_id,
|
||||||
int32_t request_id,
|
int32_t request_id,
|
||||||
uint32_t options,
|
uint32_t options,
|
||||||
@@ -256,7 +256,7 @@ void ThrottlingURLLoader::Start(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ThrottlingURLLoader::StartNow(
|
void ThrottlingURLLoader::StartNow(
|
||||||
SharedURLLoaderFactory* factory,
|
network::SharedURLLoaderFactory* factory,
|
||||||
int32_t routing_id,
|
int32_t routing_id,
|
||||||
int32_t request_id,
|
int32_t request_id,
|
||||||
uint32_t options,
|
uint32_t options,
|
||||||
|
@@ -14,9 +14,9 @@
|
|||||||
#include "base/threading/thread_task_runner_handle.h"
|
#include "base/threading/thread_task_runner_handle.h"
|
||||||
#include "content/common/content_export.h"
|
#include "content/common/content_export.h"
|
||||||
#include "content/common/possibly_associated_interface_ptr.h"
|
#include "content/common/possibly_associated_interface_ptr.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
|
||||||
#include "content/public/common/url_loader_throttle.h"
|
#include "content/public/common/url_loader_throttle.h"
|
||||||
#include "mojo/public/cpp/bindings/binding.h"
|
#include "mojo/public/cpp/bindings/binding.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
#include "services/network/public/mojom/url_loader.mojom.h"
|
#include "services/network/public/mojom/url_loader.mojom.h"
|
||||||
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ class CONTENT_EXPORT ThrottlingURLLoader
|
|||||||
// note that the request may not start immediately since it could be deferred
|
// note that the request may not start immediately since it could be deferred
|
||||||
// by throttles.
|
// by throttles.
|
||||||
static std::unique_ptr<ThrottlingURLLoader> CreateLoaderAndStart(
|
static std::unique_ptr<ThrottlingURLLoader> CreateLoaderAndStart(
|
||||||
scoped_refptr<SharedURLLoaderFactory> factory,
|
scoped_refptr<network::SharedURLLoaderFactory> factory,
|
||||||
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
|
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
|
||||||
int32_t routing_id,
|
int32_t routing_id,
|
||||||
int32_t request_id,
|
int32_t request_id,
|
||||||
@@ -72,14 +72,14 @@ class CONTENT_EXPORT ThrottlingURLLoader
|
|||||||
network::mojom::URLLoaderClient* client,
|
network::mojom::URLLoaderClient* client,
|
||||||
const net::NetworkTrafficAnnotationTag& traffic_annotation);
|
const net::NetworkTrafficAnnotationTag& traffic_annotation);
|
||||||
|
|
||||||
void Start(scoped_refptr<SharedURLLoaderFactory> factory,
|
void Start(scoped_refptr<network::SharedURLLoaderFactory> factory,
|
||||||
int32_t routing_id,
|
int32_t routing_id,
|
||||||
int32_t request_id,
|
int32_t request_id,
|
||||||
uint32_t options,
|
uint32_t options,
|
||||||
network::ResourceRequest* url_request,
|
network::ResourceRequest* url_request,
|
||||||
scoped_refptr<base::SingleThreadTaskRunner> task_runner);
|
scoped_refptr<base::SingleThreadTaskRunner> task_runner);
|
||||||
|
|
||||||
void StartNow(SharedURLLoaderFactory* factory,
|
void StartNow(network::SharedURLLoaderFactory* factory,
|
||||||
int32_t routing_id,
|
int32_t routing_id,
|
||||||
int32_t request_id,
|
int32_t request_id,
|
||||||
uint32_t options,
|
uint32_t options,
|
||||||
@@ -171,15 +171,16 @@ class CONTENT_EXPORT ThrottlingURLLoader
|
|||||||
network::mojom::URLLoaderPtr url_loader_;
|
network::mojom::URLLoaderPtr url_loader_;
|
||||||
|
|
||||||
struct StartInfo {
|
struct StartInfo {
|
||||||
StartInfo(scoped_refptr<SharedURLLoaderFactory> in_url_loader_factory,
|
StartInfo(
|
||||||
int32_t in_routing_id,
|
scoped_refptr<network::SharedURLLoaderFactory> in_url_loader_factory,
|
||||||
int32_t in_request_id,
|
int32_t in_routing_id,
|
||||||
uint32_t in_options,
|
int32_t in_request_id,
|
||||||
network::ResourceRequest* in_url_request,
|
uint32_t in_options,
|
||||||
scoped_refptr<base::SingleThreadTaskRunner> in_task_runner);
|
network::ResourceRequest* in_url_request,
|
||||||
|
scoped_refptr<base::SingleThreadTaskRunner> in_task_runner);
|
||||||
~StartInfo();
|
~StartInfo();
|
||||||
|
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory;
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory;
|
||||||
int32_t routing_id;
|
int32_t routing_id;
|
||||||
int32_t request_id;
|
int32_t request_id;
|
||||||
uint32_t options;
|
uint32_t options;
|
||||||
|
@@ -37,7 +37,7 @@ class TestURLLoaderFactory : public network::mojom::URLLoaderFactory,
|
|||||||
mojo::Binding<network::mojom::URLLoader>& url_loader_binding() {
|
mojo::Binding<network::mojom::URLLoader>& url_loader_binding() {
|
||||||
return url_loader_binding_;
|
return url_loader_binding_;
|
||||||
}
|
}
|
||||||
scoped_refptr<SharedURLLoaderFactory> shared_factory() {
|
scoped_refptr<network::SharedURLLoaderFactory> shared_factory() {
|
||||||
return shared_factory_;
|
return shared_factory_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -20,7 +20,7 @@ URLLoaderFactoryBundleInfo::URLLoaderFactoryBundleInfo(
|
|||||||
|
|
||||||
URLLoaderFactoryBundleInfo::~URLLoaderFactoryBundleInfo() = default;
|
URLLoaderFactoryBundleInfo::~URLLoaderFactoryBundleInfo() = default;
|
||||||
|
|
||||||
scoped_refptr<SharedURLLoaderFactory>
|
scoped_refptr<network::SharedURLLoaderFactory>
|
||||||
URLLoaderFactoryBundleInfo::CreateFactory() {
|
URLLoaderFactoryBundleInfo::CreateFactory() {
|
||||||
auto other = std::make_unique<URLLoaderFactoryBundleInfo>();
|
auto other = std::make_unique<URLLoaderFactoryBundleInfo>();
|
||||||
other->default_factory_info_ = std::move(default_factory_info_);
|
other->default_factory_info_ = std::move(default_factory_info_);
|
||||||
@@ -78,7 +78,8 @@ void URLLoaderFactoryBundle::CreateLoaderAndStart(
|
|||||||
traffic_annotation);
|
traffic_annotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> URLLoaderFactoryBundle::Clone() {
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
|
||||||
|
URLLoaderFactoryBundle::Clone() {
|
||||||
network::mojom::URLLoaderFactoryPtrInfo default_factory_info;
|
network::mojom::URLLoaderFactoryPtrInfo default_factory_info;
|
||||||
if (default_factory_)
|
if (default_factory_)
|
||||||
default_factory_->Clone(mojo::MakeRequest(&default_factory_info));
|
default_factory_->Clone(mojo::MakeRequest(&default_factory_info));
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "content/common/content_export.h"
|
#include "content/common/content_export.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
||||||
|
|
||||||
class GURL;
|
class GURL;
|
||||||
@@ -20,7 +20,7 @@ namespace content {
|
|||||||
// Holds the internal state of a URLLoaderFactoryBundle in a form that is safe
|
// Holds the internal state of a URLLoaderFactoryBundle in a form that is safe
|
||||||
// to pass across sequences.
|
// to pass across sequences.
|
||||||
class CONTENT_EXPORT URLLoaderFactoryBundleInfo
|
class CONTENT_EXPORT URLLoaderFactoryBundleInfo
|
||||||
: public SharedURLLoaderFactoryInfo {
|
: public network::SharedURLLoaderFactoryInfo {
|
||||||
public:
|
public:
|
||||||
URLLoaderFactoryBundleInfo();
|
URLLoaderFactoryBundleInfo();
|
||||||
URLLoaderFactoryBundleInfo(
|
URLLoaderFactoryBundleInfo(
|
||||||
@@ -40,7 +40,7 @@ class CONTENT_EXPORT URLLoaderFactoryBundleInfo
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
// SharedURLLoaderFactoryInfo implementation.
|
// SharedURLLoaderFactoryInfo implementation.
|
||||||
scoped_refptr<SharedURLLoaderFactory> CreateFactory() override;
|
scoped_refptr<network::SharedURLLoaderFactory> CreateFactory() override;
|
||||||
|
|
||||||
network::mojom::URLLoaderFactoryPtrInfo default_factory_info_;
|
network::mojom::URLLoaderFactoryPtrInfo default_factory_info_;
|
||||||
std::map<std::string, network::mojom::URLLoaderFactoryPtrInfo>
|
std::map<std::string, network::mojom::URLLoaderFactoryPtrInfo>
|
||||||
@@ -51,7 +51,8 @@ class CONTENT_EXPORT URLLoaderFactoryBundleInfo
|
|||||||
|
|
||||||
// Encapsulates a collection of URLLoaderFactoryPtrs which can be usd to acquire
|
// Encapsulates a collection of URLLoaderFactoryPtrs which can be usd to acquire
|
||||||
// loaders for various types of resource requests.
|
// loaders for various types of resource requests.
|
||||||
class CONTENT_EXPORT URLLoaderFactoryBundle : public SharedURLLoaderFactory {
|
class CONTENT_EXPORT URLLoaderFactoryBundle
|
||||||
|
: public network::SharedURLLoaderFactory {
|
||||||
public:
|
public:
|
||||||
URLLoaderFactoryBundle();
|
URLLoaderFactoryBundle();
|
||||||
|
|
||||||
@@ -81,7 +82,7 @@ class CONTENT_EXPORT URLLoaderFactoryBundle : public SharedURLLoaderFactory {
|
|||||||
const net::MutableNetworkTrafficAnnotationTag&
|
const net::MutableNetworkTrafficAnnotationTag&
|
||||||
traffic_annotation) override;
|
traffic_annotation) override;
|
||||||
|
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> Clone() override;
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo> Clone() override;
|
||||||
|
|
||||||
// The |info| contains replacement factories for a subset of the existing
|
// The |info| contains replacement factories for a subset of the existing
|
||||||
// bundle.
|
// bundle.
|
||||||
|
@@ -32,7 +32,7 @@ void WeakWrapperSharedURLLoaderFactory::CreateLoaderAndStart(
|
|||||||
traffic_annotation);
|
traffic_annotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo>
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
|
||||||
WeakWrapperSharedURLLoaderFactory::Clone() {
|
WeakWrapperSharedURLLoaderFactory::Clone() {
|
||||||
network::mojom::URLLoaderFactoryPtrInfo factory_ptr_info;
|
network::mojom::URLLoaderFactoryPtrInfo factory_ptr_info;
|
||||||
if (factory_ptr_)
|
if (factory_ptr_)
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
#define CONTENT_COMMON_WEAK_WRAPPER_SHARED_URL_LOADER_FACTORY_H_
|
#define CONTENT_COMMON_WEAK_WRAPPER_SHARED_URL_LOADER_FACTORY_H_
|
||||||
|
|
||||||
#include "content/common/content_export.h"
|
#include "content/common/content_export.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
@@ -14,7 +14,7 @@ namespace content {
|
|||||||
// A SharedURLLoaderFactory implementation that wraps a raw
|
// A SharedURLLoaderFactory implementation that wraps a raw
|
||||||
// mojom::URLLoaderFactory pointer.
|
// mojom::URLLoaderFactory pointer.
|
||||||
class CONTENT_EXPORT WeakWrapperSharedURLLoaderFactory
|
class CONTENT_EXPORT WeakWrapperSharedURLLoaderFactory
|
||||||
: public SharedURLLoaderFactory {
|
: public network::SharedURLLoaderFactory {
|
||||||
public:
|
public:
|
||||||
explicit WeakWrapperSharedURLLoaderFactory(
|
explicit WeakWrapperSharedURLLoaderFactory(
|
||||||
network::mojom::URLLoaderFactory* factory_ptr);
|
network::mojom::URLLoaderFactory* factory_ptr);
|
||||||
@@ -33,7 +33,7 @@ class CONTENT_EXPORT WeakWrapperSharedURLLoaderFactory
|
|||||||
const net::MutableNetworkTrafficAnnotationTag&
|
const net::MutableNetworkTrafficAnnotationTag&
|
||||||
traffic_annotation) override;
|
traffic_annotation) override;
|
||||||
|
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> Clone() override;
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo> Clone() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
~WeakWrapperSharedURLLoaderFactory() override;
|
~WeakWrapperSharedURLLoaderFactory() override;
|
||||||
|
@@ -17,7 +17,7 @@ WrapperSharedURLLoaderFactoryInfo::WrapperSharedURLLoaderFactoryInfo(
|
|||||||
WrapperSharedURLLoaderFactoryInfo::~WrapperSharedURLLoaderFactoryInfo() =
|
WrapperSharedURLLoaderFactoryInfo::~WrapperSharedURLLoaderFactoryInfo() =
|
||||||
default;
|
default;
|
||||||
|
|
||||||
scoped_refptr<SharedURLLoaderFactory>
|
scoped_refptr<network::SharedURLLoaderFactory>
|
||||||
WrapperSharedURLLoaderFactoryInfo::CreateFactory() {
|
WrapperSharedURLLoaderFactoryInfo::CreateFactory() {
|
||||||
return base::MakeRefCounted<WrapperSharedURLLoaderFactory>(
|
return base::MakeRefCounted<WrapperSharedURLLoaderFactory>(
|
||||||
std::move(factory_ptr_info_));
|
std::move(factory_ptr_info_));
|
||||||
|
@@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
#include "content/common/content_export.h"
|
#include "content/common/content_export.h"
|
||||||
#include "content/common/possibly_associated_interface_ptr.h"
|
#include "content/common/possibly_associated_interface_ptr.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
|
||||||
#include "mojo/public/cpp/bindings/interface_request.h"
|
#include "mojo/public/cpp/bindings/interface_request.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
@@ -16,7 +16,7 @@ namespace content {
|
|||||||
// A SharedURLLoaderFactoryInfo implementation that wraps a
|
// A SharedURLLoaderFactoryInfo implementation that wraps a
|
||||||
// network::mojom::URLLoaderFactoryPtrInfo.
|
// network::mojom::URLLoaderFactoryPtrInfo.
|
||||||
class CONTENT_EXPORT WrapperSharedURLLoaderFactoryInfo
|
class CONTENT_EXPORT WrapperSharedURLLoaderFactoryInfo
|
||||||
: public SharedURLLoaderFactoryInfo {
|
: public network::SharedURLLoaderFactoryInfo {
|
||||||
public:
|
public:
|
||||||
WrapperSharedURLLoaderFactoryInfo();
|
WrapperSharedURLLoaderFactoryInfo();
|
||||||
explicit WrapperSharedURLLoaderFactoryInfo(
|
explicit WrapperSharedURLLoaderFactoryInfo(
|
||||||
@@ -26,7 +26,7 @@ class CONTENT_EXPORT WrapperSharedURLLoaderFactoryInfo
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// SharedURLLoaderFactoryInfo implementation.
|
// SharedURLLoaderFactoryInfo implementation.
|
||||||
scoped_refptr<SharedURLLoaderFactory> CreateFactory() override;
|
scoped_refptr<network::SharedURLLoaderFactory> CreateFactory() override;
|
||||||
|
|
||||||
network::mojom::URLLoaderFactoryPtrInfo factory_ptr_info_;
|
network::mojom::URLLoaderFactoryPtrInfo factory_ptr_info_;
|
||||||
};
|
};
|
||||||
@@ -34,7 +34,8 @@ class CONTENT_EXPORT WrapperSharedURLLoaderFactoryInfo
|
|||||||
// A SharedURLLoaderFactory implementation that wraps a
|
// A SharedURLLoaderFactory implementation that wraps a
|
||||||
// PtrTemplateType<network::mojom::URLLoaderFactory>.
|
// PtrTemplateType<network::mojom::URLLoaderFactory>.
|
||||||
template <template <typename> class PtrTemplateType>
|
template <template <typename> class PtrTemplateType>
|
||||||
class WrapperSharedURLLoaderFactoryBase : public SharedURLLoaderFactory {
|
class WrapperSharedURLLoaderFactoryBase
|
||||||
|
: public network::SharedURLLoaderFactory {
|
||||||
public:
|
public:
|
||||||
using PtrType = PtrTemplateType<network::mojom::URLLoaderFactory>;
|
using PtrType = PtrTemplateType<network::mojom::URLLoaderFactory>;
|
||||||
using PtrInfoType = typename PtrType::PtrInfoType;
|
using PtrInfoType = typename PtrType::PtrInfoType;
|
||||||
@@ -61,7 +62,7 @@ class WrapperSharedURLLoaderFactoryBase : public SharedURLLoaderFactory {
|
|||||||
std::move(client), traffic_annotation);
|
std::move(client), traffic_annotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> Clone() override {
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo> Clone() override {
|
||||||
network::mojom::URLLoaderFactoryPtrInfo factory_ptr_info;
|
network::mojom::URLLoaderFactoryPtrInfo factory_ptr_info;
|
||||||
if (factory_ptr_)
|
if (factory_ptr_)
|
||||||
factory_ptr_->Clone(mojo::MakeRequest(&factory_ptr_info));
|
factory_ptr_->Clone(mojo::MakeRequest(&factory_ptr_info));
|
||||||
|
@@ -13,8 +13,8 @@
|
|||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/time/time.h"
|
#include "base/time/time.h"
|
||||||
#include "content/common/content_export.h"
|
#include "content/common/content_export.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
|
||||||
#include "net/cookies/cookie_store.h"
|
#include "net/cookies/cookie_store.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
|
|
||||||
class GURL;
|
class GURL;
|
||||||
|
|
||||||
@@ -84,9 +84,9 @@ class CONTENT_EXPORT StoragePartition {
|
|||||||
// use after StoragePartition has gone.
|
// use after StoragePartition has gone.
|
||||||
// The returned SharedURLLoaderFactory can be held on and will work across
|
// The returned SharedURLLoaderFactory can be held on and will work across
|
||||||
// network process restarts.
|
// network process restarts.
|
||||||
virtual scoped_refptr<SharedURLLoaderFactory>
|
virtual scoped_refptr<network::SharedURLLoaderFactory>
|
||||||
GetURLLoaderFactoryForBrowserProcess() = 0;
|
GetURLLoaderFactoryForBrowserProcess() = 0;
|
||||||
virtual std::unique_ptr<SharedURLLoaderFactoryInfo>
|
virtual std::unique_ptr<network::SharedURLLoaderFactoryInfo>
|
||||||
GetURLLoaderFactoryForBrowserProcessIOThread() = 0;
|
GetURLLoaderFactoryForBrowserProcessIOThread() = 0;
|
||||||
virtual network::mojom::CookieManager*
|
virtual network::mojom::CookieManager*
|
||||||
GetCookieManagerForBrowserProcess() = 0;
|
GetCookieManagerForBrowserProcess() = 0;
|
||||||
|
@@ -215,8 +215,6 @@ jumbo_source_set("common_sources") {
|
|||||||
"screen_orientation_values.h",
|
"screen_orientation_values.h",
|
||||||
"send_zygote_child_ping_linux.h",
|
"send_zygote_child_ping_linux.h",
|
||||||
"service_manager_connection.h",
|
"service_manager_connection.h",
|
||||||
"shared_url_loader_factory.cc",
|
|
||||||
"shared_url_loader_factory.h",
|
|
||||||
"simple_connection_filter.cc",
|
"simple_connection_filter.cc",
|
||||||
"simple_connection_filter.h",
|
"simple_connection_filter.h",
|
||||||
"socket_permission_request.h",
|
"socket_permission_request.h",
|
||||||
|
@@ -40,6 +40,10 @@ class Range;
|
|||||||
class Size;
|
class Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace network {
|
||||||
|
class SharedURLLoaderFactory;
|
||||||
|
}
|
||||||
|
|
||||||
namespace service_manager {
|
namespace service_manager {
|
||||||
class InterfaceProvider;
|
class InterfaceProvider;
|
||||||
}
|
}
|
||||||
@@ -54,7 +58,6 @@ class PluginInstanceThrottler;
|
|||||||
class RenderAccessibility;
|
class RenderAccessibility;
|
||||||
class RenderFrameVisitor;
|
class RenderFrameVisitor;
|
||||||
class RenderView;
|
class RenderView;
|
||||||
class SharedURLLoaderFactory;
|
|
||||||
struct ContextMenuParams;
|
struct ContextMenuParams;
|
||||||
struct WebPluginInfo;
|
struct WebPluginInfo;
|
||||||
struct WebPreferences;
|
struct WebPreferences;
|
||||||
@@ -262,7 +265,8 @@ class CONTENT_EXPORT RenderFrame : public IPC::Listener,
|
|||||||
// Set the accessibility mode to force creation of RenderAccessibility.
|
// Set the accessibility mode to force creation of RenderAccessibility.
|
||||||
virtual void SetAccessibilityModeForTest(ui::AXMode new_mode) = 0;
|
virtual void SetAccessibilityModeForTest(ui::AXMode new_mode) = 0;
|
||||||
|
|
||||||
virtual scoped_refptr<SharedURLLoaderFactory> GetURLLoaderFactory() = 0;
|
virtual scoped_refptr<network::SharedURLLoaderFactory>
|
||||||
|
GetURLLoaderFactory() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~RenderFrame() override {}
|
~RenderFrame() override {}
|
||||||
|
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
#include "content/common/content_export.h"
|
#include "content/common/content_export.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
|
||||||
#include "third_party/WebKit/public/platform/WebURLRequest.h"
|
#include "third_party/WebKit/public/platform/WebURLRequest.h"
|
||||||
|
|
||||||
class GURL;
|
class GURL;
|
||||||
@@ -28,6 +27,10 @@ namespace net {
|
|||||||
struct NetworkTrafficAnnotationTag;
|
struct NetworkTrafficAnnotationTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace network {
|
||||||
|
class SharedURLLoaderFactory;
|
||||||
|
}
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
|
|
||||||
// Interface to download resources asynchronously. Specified callback will be
|
// Interface to download resources asynchronously. Specified callback will be
|
||||||
@@ -62,7 +65,7 @@ class CONTENT_EXPORT ResourceFetcher {
|
|||||||
virtual void Start(
|
virtual void Start(
|
||||||
blink::WebLocalFrame* frame,
|
blink::WebLocalFrame* frame,
|
||||||
blink::WebURLRequest::RequestContext request_context,
|
blink::WebURLRequest::RequestContext request_context,
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
||||||
const net::NetworkTrafficAnnotationTag& annotation_tag,
|
const net::NetworkTrafficAnnotationTag& annotation_tag,
|
||||||
Callback callback,
|
Callback callback,
|
||||||
size_t maximum_download_size = kDefaultMaximumDownloadSize) = 0;
|
size_t maximum_download_size = kDefaultMaximumDownloadSize) = 0;
|
||||||
|
@@ -26,12 +26,12 @@ network::mojom::NetworkContext* TestStoragePartition::GetNetworkContext() {
|
|||||||
return network_context_;
|
return network_context_;
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_refptr<SharedURLLoaderFactory>
|
scoped_refptr<network::SharedURLLoaderFactory>
|
||||||
TestStoragePartition::GetURLLoaderFactoryForBrowserProcess() {
|
TestStoragePartition::GetURLLoaderFactoryForBrowserProcess() {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo>
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
|
||||||
TestStoragePartition::GetURLLoaderFactoryForBrowserProcessIOThread() {
|
TestStoragePartition::GetURLLoaderFactoryForBrowserProcessIOThread() {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@@ -56,10 +56,10 @@ class TestStoragePartition : public StoragePartition {
|
|||||||
}
|
}
|
||||||
network::mojom::NetworkContext* GetNetworkContext() override;
|
network::mojom::NetworkContext* GetNetworkContext() override;
|
||||||
|
|
||||||
scoped_refptr<SharedURLLoaderFactory> GetURLLoaderFactoryForBrowserProcess()
|
scoped_refptr<network::SharedURLLoaderFactory>
|
||||||
override;
|
GetURLLoaderFactoryForBrowserProcess() override;
|
||||||
|
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo>
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
|
||||||
GetURLLoaderFactoryForBrowserProcessIOThread() override;
|
GetURLLoaderFactoryForBrowserProcessIOThread() override;
|
||||||
|
|
||||||
void set_cookie_manager_for_browser_process(
|
void set_cookie_manager_for_browser_process(
|
||||||
|
@@ -24,6 +24,7 @@
|
|||||||
#include "content/shell/browser/shell.h"
|
#include "content/shell/browser/shell.h"
|
||||||
#include "net/test/embedded_test_server/embedded_test_server.h"
|
#include "net/test/embedded_test_server/embedded_test_server.h"
|
||||||
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
|
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
#include "third_party/WebKit/public/platform/WebURLResponse.h"
|
#include "third_party/WebKit/public/platform/WebURLResponse.h"
|
||||||
#include "third_party/WebKit/public/web/WebLocalFrame.h"
|
#include "third_party/WebKit/public/web/WebLocalFrame.h"
|
||||||
#include "third_party/WebKit/public/web/WebView.h"
|
#include "third_party/WebKit/public/web/WebView.h"
|
||||||
|
@@ -18,6 +18,7 @@
|
|||||||
#include "net/http/http_request_headers.h"
|
#include "net/http/http_request_headers.h"
|
||||||
#include "net/url_request/url_request_context.h"
|
#include "net/url_request/url_request_context.h"
|
||||||
#include "services/network/public/cpp/resource_request_body.h"
|
#include "services/network/public/cpp/resource_request_body.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
||||||
#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
|
#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
|
||||||
#include "third_party/WebKit/public/platform/WebString.h"
|
#include "third_party/WebKit/public/platform/WebString.h"
|
||||||
@@ -66,7 +67,7 @@ class ResourceFetcherImpl::ClientImpl : public network::mojom::URLLoaderClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Start(const network::ResourceRequest& request,
|
void Start(const network::ResourceRequest& request,
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
||||||
const net::NetworkTrafficAnnotationTag& annotation_tag,
|
const net::NetworkTrafficAnnotationTag& annotation_tag,
|
||||||
scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
|
scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
|
||||||
status_ = Status::kStarted;
|
status_ = Status::kStarted;
|
||||||
@@ -288,7 +289,7 @@ void ResourceFetcherImpl::SetHeader(const std::string& header,
|
|||||||
void ResourceFetcherImpl::Start(
|
void ResourceFetcherImpl::Start(
|
||||||
blink::WebLocalFrame* frame,
|
blink::WebLocalFrame* frame,
|
||||||
blink::WebURLRequest::RequestContext request_context,
|
blink::WebURLRequest::RequestContext request_context,
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
||||||
const net::NetworkTrafficAnnotationTag& annotation_tag,
|
const net::NetworkTrafficAnnotationTag& annotation_tag,
|
||||||
Callback callback,
|
Callback callback,
|
||||||
size_t maximum_download_size) {
|
size_t maximum_download_size) {
|
||||||
|
@@ -33,7 +33,7 @@ class ResourceFetcherImpl : public ResourceFetcher {
|
|||||||
void SetHeader(const std::string& header, const std::string& value) override;
|
void SetHeader(const std::string& header, const std::string& value) override;
|
||||||
void Start(blink::WebLocalFrame* frame,
|
void Start(blink::WebLocalFrame* frame,
|
||||||
blink::WebURLRequest::RequestContext request_context,
|
blink::WebURLRequest::RequestContext request_context,
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
||||||
const net::NetworkTrafficAnnotationTag& annotation_tag,
|
const net::NetworkTrafficAnnotationTag& annotation_tag,
|
||||||
Callback callback,
|
Callback callback,
|
||||||
size_t maximum_download_size) override;
|
size_t maximum_download_size) override;
|
||||||
|
@@ -108,7 +108,7 @@ ChildURLLoaderFactoryBundleInfo::ChildURLLoaderFactoryBundleInfo(
|
|||||||
|
|
||||||
ChildURLLoaderFactoryBundleInfo::~ChildURLLoaderFactoryBundleInfo() = default;
|
ChildURLLoaderFactoryBundleInfo::~ChildURLLoaderFactoryBundleInfo() = default;
|
||||||
|
|
||||||
scoped_refptr<SharedURLLoaderFactory>
|
scoped_refptr<network::SharedURLLoaderFactory>
|
||||||
ChildURLLoaderFactoryBundleInfo::CreateFactory() {
|
ChildURLLoaderFactoryBundleInfo::CreateFactory() {
|
||||||
auto other = std::make_unique<ChildURLLoaderFactoryBundleInfo>();
|
auto other = std::make_unique<ChildURLLoaderFactoryBundleInfo>();
|
||||||
other->default_factory_info_ = std::move(default_factory_info_);
|
other->default_factory_info_ = std::move(default_factory_info_);
|
||||||
@@ -186,7 +186,7 @@ void ChildURLLoaderFactoryBundle::CreateLoaderAndStart(
|
|||||||
traffic_annotation);
|
traffic_annotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo>
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
|
||||||
ChildURLLoaderFactoryBundle::Clone() {
|
ChildURLLoaderFactoryBundle::Clone() {
|
||||||
InitDefaultBlobFactoryIfNecessary();
|
InitDefaultBlobFactoryIfNecessary();
|
||||||
InitDirectNetworkFactoryIfNecessary();
|
InitDirectNetworkFactoryIfNecessary();
|
||||||
|
@@ -38,7 +38,7 @@ class CONTENT_EXPORT ChildURLLoaderFactoryBundleInfo
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
// URLLoaderFactoryBundleInfo overrides.
|
// URLLoaderFactoryBundleInfo overrides.
|
||||||
scoped_refptr<SharedURLLoaderFactory> CreateFactory() override;
|
scoped_refptr<network::SharedURLLoaderFactory> CreateFactory() override;
|
||||||
|
|
||||||
PossiblyAssociatedURLLoaderFactoryPtrInfo direct_network_factory_info_;
|
PossiblyAssociatedURLLoaderFactoryPtrInfo direct_network_factory_info_;
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ class CONTENT_EXPORT ChildURLLoaderFactoryBundle
|
|||||||
const net::MutableNetworkTrafficAnnotationTag&
|
const net::MutableNetworkTrafficAnnotationTag&
|
||||||
traffic_annotation) override;
|
traffic_annotation) override;
|
||||||
|
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> Clone() override;
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo> Clone() override;
|
||||||
|
|
||||||
std::unique_ptr<ChildURLLoaderFactoryBundleInfo> PassInterface();
|
std::unique_ptr<ChildURLLoaderFactoryBundleInfo> PassInterface();
|
||||||
|
|
||||||
|
@@ -377,11 +377,11 @@ void ResourceDispatcher::StartSync(
|
|||||||
const url::Origin& frame_origin,
|
const url::Origin& frame_origin,
|
||||||
const net::NetworkTrafficAnnotationTag& traffic_annotation,
|
const net::NetworkTrafficAnnotationTag& traffic_annotation,
|
||||||
SyncLoadResponse* response,
|
SyncLoadResponse* response,
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
||||||
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles) {
|
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles) {
|
||||||
CheckSchemeForReferrerPolicy(*request);
|
CheckSchemeForReferrerPolicy(*request);
|
||||||
|
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> factory_info =
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo> factory_info =
|
||||||
url_loader_factory->Clone();
|
url_loader_factory->Clone();
|
||||||
base::WaitableEvent event(base::WaitableEvent::ResetPolicy::MANUAL,
|
base::WaitableEvent event(base::WaitableEvent::ResetPolicy::MANUAL,
|
||||||
base::WaitableEvent::InitialState::NOT_SIGNALED);
|
base::WaitableEvent::InitialState::NOT_SIGNALED);
|
||||||
@@ -415,7 +415,7 @@ int ResourceDispatcher::StartAsync(
|
|||||||
const net::NetworkTrafficAnnotationTag& traffic_annotation,
|
const net::NetworkTrafficAnnotationTag& traffic_annotation,
|
||||||
bool is_sync,
|
bool is_sync,
|
||||||
std::unique_ptr<RequestPeer> peer,
|
std::unique_ptr<RequestPeer> peer,
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
||||||
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
|
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
|
||||||
network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
|
network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
|
||||||
base::OnceClosure* continue_navigation_function) {
|
base::OnceClosure* continue_navigation_function) {
|
||||||
|
@@ -23,11 +23,11 @@
|
|||||||
#include "base/time/time.h"
|
#include "base/time/time.h"
|
||||||
#include "content/common/content_export.h"
|
#include "content/common/content_export.h"
|
||||||
#include "content/public/common/resource_type.h"
|
#include "content/public/common/resource_type.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
|
||||||
#include "content/public/common/url_loader_throttle.h"
|
#include "content/public/common/url_loader_throttle.h"
|
||||||
#include "mojo/public/cpp/system/data_pipe.h"
|
#include "mojo/public/cpp/system/data_pipe.h"
|
||||||
#include "net/base/request_priority.h"
|
#include "net/base/request_priority.h"
|
||||||
#include "net/traffic_annotation/network_traffic_annotation.h"
|
#include "net/traffic_annotation/network_traffic_annotation.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
#include "services/network/public/mojom/url_loader.mojom.h"
|
#include "services/network/public/mojom/url_loader.mojom.h"
|
||||||
#include "third_party/WebKit/public/platform/WebURLRequest.h"
|
#include "third_party/WebKit/public/platform/WebURLRequest.h"
|
||||||
#include "url/gurl.h"
|
#include "url/gurl.h"
|
||||||
@@ -88,7 +88,7 @@ class CONTENT_EXPORT ResourceDispatcher {
|
|||||||
const url::Origin& frame_origin,
|
const url::Origin& frame_origin,
|
||||||
const net::NetworkTrafficAnnotationTag& traffic_annotation,
|
const net::NetworkTrafficAnnotationTag& traffic_annotation,
|
||||||
SyncLoadResponse* response,
|
SyncLoadResponse* response,
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
||||||
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles);
|
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles);
|
||||||
|
|
||||||
// Call this method to initiate the request. If this method succeeds, then
|
// Call this method to initiate the request. If this method succeeds, then
|
||||||
@@ -108,7 +108,7 @@ class CONTENT_EXPORT ResourceDispatcher {
|
|||||||
const net::NetworkTrafficAnnotationTag& traffic_annotation,
|
const net::NetworkTrafficAnnotationTag& traffic_annotation,
|
||||||
bool is_sync,
|
bool is_sync,
|
||||||
std::unique_ptr<RequestPeer> peer,
|
std::unique_ptr<RequestPeer> peer,
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
||||||
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
|
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
|
||||||
network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
|
network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
|
||||||
base::OnceClosure* continue_navigation_function);
|
base::OnceClosure* continue_navigation_function);
|
||||||
|
@@ -23,7 +23,8 @@ void SyncLoadContext::StartAsyncWithWaitableEvent(
|
|||||||
scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner,
|
scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner,
|
||||||
const url::Origin& frame_origin,
|
const url::Origin& frame_origin,
|
||||||
const net::NetworkTrafficAnnotationTag& traffic_annotation,
|
const net::NetworkTrafficAnnotationTag& traffic_annotation,
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> url_loader_factory_info,
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
|
||||||
|
url_loader_factory_info,
|
||||||
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
|
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
|
||||||
SyncLoadResponse* response,
|
SyncLoadResponse* response,
|
||||||
base::WaitableEvent* event) {
|
base::WaitableEvent* event) {
|
||||||
@@ -41,13 +42,13 @@ void SyncLoadContext::StartAsyncWithWaitableEvent(
|
|||||||
|
|
||||||
SyncLoadContext::SyncLoadContext(
|
SyncLoadContext::SyncLoadContext(
|
||||||
network::ResourceRequest* request,
|
network::ResourceRequest* request,
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> url_loader_factory,
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo> url_loader_factory,
|
||||||
SyncLoadResponse* response,
|
SyncLoadResponse* response,
|
||||||
base::WaitableEvent* event,
|
base::WaitableEvent* event,
|
||||||
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
|
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
|
||||||
: response_(response), event_(event), task_runner_(std::move(task_runner)) {
|
: response_(response), event_(event), task_runner_(std::move(task_runner)) {
|
||||||
url_loader_factory_ =
|
url_loader_factory_ =
|
||||||
SharedURLLoaderFactory::Create(std::move(url_loader_factory));
|
network::SharedURLLoaderFactory::Create(std::move(url_loader_factory));
|
||||||
|
|
||||||
// Constructs a new ResourceDispatcher specifically for this request.
|
// Constructs a new ResourceDispatcher specifically for this request.
|
||||||
resource_dispatcher_ = std::make_unique<ResourceDispatcher>();
|
resource_dispatcher_ = std::make_unique<ResourceDispatcher>();
|
||||||
|
@@ -6,10 +6,10 @@
|
|||||||
#define CONTENT_RENDERER_LOADER_SYNC_LOAD_CONTEXT_H_
|
#define CONTENT_RENDERER_LOADER_SYNC_LOAD_CONTEXT_H_
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
|
||||||
#include "content/public/renderer/request_peer.h"
|
#include "content/public/renderer/request_peer.h"
|
||||||
#include "content/renderer/loader/resource_dispatcher.h"
|
#include "content/renderer/loader/resource_dispatcher.h"
|
||||||
#include "net/traffic_annotation/network_traffic_annotation.h"
|
#include "net/traffic_annotation/network_traffic_annotation.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
|
|
||||||
namespace base {
|
namespace base {
|
||||||
class WaitableEvent;
|
class WaitableEvent;
|
||||||
@@ -40,14 +40,15 @@ class SyncLoadContext : public RequestPeer {
|
|||||||
scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner,
|
scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner,
|
||||||
const url::Origin& frame_origin,
|
const url::Origin& frame_origin,
|
||||||
const net::NetworkTrafficAnnotationTag& traffic_annotation,
|
const net::NetworkTrafficAnnotationTag& traffic_annotation,
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> url_loader_factory_info,
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
|
||||||
|
url_loader_factory_info,
|
||||||
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
|
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
|
||||||
SyncLoadResponse* response,
|
SyncLoadResponse* response,
|
||||||
base::WaitableEvent* event);
|
base::WaitableEvent* event);
|
||||||
|
|
||||||
SyncLoadContext(
|
SyncLoadContext(
|
||||||
network::ResourceRequest* request,
|
network::ResourceRequest* request,
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> url_loader_factory,
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo> url_loader_factory,
|
||||||
SyncLoadResponse* response,
|
SyncLoadResponse* response,
|
||||||
base::WaitableEvent* event,
|
base::WaitableEvent* event,
|
||||||
scoped_refptr<base::SingleThreadTaskRunner> task_runner);
|
scoped_refptr<base::SingleThreadTaskRunner> task_runner);
|
||||||
@@ -73,7 +74,7 @@ class SyncLoadContext : public RequestPeer {
|
|||||||
base::WaitableEvent* event_;
|
base::WaitableEvent* event_;
|
||||||
|
|
||||||
// State necessary to run a request on an independent thread.
|
// State necessary to run a request on an independent thread.
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory_;
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
|
||||||
std::unique_ptr<ResourceDispatcher> resource_dispatcher_;
|
std::unique_ptr<ResourceDispatcher> resource_dispatcher_;
|
||||||
|
|
||||||
int request_id_;
|
int request_id_;
|
||||||
|
@@ -25,7 +25,7 @@ TrackedChildURLLoaderFactoryBundleInfo::TrackedChildURLLoaderFactoryBundleInfo(
|
|||||||
TrackedChildURLLoaderFactoryBundleInfo::
|
TrackedChildURLLoaderFactoryBundleInfo::
|
||||||
~TrackedChildURLLoaderFactoryBundleInfo() = default;
|
~TrackedChildURLLoaderFactoryBundleInfo() = default;
|
||||||
|
|
||||||
scoped_refptr<SharedURLLoaderFactory>
|
scoped_refptr<network::SharedURLLoaderFactory>
|
||||||
TrackedChildURLLoaderFactoryBundleInfo::CreateFactory() {
|
TrackedChildURLLoaderFactoryBundleInfo::CreateFactory() {
|
||||||
auto other = std::make_unique<TrackedChildURLLoaderFactoryBundleInfo>();
|
auto other = std::make_unique<TrackedChildURLLoaderFactoryBundleInfo>();
|
||||||
other->default_factory_info_ = std::move(default_factory_info_);
|
other->default_factory_info_ = std::move(default_factory_info_);
|
||||||
@@ -51,7 +51,7 @@ TrackedChildURLLoaderFactoryBundle::~TrackedChildURLLoaderFactoryBundle() {
|
|||||||
RemoveObserverOnMainThread();
|
RemoveObserverOnMainThread();
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo>
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
|
||||||
TrackedChildURLLoaderFactoryBundle::Clone() {
|
TrackedChildURLLoaderFactoryBundle::Clone() {
|
||||||
auto info = base::WrapUnique(static_cast<ChildURLLoaderFactoryBundleInfo*>(
|
auto info = base::WrapUnique(static_cast<ChildURLLoaderFactoryBundleInfo*>(
|
||||||
ChildURLLoaderFactoryBundle::Clone().release()));
|
ChildURLLoaderFactoryBundle::Clone().release()));
|
||||||
@@ -96,7 +96,7 @@ void TrackedChildURLLoaderFactoryBundle::RemoveObserverOnMainThread() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TrackedChildURLLoaderFactoryBundle::OnUpdate(
|
void TrackedChildURLLoaderFactoryBundle::OnUpdate(
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> info) {
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo> info) {
|
||||||
Update(base::WrapUnique(
|
Update(base::WrapUnique(
|
||||||
static_cast<ChildURLLoaderFactoryBundleInfo*>(info.release())),
|
static_cast<ChildURLLoaderFactoryBundleInfo*>(info.release())),
|
||||||
base::nullopt);
|
base::nullopt);
|
||||||
@@ -112,7 +112,7 @@ HostChildURLLoaderFactoryBundle::HostChildURLLoaderFactoryBundle()
|
|||||||
|
|
||||||
HostChildURLLoaderFactoryBundle::~HostChildURLLoaderFactoryBundle() = default;
|
HostChildURLLoaderFactoryBundle::~HostChildURLLoaderFactoryBundle() = default;
|
||||||
|
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo>
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
|
||||||
HostChildURLLoaderFactoryBundle::Clone() {
|
HostChildURLLoaderFactoryBundle::Clone() {
|
||||||
auto info = base::WrapUnique(static_cast<ChildURLLoaderFactoryBundleInfo*>(
|
auto info = base::WrapUnique(static_cast<ChildURLLoaderFactoryBundleInfo*>(
|
||||||
ChildURLLoaderFactoryBundle::Clone().release()));
|
ChildURLLoaderFactoryBundle::Clone().release()));
|
||||||
@@ -168,7 +168,7 @@ void HostChildURLLoaderFactoryBundle::RemoveObserver(
|
|||||||
|
|
||||||
void HostChildURLLoaderFactoryBundle::NotifyUpdateOnMainOrWorkerThread(
|
void HostChildURLLoaderFactoryBundle::NotifyUpdateOnMainOrWorkerThread(
|
||||||
ObserverPtrAndTaskRunner* observer_bundle,
|
ObserverPtrAndTaskRunner* observer_bundle,
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> update_info) {
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo> update_info) {
|
||||||
observer_bundle->second->PostTask(
|
observer_bundle->second->PostTask(
|
||||||
FROM_HERE,
|
FROM_HERE,
|
||||||
base::BindOnce(&TrackedChildURLLoaderFactoryBundle::OnUpdate,
|
base::BindOnce(&TrackedChildURLLoaderFactoryBundle::OnUpdate,
|
||||||
|
@@ -36,7 +36,7 @@ class CONTENT_EXPORT TrackedChildURLLoaderFactoryBundleInfo
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
// ChildURLLoaderFactoryBundleInfo overrides.
|
// ChildURLLoaderFactoryBundleInfo overrides.
|
||||||
scoped_refptr<SharedURLLoaderFactory> CreateFactory() override;
|
scoped_refptr<network::SharedURLLoaderFactory> CreateFactory() override;
|
||||||
|
|
||||||
std::unique_ptr<HostPtrAndTaskRunner> main_thread_host_bundle_;
|
std::unique_ptr<HostPtrAndTaskRunner> main_thread_host_bundle_;
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ class CONTENT_EXPORT TrackedChildURLLoaderFactoryBundle
|
|||||||
|
|
||||||
// ChildURLLoaderFactoryBundle overrides.
|
// ChildURLLoaderFactoryBundle overrides.
|
||||||
// Returns |std::unique_ptr<TrackedChildURLLoaderFactoryBundleInfo>|.
|
// Returns |std::unique_ptr<TrackedChildURLLoaderFactoryBundleInfo>|.
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> Clone() override;
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo> Clone() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class HostChildURLLoaderFactoryBundle;
|
friend class HostChildURLLoaderFactoryBundle;
|
||||||
@@ -83,7 +83,7 @@ class CONTENT_EXPORT TrackedChildURLLoaderFactoryBundle
|
|||||||
void RemoveObserverOnMainThread();
|
void RemoveObserverOnMainThread();
|
||||||
|
|
||||||
// Callback method to receive updates from the host bundle.
|
// Callback method to receive updates from the host bundle.
|
||||||
void OnUpdate(std::unique_ptr<SharedURLLoaderFactoryInfo> info);
|
void OnUpdate(std::unique_ptr<network::SharedURLLoaderFactoryInfo> info);
|
||||||
|
|
||||||
// |WeakPtr| and |TaskRunner| of the host bundle. Can be copied and passed
|
// |WeakPtr| and |TaskRunner| of the host bundle. Can be copied and passed
|
||||||
// across sequences.
|
// across sequences.
|
||||||
@@ -111,7 +111,7 @@ class CONTENT_EXPORT HostChildURLLoaderFactoryBundle
|
|||||||
|
|
||||||
// ChildURLLoaderFactoryBundle overrides.
|
// ChildURLLoaderFactoryBundle overrides.
|
||||||
// Returns |std::unique_ptr<TrackedChildURLLoaderFactoryBundleInfo>|.
|
// Returns |std::unique_ptr<TrackedChildURLLoaderFactoryBundleInfo>|.
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> Clone() override;
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo> Clone() override;
|
||||||
bool IsHostChildURLLoaderFactoryBundle() const override;
|
bool IsHostChildURLLoaderFactoryBundle() const override;
|
||||||
|
|
||||||
// Update this bundle with |info|, and post cloned |info| to tracked bundles.
|
// Update this bundle with |info|, and post cloned |info| to tracked bundles.
|
||||||
@@ -140,7 +140,7 @@ class CONTENT_EXPORT HostChildURLLoaderFactoryBundle
|
|||||||
// tracked bundle has been destroyed.
|
// tracked bundle has been destroyed.
|
||||||
void NotifyUpdateOnMainOrWorkerThread(
|
void NotifyUpdateOnMainOrWorkerThread(
|
||||||
ObserverPtrAndTaskRunner* observer_bundle,
|
ObserverPtrAndTaskRunner* observer_bundle,
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> update_info);
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo> update_info);
|
||||||
|
|
||||||
// Contains |WeakPtr| and |TaskRunner| to tracked bundles.
|
// Contains |WeakPtr| and |TaskRunner| to tracked bundles.
|
||||||
std::unique_ptr<ObserverList> observer_list_ = nullptr;
|
std::unique_ptr<ObserverList> observer_list_ = nullptr;
|
||||||
|
@@ -359,7 +359,7 @@ StreamOverrideParameters::~StreamOverrideParameters() {
|
|||||||
|
|
||||||
WebURLLoaderFactoryImpl::WebURLLoaderFactoryImpl(
|
WebURLLoaderFactoryImpl::WebURLLoaderFactoryImpl(
|
||||||
base::WeakPtr<ResourceDispatcher> resource_dispatcher,
|
base::WeakPtr<ResourceDispatcher> resource_dispatcher,
|
||||||
scoped_refptr<SharedURLLoaderFactory> loader_factory)
|
scoped_refptr<network::SharedURLLoaderFactory> loader_factory)
|
||||||
: resource_dispatcher_(std::move(resource_dispatcher)),
|
: resource_dispatcher_(std::move(resource_dispatcher)),
|
||||||
loader_factory_(std::move(loader_factory)) {}
|
loader_factory_(std::move(loader_factory)) {}
|
||||||
|
|
||||||
@@ -399,7 +399,7 @@ class WebURLLoaderImpl::Context : public base::RefCounted<Context> {
|
|||||||
Context(WebURLLoaderImpl* loader,
|
Context(WebURLLoaderImpl* loader,
|
||||||
ResourceDispatcher* resource_dispatcher,
|
ResourceDispatcher* resource_dispatcher,
|
||||||
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
|
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
|
||||||
scoped_refptr<SharedURLLoaderFactory> factory,
|
scoped_refptr<network::SharedURLLoaderFactory> factory,
|
||||||
mojom::KeepAliveHandlePtr keep_alive_handle);
|
mojom::KeepAliveHandlePtr keep_alive_handle);
|
||||||
|
|
||||||
ResourceDispatcher* resource_dispatcher() { return resource_dispatcher_; }
|
ResourceDispatcher* resource_dispatcher() { return resource_dispatcher_; }
|
||||||
@@ -463,7 +463,7 @@ class WebURLLoaderImpl::Context : public base::RefCounted<Context> {
|
|||||||
DeferState defers_loading_;
|
DeferState defers_loading_;
|
||||||
int request_id_;
|
int request_id_;
|
||||||
|
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory_;
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
|
||||||
};
|
};
|
||||||
|
|
||||||
// A thin wrapper class for Context to ensure its lifetime while it is
|
// A thin wrapper class for Context to ensure its lifetime while it is
|
||||||
@@ -526,7 +526,7 @@ WebURLLoaderImpl::Context::Context(
|
|||||||
WebURLLoaderImpl* loader,
|
WebURLLoaderImpl* loader,
|
||||||
ResourceDispatcher* resource_dispatcher,
|
ResourceDispatcher* resource_dispatcher,
|
||||||
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
|
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
||||||
mojom::KeepAliveHandlePtr keep_alive_handle_ptr)
|
mojom::KeepAliveHandlePtr keep_alive_handle_ptr)
|
||||||
: loader_(loader),
|
: loader_(loader),
|
||||||
use_stream_on_response_(false),
|
use_stream_on_response_(false),
|
||||||
@@ -1141,7 +1141,7 @@ void WebURLLoaderImpl::RequestPeerImpl::OnCompletedRequest(
|
|||||||
WebURLLoaderImpl::WebURLLoaderImpl(
|
WebURLLoaderImpl::WebURLLoaderImpl(
|
||||||
ResourceDispatcher* resource_dispatcher,
|
ResourceDispatcher* resource_dispatcher,
|
||||||
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
|
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory)
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory)
|
||||||
: WebURLLoaderImpl(resource_dispatcher,
|
: WebURLLoaderImpl(resource_dispatcher,
|
||||||
std::move(task_runner),
|
std::move(task_runner),
|
||||||
std::move(url_loader_factory),
|
std::move(url_loader_factory),
|
||||||
@@ -1150,7 +1150,7 @@ WebURLLoaderImpl::WebURLLoaderImpl(
|
|||||||
WebURLLoaderImpl::WebURLLoaderImpl(
|
WebURLLoaderImpl::WebURLLoaderImpl(
|
||||||
ResourceDispatcher* resource_dispatcher,
|
ResourceDispatcher* resource_dispatcher,
|
||||||
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
|
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
||||||
mojom::KeepAliveHandlePtr keep_alive_handle)
|
mojom::KeepAliveHandlePtr keep_alive_handle)
|
||||||
: context_(new Context(this,
|
: context_(new Context(this,
|
||||||
resource_dispatcher,
|
resource_dispatcher,
|
||||||
|
@@ -12,10 +12,10 @@
|
|||||||
#include "base/memory/ref_counted.h"
|
#include "base/memory/ref_counted.h"
|
||||||
#include "content/common/content_export.h"
|
#include "content/common/content_export.h"
|
||||||
#include "content/common/frame.mojom.h"
|
#include "content/common/frame.mojom.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
|
||||||
#include "mojo/public/cpp/system/data_pipe.h"
|
#include "mojo/public/cpp/system/data_pipe.h"
|
||||||
#include "net/url_request/redirect_info.h"
|
#include "net/url_request/redirect_info.h"
|
||||||
#include "services/network/public/cpp/resource_response.h"
|
#include "services/network/public/cpp/resource_response.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
#include "services/network/public/mojom/url_loader.mojom.h"
|
#include "services/network/public/mojom/url_loader.mojom.h"
|
||||||
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
||||||
#include "third_party/WebKit/public/platform/WebURLLoader.h"
|
#include "third_party/WebKit/public/platform/WebURLLoader.h"
|
||||||
@@ -56,8 +56,9 @@ struct CONTENT_EXPORT StreamOverrideParameters {
|
|||||||
class CONTENT_EXPORT WebURLLoaderFactoryImpl
|
class CONTENT_EXPORT WebURLLoaderFactoryImpl
|
||||||
: public blink::WebURLLoaderFactory {
|
: public blink::WebURLLoaderFactory {
|
||||||
public:
|
public:
|
||||||
WebURLLoaderFactoryImpl(base::WeakPtr<ResourceDispatcher> resource_dispatcher,
|
WebURLLoaderFactoryImpl(
|
||||||
scoped_refptr<SharedURLLoaderFactory> loader_factory);
|
base::WeakPtr<ResourceDispatcher> resource_dispatcher,
|
||||||
|
scoped_refptr<network::SharedURLLoaderFactory> loader_factory);
|
||||||
~WebURLLoaderFactoryImpl() override;
|
~WebURLLoaderFactoryImpl() override;
|
||||||
|
|
||||||
// Creates a test-only factory which can be used only for data URLs.
|
// Creates a test-only factory which can be used only for data URLs.
|
||||||
@@ -69,21 +70,23 @@ class CONTENT_EXPORT WebURLLoaderFactoryImpl
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
base::WeakPtr<ResourceDispatcher> resource_dispatcher_;
|
base::WeakPtr<ResourceDispatcher> resource_dispatcher_;
|
||||||
scoped_refptr<SharedURLLoaderFactory> loader_factory_;
|
scoped_refptr<network::SharedURLLoaderFactory> loader_factory_;
|
||||||
DISALLOW_COPY_AND_ASSIGN(WebURLLoaderFactoryImpl);
|
DISALLOW_COPY_AND_ASSIGN(WebURLLoaderFactoryImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CONTENT_EXPORT WebURLLoaderImpl : public blink::WebURLLoader {
|
class CONTENT_EXPORT WebURLLoaderImpl : public blink::WebURLLoader {
|
||||||
public:
|
public:
|
||||||
WebURLLoaderImpl(ResourceDispatcher* resource_dispatcher,
|
WebURLLoaderImpl(
|
||||||
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
|
ResourceDispatcher* resource_dispatcher,
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory);
|
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
|
||||||
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory);
|
||||||
// When non-null |keep_alive_handle| is specified, this loader prolongs
|
// When non-null |keep_alive_handle| is specified, this loader prolongs
|
||||||
// this render process's lifetime.
|
// this render process's lifetime.
|
||||||
WebURLLoaderImpl(ResourceDispatcher* resource_dispatcher,
|
WebURLLoaderImpl(
|
||||||
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
|
ResourceDispatcher* resource_dispatcher,
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
|
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
|
||||||
mojom::KeepAliveHandlePtr keep_alive_handle);
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
||||||
|
mojom::KeepAliveHandlePtr keep_alive_handle);
|
||||||
~WebURLLoaderImpl() override;
|
~WebURLLoaderImpl() override;
|
||||||
|
|
||||||
static void PopulateURLResponse(const blink::WebURL& url,
|
static void PopulateURLResponse(const blink::WebURL& url,
|
||||||
|
@@ -76,7 +76,7 @@ class TestResourceDispatcher : public ResourceDispatcher {
|
|||||||
const url::Origin& frame_origin,
|
const url::Origin& frame_origin,
|
||||||
const net::NetworkTrafficAnnotationTag& traffic_annotation,
|
const net::NetworkTrafficAnnotationTag& traffic_annotation,
|
||||||
SyncLoadResponse* response,
|
SyncLoadResponse* response,
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
||||||
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles) override {
|
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles) override {
|
||||||
*response = sync_load_response_;
|
*response = sync_load_response_;
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ class TestResourceDispatcher : public ResourceDispatcher {
|
|||||||
const net::NetworkTrafficAnnotationTag& traffic_annotation,
|
const net::NetworkTrafficAnnotationTag& traffic_annotation,
|
||||||
bool is_sync,
|
bool is_sync,
|
||||||
std::unique_ptr<RequestPeer> peer,
|
std::unique_ptr<RequestPeer> peer,
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
||||||
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
|
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
|
||||||
network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
|
network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
|
||||||
base::OnceClosure* continue_navigation_function) override {
|
base::OnceClosure* continue_navigation_function) override {
|
||||||
|
@@ -3570,7 +3570,7 @@ RenderFrameImpl::CreateWorkerFetchContext() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RenderThreadImpl* render_thread = RenderThreadImpl::current();
|
RenderThreadImpl* render_thread = RenderThreadImpl::current();
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo>
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
|
||||||
direct_network_loader_factory_info;
|
direct_network_loader_factory_info;
|
||||||
// Could be null in tests.
|
// Could be null in tests.
|
||||||
if (render_thread) {
|
if (render_thread) {
|
||||||
@@ -4097,7 +4097,7 @@ void RenderFrameImpl::DidCreateDocumentLoader(
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
RenderThreadImpl* render_thread = RenderThreadImpl::current();
|
RenderThreadImpl* render_thread = RenderThreadImpl::current();
|
||||||
scoped_refptr<SharedURLLoaderFactory> direct_network_loader_factory;
|
scoped_refptr<network::SharedURLLoaderFactory> direct_network_loader_factory;
|
||||||
if (render_thread) {
|
if (render_thread) {
|
||||||
direct_network_loader_factory =
|
direct_network_loader_factory =
|
||||||
base::MakeRefCounted<PossiblyAssociatedWrapperSharedURLLoaderFactory>(
|
base::MakeRefCounted<PossiblyAssociatedWrapperSharedURLLoaderFactory>(
|
||||||
@@ -7318,7 +7318,8 @@ void RenderFrameImpl::SetAccessibilityModeForTest(ui::AXMode new_mode) {
|
|||||||
OnSetAccessibilityMode(new_mode);
|
OnSetAccessibilityMode(new_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_refptr<SharedURLLoaderFactory> RenderFrameImpl::GetURLLoaderFactory() {
|
scoped_refptr<network::SharedURLLoaderFactory>
|
||||||
|
RenderFrameImpl::GetURLLoaderFactory() {
|
||||||
return GetLoaderFactoryBundle();
|
return GetLoaderFactoryBundle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -500,7 +500,7 @@ class CONTENT_EXPORT RenderFrameImpl
|
|||||||
blink::TaskType task_type) override;
|
blink::TaskType task_type) override;
|
||||||
int GetEnabledBindings() const override;
|
int GetEnabledBindings() const override;
|
||||||
void SetAccessibilityModeForTest(ui::AXMode new_mode) override;
|
void SetAccessibilityModeForTest(ui::AXMode new_mode) override;
|
||||||
scoped_refptr<SharedURLLoaderFactory> GetURLLoaderFactory() override;
|
scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory() override;
|
||||||
|
|
||||||
// blink::mojom::EngagementClient implementation:
|
// blink::mojom::EngagementClient implementation:
|
||||||
void SetEngagementLevel(const url::Origin& origin,
|
void SetEngagementLevel(const url::Origin& origin,
|
||||||
|
@@ -18,7 +18,8 @@ namespace content {
|
|||||||
|
|
||||||
ServiceWorkerFetchContextImpl::ServiceWorkerFetchContextImpl(
|
ServiceWorkerFetchContextImpl::ServiceWorkerFetchContextImpl(
|
||||||
const GURL& worker_script_url,
|
const GURL& worker_script_url,
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> url_loader_factory_info,
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
|
||||||
|
url_loader_factory_info,
|
||||||
int service_worker_provider_id,
|
int service_worker_provider_id,
|
||||||
std::unique_ptr<URLLoaderThrottleProvider> throttle_provider)
|
std::unique_ptr<URLLoaderThrottleProvider> throttle_provider)
|
||||||
: worker_script_url_(worker_script_url),
|
: worker_script_url_(worker_script_url),
|
||||||
@@ -31,8 +32,8 @@ ServiceWorkerFetchContextImpl::~ServiceWorkerFetchContextImpl() {}
|
|||||||
void ServiceWorkerFetchContextImpl::InitializeOnWorkerThread() {
|
void ServiceWorkerFetchContextImpl::InitializeOnWorkerThread() {
|
||||||
resource_dispatcher_ = std::make_unique<ResourceDispatcher>();
|
resource_dispatcher_ = std::make_unique<ResourceDispatcher>();
|
||||||
|
|
||||||
url_loader_factory_ =
|
url_loader_factory_ = network::SharedURLLoaderFactory::Create(
|
||||||
SharedURLLoaderFactory::Create(std::move(url_loader_factory_info_));
|
std::move(url_loader_factory_info_));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<blink::WebURLLoaderFactory>
|
std::unique_ptr<blink::WebURLLoaderFactory>
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
#ifndef CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_FETCH_CONTEXT_IMPL_H_
|
#ifndef CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_FETCH_CONTEXT_IMPL_H_
|
||||||
#define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_FETCH_CONTEXT_IMPL_H_
|
#define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_FETCH_CONTEXT_IMPL_H_
|
||||||
|
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
#include "third_party/WebKit/public/platform/WebWorkerFetchContext.h"
|
#include "third_party/WebKit/public/platform/WebWorkerFetchContext.h"
|
||||||
#include "url/gurl.h"
|
#include "url/gurl.h"
|
||||||
|
|
||||||
@@ -17,7 +17,8 @@ class ServiceWorkerFetchContextImpl : public blink::WebWorkerFetchContext {
|
|||||||
public:
|
public:
|
||||||
ServiceWorkerFetchContextImpl(
|
ServiceWorkerFetchContextImpl(
|
||||||
const GURL& worker_script_url,
|
const GURL& worker_script_url,
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> url_loader_factory_info,
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
|
||||||
|
url_loader_factory_info,
|
||||||
int service_worker_provider_id,
|
int service_worker_provider_id,
|
||||||
std::unique_ptr<URLLoaderThrottleProvider> throttle_provider);
|
std::unique_ptr<URLLoaderThrottleProvider> throttle_provider);
|
||||||
~ServiceWorkerFetchContextImpl() override;
|
~ServiceWorkerFetchContextImpl() override;
|
||||||
@@ -34,12 +35,12 @@ class ServiceWorkerFetchContextImpl : public blink::WebWorkerFetchContext {
|
|||||||
private:
|
private:
|
||||||
const GURL worker_script_url_;
|
const GURL worker_script_url_;
|
||||||
// Consumed on the worker thread to create |url_loader_factory_|.
|
// Consumed on the worker thread to create |url_loader_factory_|.
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> url_loader_factory_info_;
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo> url_loader_factory_info_;
|
||||||
const int service_worker_provider_id_;
|
const int service_worker_provider_id_;
|
||||||
|
|
||||||
// Initialized on the worker thread when InitializeOnWorkerThread() is called.
|
// Initialized on the worker thread when InitializeOnWorkerThread() is called.
|
||||||
std::unique_ptr<ResourceDispatcher> resource_dispatcher_;
|
std::unique_ptr<ResourceDispatcher> resource_dispatcher_;
|
||||||
scoped_refptr<SharedURLLoaderFactory> url_loader_factory_;
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
|
||||||
|
|
||||||
std::unique_ptr<URLLoaderThrottleProvider> throttle_provider_;
|
std::unique_ptr<URLLoaderThrottleProvider> throttle_provider_;
|
||||||
};
|
};
|
||||||
|
@@ -12,13 +12,13 @@
|
|||||||
#include "content/common/service_worker/service_worker_utils.h"
|
#include "content/common/service_worker/service_worker_utils.h"
|
||||||
#include "content/common/weak_wrapper_shared_url_loader_factory.h"
|
#include "content/common/weak_wrapper_shared_url_loader_factory.h"
|
||||||
#include "content/public/common/browser_side_navigation_policy.h"
|
#include "content/public/common/browser_side_navigation_policy.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
|
||||||
#include "content/renderer/loader/request_extra_data.h"
|
#include "content/renderer/loader/request_extra_data.h"
|
||||||
#include "content/renderer/render_thread_impl.h"
|
#include "content/renderer/render_thread_impl.h"
|
||||||
#include "content/renderer/service_worker/service_worker_dispatcher.h"
|
#include "content/renderer/service_worker/service_worker_dispatcher.h"
|
||||||
#include "content/renderer/service_worker/service_worker_provider_context.h"
|
#include "content/renderer/service_worker/service_worker_provider_context.h"
|
||||||
#include "ipc/ipc_sync_channel.h"
|
#include "ipc/ipc_sync_channel.h"
|
||||||
#include "mojo/public/cpp/bindings/associated_group.h"
|
#include "mojo/public/cpp/bindings/associated_group.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
#include "third_party/WebKit/public/common/frame/sandbox_flags.h"
|
#include "third_party/WebKit/public/common/frame/sandbox_flags.h"
|
||||||
#include "third_party/WebKit/public/mojom/service_worker/service_worker_object.mojom.h"
|
#include "third_party/WebKit/public/mojom/service_worker/service_worker_object.mojom.h"
|
||||||
#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
|
#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
|
||||||
@@ -149,7 +149,7 @@ ServiceWorkerNetworkProvider::CreateForNavigation(
|
|||||||
blink::WebLocalFrame* frame,
|
blink::WebLocalFrame* frame,
|
||||||
bool content_initiated,
|
bool content_initiated,
|
||||||
mojom::ControllerServiceWorkerInfoPtr controller_info,
|
mojom::ControllerServiceWorkerInfoPtr controller_info,
|
||||||
scoped_refptr<SharedURLLoaderFactory> default_loader_factory) {
|
scoped_refptr<network::SharedURLLoaderFactory> default_loader_factory) {
|
||||||
bool browser_side_navigation = IsBrowserSideNavigationEnabled();
|
bool browser_side_navigation = IsBrowserSideNavigationEnabled();
|
||||||
bool should_create_provider_for_window = false;
|
bool should_create_provider_for_window = false;
|
||||||
int service_worker_provider_id = kInvalidServiceWorkerProviderId;
|
int service_worker_provider_id = kInvalidServiceWorkerProviderId;
|
||||||
@@ -266,7 +266,7 @@ ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider(
|
|||||||
int browser_provider_id,
|
int browser_provider_id,
|
||||||
bool is_parent_frame_secure,
|
bool is_parent_frame_secure,
|
||||||
mojom::ControllerServiceWorkerInfoPtr controller_info,
|
mojom::ControllerServiceWorkerInfoPtr controller_info,
|
||||||
scoped_refptr<SharedURLLoaderFactory> default_loader_factory) {
|
scoped_refptr<network::SharedURLLoaderFactory> default_loader_factory) {
|
||||||
if (browser_provider_id == kInvalidServiceWorkerProviderId)
|
if (browser_provider_id == kInvalidServiceWorkerProviderId)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@@ -25,6 +25,10 @@ class WebLocalFrame;
|
|||||||
class WebServiceWorkerNetworkProvider;
|
class WebServiceWorkerNetworkProvider;
|
||||||
} // namespace blink
|
} // namespace blink
|
||||||
|
|
||||||
|
namespace network {
|
||||||
|
class SharedURLLoaderFactory;
|
||||||
|
} // namespace network
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
|
|
||||||
namespace mojom {
|
namespace mojom {
|
||||||
@@ -33,7 +37,6 @@ class URLLoaderFactory;
|
|||||||
|
|
||||||
struct RequestNavigationParams;
|
struct RequestNavigationParams;
|
||||||
class ServiceWorkerProviderContext;
|
class ServiceWorkerProviderContext;
|
||||||
class SharedURLLoaderFactory;
|
|
||||||
class ThreadSafeSender;
|
class ThreadSafeSender;
|
||||||
|
|
||||||
// ServiceWorkerNetworkProvider enables the browser process to recognize
|
// ServiceWorkerNetworkProvider enables the browser process to recognize
|
||||||
@@ -71,7 +74,7 @@ class CONTENT_EXPORT ServiceWorkerNetworkProvider {
|
|||||||
blink::WebLocalFrame* frame,
|
blink::WebLocalFrame* frame,
|
||||||
bool content_initiated,
|
bool content_initiated,
|
||||||
mojom::ControllerServiceWorkerInfoPtr controller_info,
|
mojom::ControllerServiceWorkerInfoPtr controller_info,
|
||||||
scoped_refptr<SharedURLLoaderFactory> default_loader_factory);
|
scoped_refptr<network::SharedURLLoaderFactory> default_loader_factory);
|
||||||
|
|
||||||
// Creates a ServiceWorkerNetworkProvider for a shared worker (as a
|
// Creates a ServiceWorkerNetworkProvider for a shared worker (as a
|
||||||
// non-document service worker client).
|
// non-document service worker client).
|
||||||
@@ -120,7 +123,7 @@ class CONTENT_EXPORT ServiceWorkerNetworkProvider {
|
|||||||
int provider_id,
|
int provider_id,
|
||||||
bool is_parent_frame_secure,
|
bool is_parent_frame_secure,
|
||||||
mojom::ControllerServiceWorkerInfoPtr controller_info,
|
mojom::ControllerServiceWorkerInfoPtr controller_info,
|
||||||
scoped_refptr<SharedURLLoaderFactory> default_loader_factory);
|
scoped_refptr<network::SharedURLLoaderFactory> default_loader_factory);
|
||||||
|
|
||||||
// This is for controllers, used in CreateForController.
|
// This is for controllers, used in CreateForController.
|
||||||
explicit ServiceWorkerNetworkProvider(
|
explicit ServiceWorkerNetworkProvider(
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
#include "content/common/service_worker/service_worker_utils.h"
|
#include "content/common/service_worker/service_worker_utils.h"
|
||||||
#include "content/public/common/browser_side_navigation_policy.h"
|
#include "content/public/common/browser_side_navigation_policy.h"
|
||||||
#include "content/public/common/service_names.mojom.h"
|
#include "content/public/common/service_names.mojom.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
|
||||||
#include "content/renderer/service_worker/controller_service_worker_connector.h"
|
#include "content/renderer/service_worker/controller_service_worker_connector.h"
|
||||||
#include "content/renderer/service_worker/service_worker_dispatcher.h"
|
#include "content/renderer/service_worker/service_worker_dispatcher.h"
|
||||||
#include "content/renderer/service_worker/service_worker_subresource_loader.h"
|
#include "content/renderer/service_worker/service_worker_subresource_loader.h"
|
||||||
@@ -26,6 +25,7 @@
|
|||||||
#include "content/renderer/worker_thread_registry.h"
|
#include "content/renderer/worker_thread_registry.h"
|
||||||
#include "mojo/public/cpp/bindings/strong_associated_binding.h"
|
#include "mojo/public/cpp/bindings/strong_associated_binding.h"
|
||||||
#include "mojo/public/cpp/bindings/strong_binding.h"
|
#include "mojo/public/cpp/bindings/strong_binding.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
||||||
#include "services/service_manager/public/cpp/connector.h"
|
#include "services/service_manager/public/cpp/connector.h"
|
||||||
#include "services/service_manager/public/cpp/interface_provider.h"
|
#include "services/service_manager/public/cpp/interface_provider.h"
|
||||||
@@ -37,7 +37,7 @@ namespace content {
|
|||||||
// Holds state for service worker clients.
|
// Holds state for service worker clients.
|
||||||
struct ServiceWorkerProviderContext::ProviderStateForClient {
|
struct ServiceWorkerProviderContext::ProviderStateForClient {
|
||||||
explicit ProviderStateForClient(
|
explicit ProviderStateForClient(
|
||||||
scoped_refptr<SharedURLLoaderFactory> default_loader_factory)
|
scoped_refptr<network::SharedURLLoaderFactory> default_loader_factory)
|
||||||
: default_loader_factory(std::move(default_loader_factory)) {}
|
: default_loader_factory(std::move(default_loader_factory)) {}
|
||||||
~ProviderStateForClient() = default;
|
~ProviderStateForClient() = default;
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ struct ServiceWorkerProviderContext::ProviderStateForClient {
|
|||||||
|
|
||||||
// S13nServiceWorker:
|
// S13nServiceWorker:
|
||||||
// Used when we create |subresource_loader_factory|.
|
// Used when we create |subresource_loader_factory|.
|
||||||
scoped_refptr<SharedURLLoaderFactory> default_loader_factory;
|
scoped_refptr<network::SharedURLLoaderFactory> default_loader_factory;
|
||||||
|
|
||||||
// Tracks feature usage for UseCounter.
|
// Tracks feature usage for UseCounter.
|
||||||
std::set<blink::mojom::WebFeature> used_features;
|
std::set<blink::mojom::WebFeature> used_features;
|
||||||
@@ -100,7 +100,7 @@ ServiceWorkerProviderContext::ServiceWorkerProviderContext(
|
|||||||
mojom::ServiceWorkerContainerAssociatedRequest request,
|
mojom::ServiceWorkerContainerAssociatedRequest request,
|
||||||
mojom::ServiceWorkerContainerHostAssociatedPtrInfo host_ptr_info,
|
mojom::ServiceWorkerContainerHostAssociatedPtrInfo host_ptr_info,
|
||||||
mojom::ControllerServiceWorkerInfoPtr controller_info,
|
mojom::ControllerServiceWorkerInfoPtr controller_info,
|
||||||
scoped_refptr<SharedURLLoaderFactory> default_loader_factory)
|
scoped_refptr<network::SharedURLLoaderFactory> default_loader_factory)
|
||||||
: provider_type_(provider_type),
|
: provider_type_(provider_type),
|
||||||
provider_id_(provider_id),
|
provider_id_(provider_id),
|
||||||
main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
|
main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
|
||||||
|
@@ -15,9 +15,9 @@
|
|||||||
#include "content/common/service_worker/controller_service_worker.mojom.h"
|
#include "content/common/service_worker/controller_service_worker.mojom.h"
|
||||||
#include "content/common/service_worker/service_worker_container.mojom.h"
|
#include "content/common/service_worker/service_worker_container.mojom.h"
|
||||||
#include "content/common/service_worker/service_worker_provider.mojom.h"
|
#include "content/common/service_worker/service_worker_provider.mojom.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
|
||||||
#include "content/renderer/service_worker/web_service_worker_provider_impl.h"
|
#include "content/renderer/service_worker/web_service_worker_provider_impl.h"
|
||||||
#include "mojo/public/cpp/bindings/associated_binding.h"
|
#include "mojo/public/cpp/bindings/associated_binding.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
#include "third_party/WebKit/public/mojom/service_worker/service_worker_object.mojom.h"
|
#include "third_party/WebKit/public/mojom/service_worker/service_worker_object.mojom.h"
|
||||||
#include "third_party/WebKit/public/mojom/service_worker/service_worker_provider_type.mojom.h"
|
#include "third_party/WebKit/public/mojom/service_worker/service_worker_provider_type.mojom.h"
|
||||||
#include "third_party/WebKit/public/mojom/service_worker/service_worker_registration.mojom.h"
|
#include "third_party/WebKit/public/mojom/service_worker/service_worker_registration.mojom.h"
|
||||||
@@ -80,7 +80,7 @@ class CONTENT_EXPORT ServiceWorkerProviderContext
|
|||||||
mojom::ServiceWorkerContainerAssociatedRequest request,
|
mojom::ServiceWorkerContainerAssociatedRequest request,
|
||||||
mojom::ServiceWorkerContainerHostAssociatedPtrInfo host_ptr_info,
|
mojom::ServiceWorkerContainerHostAssociatedPtrInfo host_ptr_info,
|
||||||
mojom::ControllerServiceWorkerInfoPtr controller_info,
|
mojom::ControllerServiceWorkerInfoPtr controller_info,
|
||||||
scoped_refptr<SharedURLLoaderFactory> default_loader_factory);
|
scoped_refptr<network::SharedURLLoaderFactory> default_loader_factory);
|
||||||
|
|
||||||
// Constructor for service worker execution contexts.
|
// Constructor for service worker execution contexts.
|
||||||
ServiceWorkerProviderContext(
|
ServiceWorkerProviderContext(
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
#include "content/common/wrapper_shared_url_loader_factory.h"
|
#include "content/common/wrapper_shared_url_loader_factory.h"
|
||||||
#include "content/public/common/content_features.h"
|
#include "content/public/common/content_features.h"
|
||||||
#include "content/public/common/resource_type.h"
|
#include "content/public/common/resource_type.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
|
||||||
#include "content/renderer/service_worker/controller_service_worker_connector.h"
|
#include "content/renderer/service_worker/controller_service_worker_connector.h"
|
||||||
#include "content/renderer/service_worker/service_worker_dispatcher.h"
|
#include "content/renderer/service_worker/service_worker_dispatcher.h"
|
||||||
#include "content/renderer/service_worker/service_worker_provider_context.h"
|
#include "content/renderer/service_worker/service_worker_provider_context.h"
|
||||||
@@ -28,6 +27,7 @@
|
|||||||
#include "mojo/public/cpp/bindings/associated_binding_set.h"
|
#include "mojo/public/cpp/bindings/associated_binding_set.h"
|
||||||
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
|
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
|
||||||
#include "services/network/public/cpp/features.h"
|
#include "services/network/public/cpp/features.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
||||||
#include "services/network/test/test_url_loader_client.h"
|
#include "services/network/test/test_url_loader_client.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
@@ -327,7 +327,7 @@ class ServiceWorkerProviderContextTest : public testing::Test {
|
|||||||
// S13nServiceWorker:
|
// S13nServiceWorker:
|
||||||
base::test::ScopedFeatureList scoped_feature_list_;
|
base::test::ScopedFeatureList scoped_feature_list_;
|
||||||
FakeURLLoaderFactory fake_loader_factory_;
|
FakeURLLoaderFactory fake_loader_factory_;
|
||||||
scoped_refptr<SharedURLLoaderFactory> loader_factory_;
|
scoped_refptr<network::SharedURLLoaderFactory> loader_factory_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderContextTest);
|
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderContextTest);
|
||||||
};
|
};
|
||||||
|
@@ -12,13 +12,13 @@
|
|||||||
#include "content/common/service_worker/service_worker_types.h"
|
#include "content/common/service_worker/service_worker_types.h"
|
||||||
#include "content/common/service_worker/service_worker_utils.h"
|
#include "content/common/service_worker/service_worker_utils.h"
|
||||||
#include "content/public/common/content_features.h"
|
#include "content/public/common/content_features.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
|
||||||
#include "content/renderer/service_worker/controller_service_worker_connector.h"
|
#include "content/renderer/service_worker/controller_service_worker_connector.h"
|
||||||
#include "mojo/public/cpp/bindings/binding.h"
|
#include "mojo/public/cpp/bindings/binding.h"
|
||||||
#include "mojo/public/cpp/bindings/strong_binding.h"
|
#include "mojo/public/cpp/bindings/strong_binding.h"
|
||||||
#include "net/url_request/redirect_info.h"
|
#include "net/url_request/redirect_info.h"
|
||||||
#include "net/url_request/redirect_util.h"
|
#include "net/url_request/redirect_util.h"
|
||||||
#include "net/url_request/url_request.h"
|
#include "net/url_request/url_request.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
#include "ui/base/page_transition_types.h"
|
#include "ui/base/page_transition_types.h"
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
@@ -171,7 +171,7 @@ ServiceWorkerSubresourceLoader::ServiceWorkerSubresourceLoader(
|
|||||||
network::mojom::URLLoaderClientPtr client,
|
network::mojom::URLLoaderClientPtr client,
|
||||||
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
|
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
|
||||||
scoped_refptr<ControllerServiceWorkerConnector> controller_connector,
|
scoped_refptr<ControllerServiceWorkerConnector> controller_connector,
|
||||||
scoped_refptr<SharedURLLoaderFactory> network_loader_factory)
|
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory)
|
||||||
: redirect_limit_(net::URLRequest::kMaxRedirects),
|
: redirect_limit_(net::URLRequest::kMaxRedirects),
|
||||||
url_loader_client_(std::move(client)),
|
url_loader_client_(std::move(client)),
|
||||||
url_loader_binding_(this, std::move(request)),
|
url_loader_binding_(this, std::move(request)),
|
||||||
@@ -543,7 +543,7 @@ void ServiceWorkerSubresourceLoader::OnBlobReadingComplete(int net_error) {
|
|||||||
|
|
||||||
ServiceWorkerSubresourceLoaderFactory::ServiceWorkerSubresourceLoaderFactory(
|
ServiceWorkerSubresourceLoaderFactory::ServiceWorkerSubresourceLoaderFactory(
|
||||||
scoped_refptr<ControllerServiceWorkerConnector> controller_connector,
|
scoped_refptr<ControllerServiceWorkerConnector> controller_connector,
|
||||||
scoped_refptr<SharedURLLoaderFactory> network_loader_factory)
|
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory)
|
||||||
: controller_connector_(std::move(controller_connector)),
|
: controller_connector_(std::move(controller_connector)),
|
||||||
network_loader_factory_(std::move(network_loader_factory)) {
|
network_loader_factory_(std::move(network_loader_factory)) {
|
||||||
DCHECK(network_loader_factory_);
|
DCHECK(network_loader_factory_);
|
||||||
|
@@ -21,9 +21,12 @@
|
|||||||
#include "third_party/WebKit/public/mojom/service_worker/service_worker_event_status.mojom.h"
|
#include "third_party/WebKit/public/mojom/service_worker/service_worker_event_status.mojom.h"
|
||||||
#include "third_party/WebKit/public/mojom/service_worker/service_worker_stream_handle.mojom.h"
|
#include "third_party/WebKit/public/mojom/service_worker/service_worker_stream_handle.mojom.h"
|
||||||
|
|
||||||
|
namespace network {
|
||||||
|
class SharedURLLoaderFactory;
|
||||||
|
} // namespace network
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
|
|
||||||
class SharedURLLoaderFactory;
|
|
||||||
class ControllerServiceWorkerConnector;
|
class ControllerServiceWorkerConnector;
|
||||||
|
|
||||||
// S13nServiceWorker:
|
// S13nServiceWorker:
|
||||||
@@ -47,7 +50,7 @@ class CONTENT_EXPORT ServiceWorkerSubresourceLoader
|
|||||||
network::mojom::URLLoaderClientPtr client,
|
network::mojom::URLLoaderClientPtr client,
|
||||||
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
|
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
|
||||||
scoped_refptr<ControllerServiceWorkerConnector> controller_connector,
|
scoped_refptr<ControllerServiceWorkerConnector> controller_connector,
|
||||||
scoped_refptr<SharedURLLoaderFactory> network_loader_factory);
|
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory);
|
||||||
|
|
||||||
~ServiceWorkerSubresourceLoader() override;
|
~ServiceWorkerSubresourceLoader() override;
|
||||||
|
|
||||||
@@ -134,7 +137,7 @@ class CONTENT_EXPORT ServiceWorkerSubresourceLoader
|
|||||||
std::unique_ptr<StreamWaiter> stream_waiter_;
|
std::unique_ptr<StreamWaiter> stream_waiter_;
|
||||||
|
|
||||||
// For network fallback.
|
// For network fallback.
|
||||||
scoped_refptr<SharedURLLoaderFactory> network_loader_factory_;
|
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory_;
|
||||||
|
|
||||||
enum class Status {
|
enum class Status {
|
||||||
kNotStarted,
|
kNotStarted,
|
||||||
@@ -163,7 +166,7 @@ class CONTENT_EXPORT ServiceWorkerSubresourceLoaderFactory
|
|||||||
// any custom URLLoader factories.
|
// any custom URLLoader factories.
|
||||||
ServiceWorkerSubresourceLoaderFactory(
|
ServiceWorkerSubresourceLoaderFactory(
|
||||||
scoped_refptr<ControllerServiceWorkerConnector> controller_connector,
|
scoped_refptr<ControllerServiceWorkerConnector> controller_connector,
|
||||||
scoped_refptr<SharedURLLoaderFactory> network_loader_factory);
|
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory);
|
||||||
|
|
||||||
~ServiceWorkerSubresourceLoaderFactory() override;
|
~ServiceWorkerSubresourceLoaderFactory() override;
|
||||||
|
|
||||||
@@ -183,7 +186,7 @@ class CONTENT_EXPORT ServiceWorkerSubresourceLoaderFactory
|
|||||||
|
|
||||||
// A URLLoaderFactory that directly goes to network, used when a request
|
// A URLLoaderFactory that directly goes to network, used when a request
|
||||||
// falls back to network.
|
// falls back to network.
|
||||||
scoped_refptr<SharedURLLoaderFactory> network_loader_factory_;
|
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerSubresourceLoaderFactory);
|
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerSubresourceLoaderFactory);
|
||||||
};
|
};
|
||||||
|
@@ -12,7 +12,6 @@
|
|||||||
#include "content/common/wrapper_shared_url_loader_factory.h"
|
#include "content/common/wrapper_shared_url_loader_factory.h"
|
||||||
#include "content/public/common/content_features.h"
|
#include "content/public/common/content_features.h"
|
||||||
#include "content/public/common/resource_type.h"
|
#include "content/public/common/resource_type.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
|
||||||
#include "content/public/test/test_browser_thread_bundle.h"
|
#include "content/public/test/test_browser_thread_bundle.h"
|
||||||
#include "content/renderer/service_worker/controller_service_worker_connector.h"
|
#include "content/renderer/service_worker/controller_service_worker_connector.h"
|
||||||
#include "mojo/common/data_pipe_utils.h"
|
#include "mojo/common/data_pipe_utils.h"
|
||||||
@@ -22,6 +21,7 @@
|
|||||||
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
|
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
|
||||||
#include "net/url_request/url_request.h"
|
#include "net/url_request/url_request.h"
|
||||||
#include "services/network/public/cpp/features.h"
|
#include "services/network/public/cpp/features.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
#include "services/network/test/test_data_pipe_getter.h"
|
#include "services/network/test/test_data_pipe_getter.h"
|
||||||
#include "services/network/test/test_url_loader_client.h"
|
#include "services/network/test/test_url_loader_client.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
@@ -451,7 +451,7 @@ class ServiceWorkerSubresourceLoaderTest : public ::testing::Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TestBrowserThreadBundle thread_bundle_;
|
TestBrowserThreadBundle thread_bundle_;
|
||||||
scoped_refptr<SharedURLLoaderFactory> loader_factory_;
|
scoped_refptr<network::SharedURLLoaderFactory> loader_factory_;
|
||||||
scoped_refptr<ControllerServiceWorkerConnector> connector_;
|
scoped_refptr<ControllerServiceWorkerConnector> connector_;
|
||||||
FakeServiceWorkerContainerHost fake_container_host_;
|
FakeServiceWorkerContainerHost fake_container_host_;
|
||||||
FakeControllerServiceWorker fake_controller_;
|
FakeControllerServiceWorker fake_controller_;
|
||||||
|
@@ -29,8 +29,9 @@ namespace content {
|
|||||||
class WorkerFetchContextImpl::URLLoaderFactoryImpl
|
class WorkerFetchContextImpl::URLLoaderFactoryImpl
|
||||||
: public blink::WebURLLoaderFactory {
|
: public blink::WebURLLoaderFactory {
|
||||||
public:
|
public:
|
||||||
URLLoaderFactoryImpl(base::WeakPtr<ResourceDispatcher> resource_dispatcher,
|
URLLoaderFactoryImpl(
|
||||||
scoped_refptr<SharedURLLoaderFactory> loader_factory)
|
base::WeakPtr<ResourceDispatcher> resource_dispatcher,
|
||||||
|
scoped_refptr<network::SharedURLLoaderFactory> loader_factory)
|
||||||
: resource_dispatcher_(std::move(resource_dispatcher)),
|
: resource_dispatcher_(std::move(resource_dispatcher)),
|
||||||
loader_factory_(std::move(loader_factory)),
|
loader_factory_(std::move(loader_factory)),
|
||||||
weak_ptr_factory_(this) {}
|
weak_ptr_factory_(this) {}
|
||||||
@@ -87,8 +88,9 @@ class WorkerFetchContextImpl::URLLoaderFactoryImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
base::WeakPtr<ResourceDispatcher> resource_dispatcher_;
|
base::WeakPtr<ResourceDispatcher> resource_dispatcher_;
|
||||||
scoped_refptr<SharedURLLoaderFactory> loader_factory_;
|
scoped_refptr<network::SharedURLLoaderFactory> loader_factory_;
|
||||||
scoped_refptr<SharedURLLoaderFactory> service_worker_url_loader_factory_;
|
scoped_refptr<network::SharedURLLoaderFactory>
|
||||||
|
service_worker_url_loader_factory_;
|
||||||
base::WeakPtrFactory<URLLoaderFactoryImpl> weak_ptr_factory_;
|
base::WeakPtrFactory<URLLoaderFactoryImpl> weak_ptr_factory_;
|
||||||
DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryImpl);
|
DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryImpl);
|
||||||
};
|
};
|
||||||
@@ -96,8 +98,10 @@ class WorkerFetchContextImpl::URLLoaderFactoryImpl
|
|||||||
WorkerFetchContextImpl::WorkerFetchContextImpl(
|
WorkerFetchContextImpl::WorkerFetchContextImpl(
|
||||||
mojom::ServiceWorkerWorkerClientRequest service_worker_client_request,
|
mojom::ServiceWorkerWorkerClientRequest service_worker_client_request,
|
||||||
mojom::ServiceWorkerContainerHostPtrInfo service_worker_container_host_info,
|
mojom::ServiceWorkerContainerHostPtrInfo service_worker_container_host_info,
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> url_loader_factory_info,
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> direct_network_factory_info,
|
url_loader_factory_info,
|
||||||
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
|
||||||
|
direct_network_factory_info,
|
||||||
std::unique_ptr<URLLoaderThrottleProvider> throttle_provider)
|
std::unique_ptr<URLLoaderThrottleProvider> throttle_provider)
|
||||||
: binding_(this),
|
: binding_(this),
|
||||||
service_worker_client_request_(std::move(service_worker_client_request)),
|
service_worker_client_request_(std::move(service_worker_client_request)),
|
||||||
@@ -122,9 +126,9 @@ void WorkerFetchContextImpl::InitializeOnWorkerThread() {
|
|||||||
DCHECK(!binding_.is_bound());
|
DCHECK(!binding_.is_bound());
|
||||||
resource_dispatcher_ = std::make_unique<ResourceDispatcher>();
|
resource_dispatcher_ = std::make_unique<ResourceDispatcher>();
|
||||||
|
|
||||||
shared_url_loader_factory_ =
|
shared_url_loader_factory_ = network::SharedURLLoaderFactory::Create(
|
||||||
SharedURLLoaderFactory::Create(std::move(url_loader_factory_info_));
|
std::move(url_loader_factory_info_));
|
||||||
direct_network_loader_factory_ = SharedURLLoaderFactory::Create(
|
direct_network_loader_factory_ = network::SharedURLLoaderFactory::Create(
|
||||||
std::move(direct_network_loader_factory_info_));
|
std::move(direct_network_loader_factory_info_));
|
||||||
if (service_worker_client_request_.is_pending())
|
if (service_worker_client_request_.is_pending())
|
||||||
binding_.Bind(std::move(service_worker_client_request_));
|
binding_.Bind(std::move(service_worker_client_request_));
|
||||||
|
@@ -7,9 +7,9 @@
|
|||||||
|
|
||||||
#include "content/common/service_worker/service_worker_provider.mojom.h"
|
#include "content/common/service_worker/service_worker_provider.mojom.h"
|
||||||
#include "content/common/service_worker/service_worker_types.h"
|
#include "content/common/service_worker/service_worker_types.h"
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
|
||||||
#include "ipc/ipc_message.h"
|
#include "ipc/ipc_message.h"
|
||||||
#include "mojo/public/cpp/bindings/binding.h"
|
#include "mojo/public/cpp/bindings/binding.h"
|
||||||
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
||||||
#include "third_party/WebKit/public/mojom/blob/blob_registry.mojom.h"
|
#include "third_party/WebKit/public/mojom/blob/blob_registry.mojom.h"
|
||||||
#include "third_party/WebKit/public/mojom/service_worker/service_worker_object.mojom.h"
|
#include "third_party/WebKit/public/mojom/service_worker/service_worker_object.mojom.h"
|
||||||
@@ -45,8 +45,10 @@ class WorkerFetchContextImpl : public blink::WebWorkerFetchContext,
|
|||||||
mojom::ServiceWorkerWorkerClientRequest service_worker_client_request,
|
mojom::ServiceWorkerWorkerClientRequest service_worker_client_request,
|
||||||
mojom::ServiceWorkerContainerHostPtrInfo
|
mojom::ServiceWorkerContainerHostPtrInfo
|
||||||
service_worker_container_host_info,
|
service_worker_container_host_info,
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> url_loader_factory_info,
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> direct_network_factory_info,
|
url_loader_factory_info,
|
||||||
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
|
||||||
|
direct_network_factory_info,
|
||||||
std::unique_ptr<URLLoaderThrottleProvider> throttle_provider);
|
std::unique_ptr<URLLoaderThrottleProvider> throttle_provider);
|
||||||
~WorkerFetchContextImpl() override;
|
~WorkerFetchContextImpl() override;
|
||||||
|
|
||||||
@@ -104,9 +106,9 @@ class WorkerFetchContextImpl : public blink::WebWorkerFetchContext,
|
|||||||
// Consumed on the worker thread to create |service_worker_container_host_|.
|
// Consumed on the worker thread to create |service_worker_container_host_|.
|
||||||
mojom::ServiceWorkerContainerHostPtrInfo service_worker_container_host_info_;
|
mojom::ServiceWorkerContainerHostPtrInfo service_worker_container_host_info_;
|
||||||
// Consumed on the worker thread to create |shared_url_loader_factory_|.
|
// Consumed on the worker thread to create |shared_url_loader_factory_|.
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo> url_loader_factory_info_;
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo> url_loader_factory_info_;
|
||||||
// Consumed on the worker thread to create |direct_network_loader_factory_|.
|
// Consumed on the worker thread to create |direct_network_loader_factory_|.
|
||||||
std::unique_ptr<SharedURLLoaderFactoryInfo>
|
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
|
||||||
direct_network_loader_factory_info_;
|
direct_network_loader_factory_info_;
|
||||||
// Consumed on the worker thread to create |blob_registry_|.
|
// Consumed on the worker thread to create |blob_registry_|.
|
||||||
blink::mojom::BlobRegistryPtrInfo blob_registry_ptr_info_;
|
blink::mojom::BlobRegistryPtrInfo blob_registry_ptr_info_;
|
||||||
@@ -127,8 +129,8 @@ class WorkerFetchContextImpl : public blink::WebWorkerFetchContext,
|
|||||||
// specifically to initialize ServiceWorkerSubresourceLoader for network
|
// specifically to initialize ServiceWorkerSubresourceLoader for network
|
||||||
// load that is controlled by a service worker (when this worker is a
|
// load that is controlled by a service worker (when this worker is a
|
||||||
// client of the service worker).
|
// client of the service worker).
|
||||||
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory_;
|
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory_;
|
||||||
scoped_refptr<SharedURLLoaderFactory> direct_network_loader_factory_;
|
scoped_refptr<network::SharedURLLoaderFactory> direct_network_loader_factory_;
|
||||||
|
|
||||||
// S13nServiceWorker:
|
// S13nServiceWorker:
|
||||||
// Initialized on the worker thread when InitializeOnWorkerThread() is called.
|
// Initialized on the worker thread when InitializeOnWorkerThread() is called.
|
||||||
|
@@ -26,6 +26,8 @@ component("cpp") {
|
|||||||
"net_adapters.h",
|
"net_adapters.h",
|
||||||
"network_switches.cc",
|
"network_switches.cc",
|
||||||
"network_switches.h",
|
"network_switches.h",
|
||||||
|
"shared_url_loader_factory.cc",
|
||||||
|
"shared_url_loader_factory.h",
|
||||||
"simple_url_loader.cc",
|
"simple_url_loader.cc",
|
||||||
"simple_url_loader.h",
|
"simple_url_loader.h",
|
||||||
"simple_url_loader_stream_consumer.h",
|
"simple_url_loader_stream_consumer.h",
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "content/public/common/shared_url_loader_factory.h"
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
|
|
||||||
namespace content {
|
namespace network {
|
||||||
|
|
||||||
// static
|
// static
|
||||||
scoped_refptr<SharedURLLoaderFactory> SharedURLLoaderFactory::Create(
|
scoped_refptr<SharedURLLoaderFactory> SharedURLLoaderFactory::Create(
|
||||||
@@ -25,4 +25,4 @@ SharedURLLoaderFactoryInfo::SharedURLLoaderFactoryInfo() = default;
|
|||||||
|
|
||||||
SharedURLLoaderFactoryInfo::~SharedURLLoaderFactoryInfo() = default;
|
SharedURLLoaderFactoryInfo::~SharedURLLoaderFactoryInfo() = default;
|
||||||
|
|
||||||
} // namespace content
|
} // namespace network
|
@@ -2,19 +2,19 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#ifndef CONTENT_PUBLIC_COMMON_SHARED_URL_LOADER_FACTORY_H_
|
#ifndef SERVICES_NETWORK_PUBLIC_CPP_SHARED_URL_LOADER_FACTORY_H_
|
||||||
#define CONTENT_PUBLIC_COMMON_SHARED_URL_LOADER_FACTORY_H_
|
#define SERVICES_NETWORK_PUBLIC_CPP_SHARED_URL_LOADER_FACTORY_H_
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include "base/component_export.h"
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/ref_counted.h"
|
#include "base/memory/ref_counted.h"
|
||||||
#include "content/common/content_export.h"
|
|
||||||
#include "net/traffic_annotation/network_traffic_annotation.h"
|
#include "net/traffic_annotation/network_traffic_annotation.h"
|
||||||
#include "services/network/public/cpp/resource_request.h"
|
#include "services/network/public/cpp/resource_request.h"
|
||||||
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
||||||
|
|
||||||
namespace content {
|
namespace network {
|
||||||
|
|
||||||
class SharedURLLoaderFactoryInfo;
|
class SharedURLLoaderFactoryInfo;
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ class SharedURLLoaderFactoryInfo;
|
|||||||
// resulting SharedURLLoaderFactoryInfo instance to the target sequence. On the
|
// resulting SharedURLLoaderFactoryInfo instance to the target sequence. On the
|
||||||
// target sequence, call SharedURLLoaderFactory::Create() to convert the info
|
// target sequence, call SharedURLLoaderFactory::Create() to convert the info
|
||||||
// instance to a new SharedURLLoaderFactory.
|
// instance to a new SharedURLLoaderFactory.
|
||||||
class CONTENT_EXPORT SharedURLLoaderFactory
|
class COMPONENT_EXPORT(NETWORK_CPP) SharedURLLoaderFactory
|
||||||
: public base::RefCounted<SharedURLLoaderFactory>,
|
: public base::RefCounted<SharedURLLoaderFactory>,
|
||||||
public network::mojom::URLLoaderFactory {
|
public network::mojom::URLLoaderFactory {
|
||||||
public:
|
public:
|
||||||
@@ -46,7 +46,7 @@ class CONTENT_EXPORT SharedURLLoaderFactory
|
|||||||
// SharedURLLoaderFactory. It is not sequence safe but can be passed across
|
// SharedURLLoaderFactory. It is not sequence safe but can be passed across
|
||||||
// sequences. Please see the comments of SharedURLLoaderFactory for how this
|
// sequences. Please see the comments of SharedURLLoaderFactory for how this
|
||||||
// class is used.
|
// class is used.
|
||||||
class CONTENT_EXPORT SharedURLLoaderFactoryInfo {
|
class COMPONENT_EXPORT(NETWORK_CPP) SharedURLLoaderFactoryInfo {
|
||||||
public:
|
public:
|
||||||
SharedURLLoaderFactoryInfo();
|
SharedURLLoaderFactoryInfo();
|
||||||
virtual ~SharedURLLoaderFactoryInfo();
|
virtual ~SharedURLLoaderFactoryInfo();
|
||||||
@@ -63,6 +63,6 @@ class CONTENT_EXPORT SharedURLLoaderFactoryInfo {
|
|||||||
DISALLOW_COPY_AND_ASSIGN(SharedURLLoaderFactoryInfo);
|
DISALLOW_COPY_AND_ASSIGN(SharedURLLoaderFactoryInfo);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace content
|
} // namespace network
|
||||||
|
|
||||||
#endif // CONTENT_PUBLIC_COMMON_SHARED_URL_LOADER_FACTORY_H_
|
#endif // SERVICES_NETWORK_PUBLIC_CPP_SHARED_URL_LOADER_FACTORY_H_
|
Reference in New Issue
Block a user