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

Unified Diff: content/network/network_context.h

Issue 2817453002: Bring back the URLLoader from the old Mandoline network service. (Closed)
Patch Set: fix checkdeps Created 3 years, 8 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/net_adapters.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
new file mode 100644
index 0000000000000000000000000000000000000000..bb0856ba0e00c116d094a330af4276142f1e08a5
--- /dev/null
+++ b/content/network/network_context.h
@@ -0,0 +1,58 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_NETWORK_NETWORK_CONTEXT_H_
+#define CONTENT_NETWORK_NETWORK_CONTEXT_H_
+
+#include <stdint.h>
+
+#include <memory>
+#include <set>
+
+#include "base/macros.h"
+#include "content/common/content_export.h"
+
+namespace net {
+class URLRequestContext;
+}
+
+namespace content {
+class URLLoaderImpl;
+
+class CONTENT_EXPORT NetworkContext {
+ public:
+ NetworkContext();
+ ~NetworkContext();
+
+ net::URLRequestContext* url_request_context() {
+ return url_request_context_.get();
+ }
+
+ // These are called by individual url loaders as they are being created and
+ // destroyed.
+ void RegisterURLLoader(URLLoaderImpl* url_loader);
+ void DeregisterURLLoader(URLLoaderImpl* url_loader);
+
+ private:
+ class MojoNetLog;
+ std::unique_ptr<MojoNetLog> net_log_;
+
+ std::unique_ptr<net::URLRequestContext> url_request_context_;
+
+ // 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
+ // net::URLRequestContext (held by NetworkContext) is destroyed.
+ std::set<URLLoaderImpl*> url_loaders_;
+
+ // Set when entering the destructor, in order to avoid manipulations of the
+ // |url_loaders_| (as a url_loader might delete itself in Cleanup()).
+ bool in_shutdown_;
+
+ DISALLOW_COPY_AND_ASSIGN(NetworkContext);
+};
+
+} // namespace content
+
+#endif // CONTENT_NETWORK_NETWORK_CONTEXT_H_
« no previous file with comments | « content/network/net_adapters.cc ('k') | content/network/network_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698