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

Side by Side Diff: mojo/services/network/network_context.h

Issue 1179413010: mandoline filesystem: Save cookie data to the mojo:filesystem. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sqlite-fs
Patch Set: Use --user-data-dir on linux and windows. Created 5 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 MOJO_SERVICES_NETWORK_NETWORK_CONTEXT_H_ 5 #ifndef MOJO_SERVICES_NETWORK_NETWORK_CONTEXT_H_
6 #define MOJO_SERVICES_NETWORK_NETWORK_CONTEXT_H_ 6 #define MOJO_SERVICES_NETWORK_NETWORK_CONTEXT_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/sequenced_task_runner.h"
12 14
13 namespace base { 15 namespace base {
14 class FilePath; 16 class FilePath;
15 } 17 }
16 18
17 namespace net { 19 namespace net {
18 class URLRequestContext; 20 class URLRequestContext;
19 } 21 }
20 22
21 namespace mojo { 23 namespace mojo {
22 class URLLoader; 24 class URLLoader;
23 class URLLoaderImpl; 25 class URLLoaderImpl;
24 26
25 class NetworkContext { 27 class NetworkContext {
26 public: 28 public:
27 explicit NetworkContext( 29 explicit NetworkContext(
28 scoped_ptr<net::URLRequestContext> url_request_context); 30 scoped_ptr<net::URLRequestContext> url_request_context);
29 explicit NetworkContext(const base::FilePath& base_path); 31 explicit NetworkContext(
32 const base::FilePath& base_path,
33 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner);
30 ~NetworkContext(); 34 ~NetworkContext();
31 35
32 net::URLRequestContext* url_request_context() { 36 net::URLRequestContext* url_request_context() {
33 return url_request_context_.get(); 37 return url_request_context_.get();
34 } 38 }
35 39
36 // These are called by individual url loaders as they are being created and 40 // These are called by individual url loaders as they are being created and
37 // destroyed. 41 // destroyed.
38 void RegisterURLLoader(URLLoaderImpl* url_loader); 42 void RegisterURLLoader(URLLoaderImpl* url_loader);
39 void DeregisterURLLoader(URLLoaderImpl* url_loader); 43 void DeregisterURLLoader(URLLoaderImpl* url_loader);
40 44
41 private: 45 private:
42 friend class UrlLoaderImplTest; 46 friend class UrlLoaderImplTest;
43 size_t GetURLLoaderCountForTesting(); 47 size_t GetURLLoaderCountForTesting();
44 48
45 static scoped_ptr<net::URLRequestContext> MakeURLRequestContext( 49 static scoped_ptr<net::URLRequestContext> MakeURLRequestContext(
46 const base::FilePath& base_path); 50 const base::FilePath& base_path,
51 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner);
47 52
48 class MojoNetLog; 53 class MojoNetLog;
49 scoped_ptr<class MojoNetLog> net_log_; 54 scoped_ptr<class MojoNetLog> net_log_;
50 55
51 scoped_ptr<net::URLRequestContext> url_request_context_; 56 scoped_ptr<net::URLRequestContext> url_request_context_;
52 // URLLoaderImpls register themselves with the NetworkContext so that they can 57 // URLLoaderImpls register themselves with the NetworkContext so that they can
53 // be cleaned up when the NetworkContext goes away. This is needed as 58 // be cleaned up when the NetworkContext goes away. This is needed as
54 // net::URLRequests held by URLLoaderImpls have to be gone when 59 // net::URLRequests held by URLLoaderImpls have to be gone when
55 // net::URLRequestContext (held by NetworkContext) is destroyed. 60 // net::URLRequestContext (held by NetworkContext) is destroyed.
56 std::set<URLLoaderImpl*> url_loaders_; 61 std::set<URLLoaderImpl*> url_loaders_;
57 62
58 // Set when entering the destructor, in order to avoid manipulations of the 63 // Set when entering the destructor, in order to avoid manipulations of the
59 // |url_loaders_| (as a url_loader might delete itself in Cleanup()). 64 // |url_loaders_| (as a url_loader might delete itself in Cleanup()).
60 bool in_shutdown_; 65 bool in_shutdown_;
61 66
62 DISALLOW_COPY_AND_ASSIGN(NetworkContext); 67 DISALLOW_COPY_AND_ASSIGN(NetworkContext);
63 }; 68 };
64 69
65 } // namespace mojo 70 } // namespace mojo
66 71
67 #endif // MOJO_SERVICES_NETWORK_NETWORK_CONTEXT_H_ 72 #endif // MOJO_SERVICES_NETWORK_NETWORK_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698