Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: content/browser/loader/navigation_url_loader_network_service.h

Issue 2854723002: Network service: avoid requesting a new URLLoaderFactory for each NavigationURLLoaderNetworkService. (Closed)
Patch Set: . Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/loader/navigation_url_loader_network_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_NETWORK_SERVICE_H_ 5 #ifndef CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_NETWORK_SERVICE_H_
6 #define CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_NETWORK_SERVICE_H_ 6 #define CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_NETWORK_SERVICE_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "content/browser/loader/navigation_url_loader.h" 10 #include "content/browser/loader/navigation_url_loader.h"
(...skipping 22 matching lines...) Expand all
33 NavigationURLLoaderNetworkService( 33 NavigationURLLoaderNetworkService(
34 ResourceContext* resource_context, 34 ResourceContext* resource_context,
35 StoragePartition* storage_partition, 35 StoragePartition* storage_partition,
36 std::unique_ptr<NavigationRequestInfo> request_info, 36 std::unique_ptr<NavigationRequestInfo> request_info,
37 std::unique_ptr<NavigationUIData> navigation_ui_data, 37 std::unique_ptr<NavigationUIData> navigation_ui_data,
38 ServiceWorkerNavigationHandle* service_worker_handle, 38 ServiceWorkerNavigationHandle* service_worker_handle,
39 AppCacheNavigationHandle* appcache_handle, 39 AppCacheNavigationHandle* appcache_handle,
40 NavigationURLLoaderDelegate* delegate); 40 NavigationURLLoaderDelegate* delegate);
41 ~NavigationURLLoaderNetworkService() override; 41 ~NavigationURLLoaderNetworkService() override;
42 42
43 // Overrides the URLLoaderFactory for the next request. 43 // Overrides the URLLoaderFactory for subsequent requests. Passing a null
44 // pointer will restore the default behavior.
44 static CONTENT_EXPORT void OverrideURLLoaderFactoryForTesting( 45 static CONTENT_EXPORT void OverrideURLLoaderFactoryForTesting(
45 mojom::URLLoaderFactoryPtr url_loader_factory); 46 mojom::URLLoaderFactoryPtr url_loader_factory);
46 47
47 // NavigationURLLoader implementation: 48 // NavigationURLLoader implementation:
48 void FollowRedirect() override; 49 void FollowRedirect() override;
49 void ProceedWithResponse() override; 50 void ProceedWithResponse() override;
50 51
51 // mojom::URLLoaderClient implementation: 52 // mojom::URLLoaderClient implementation:
52 void OnReceiveResponse(const ResourceResponseHead& head, 53 void OnReceiveResponse(const ResourceResponseHead& head,
53 const base::Optional<net::SSLInfo>& ssl_info, 54 const base::Optional<net::SSLInfo>& ssl_info,
(...skipping 11 matching lines...) Expand all
65 void OnComplete( 66 void OnComplete(
66 const ResourceRequestCompletionStatus& completion_status) override; 67 const ResourceRequestCompletionStatus& completion_status) override;
67 68
68 // Initiates the request. 69 // Initiates the request.
69 void StartURLRequest(std::unique_ptr<ResourceRequest> request); 70 void StartURLRequest(std::unique_ptr<ResourceRequest> request);
70 71
71 private: 72 private:
72 void ConnectURLLoaderFactory( 73 void ConnectURLLoaderFactory(
73 std::unique_ptr<service_manager::Connector> connector); 74 std::unique_ptr<service_manager::Connector> connector);
74 75
76 mojom::URLLoaderFactory& GetURLLoaderFactory();
77
75 NavigationURLLoaderDelegate* delegate_; 78 NavigationURLLoaderDelegate* delegate_;
76 79
77 mojom::URLLoaderFactoryPtr url_loader_factory_;
78 mojo::Binding<mojom::URLLoaderClient> binding_; 80 mojo::Binding<mojom::URLLoaderClient> binding_;
79 mojom::URLLoaderAssociatedPtr url_loader_associated_ptr_; 81 mojom::URLLoaderAssociatedPtr url_loader_associated_ptr_;
80 scoped_refptr<ResourceResponse> response_; 82 scoped_refptr<ResourceResponse> response_;
81 SSLStatus ssl_status_; 83 SSLStatus ssl_status_;
82 84
83 base::WeakPtrFactory<NavigationURLLoaderNetworkService> weak_factory_; 85 base::WeakPtrFactory<NavigationURLLoaderNetworkService> weak_factory_;
84 86
85 DISALLOW_COPY_AND_ASSIGN(NavigationURLLoaderNetworkService); 87 DISALLOW_COPY_AND_ASSIGN(NavigationURLLoaderNetworkService);
86 }; 88 };
87 89
88 } // namespace content 90 } // namespace content
89 91
90 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_NETWORK_SERVICE_H_ 92 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_NETWORK_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/loader/navigation_url_loader_network_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698