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

Unified Diff: content/network/network_context.h

Issue 2874163004: Add support in the network service for different contexts. (Closed)
Patch Set: review comment and clang fixes 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/network/cache_url_loader.cc ('k') | content/network/network_context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/network/network_context.h
diff --git a/content/network/network_context.h b/content/network/network_context.h
index 324ac8e98286c22b41f54f16abdcf5ab834637fa..51834fe5295b24ad41af5e150606cfcc99849508 100644
--- a/content/network/network_context.h
+++ b/content/network/network_context.h
@@ -12,6 +12,10 @@
#include "base/macros.h"
#include "content/common/content_export.h"
+#include "content/common/network_service.mojom.h"
+#include "content/common/url_loader_factory.mojom.h"
+#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/strong_binding_set.h"
namespace net {
class URLRequestContext;
@@ -20,10 +24,13 @@ class URLRequestContext;
namespace content {
class URLLoaderImpl;
-class CONTENT_EXPORT NetworkContext {
+class NetworkContext : public mojom::NetworkContext {
public:
- NetworkContext();
- ~NetworkContext();
+ NetworkContext(mojom::NetworkContextRequest request,
+ mojom::NetworkContextParamsPtr params);
+ ~NetworkContext() override;
+
+ CONTENT_EXPORT static std::unique_ptr<NetworkContext> CreateForTesting();
net::URLRequestContext* url_request_context() {
return url_request_context_.get();
@@ -34,12 +41,21 @@ class CONTENT_EXPORT NetworkContext {
void RegisterURLLoader(URLLoaderImpl* url_loader);
void DeregisterURLLoader(URLLoaderImpl* url_loader);
+ // mojom::NetworkContext implementation:
+ void CreateURLLoaderFactory(mojom::URLLoaderFactoryRequest request,
+ uint32_t process_id) override;
+ void HandleViewCacheRequest(const GURL& url,
+ mojom::URLLoaderClientPtr client) override;
+
private:
- class MojoNetLog;
- std::unique_ptr<MojoNetLog> net_log_;
+ NetworkContext();
std::unique_ptr<net::URLRequestContext> url_request_context_;
+ // Put it below |url_request_context_| so that it outlives all the
+ // NetworkServiceURLLoaderFactoryImpl instances.
+ mojo::StrongBindingSet<mojom::URLLoaderFactory> loader_factory_bindings_;
+
// URLLoaderImpls register themselves with the NetworkContext so that they can
// be cleaned up when the NetworkContext goes away. This is needed as
// net::URLRequests held by URLLoaderImpls have to be gone when
@@ -50,6 +66,10 @@ class CONTENT_EXPORT NetworkContext {
// |url_loaders_| (as a url_loader might delete itself in Cleanup()).
bool in_shutdown_;
+ mojom::NetworkContextParamsPtr params_;
+
+ mojo::Binding<mojom::NetworkContext> binding_;
+
DISALLOW_COPY_AND_ASSIGN(NetworkContext);
};
« no previous file with comments | « content/network/cache_url_loader.cc ('k') | content/network/network_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698