Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/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: |
| 29 // Cleares the cached content. The actual deletion will be performed using the | |
| 30 // given task runner, but cache appears as cleared immediately after the | |
| 31 // function returns. | |
| 32 static void ClearCache(const base::FilePath& base_path, | |
| 33 scoped_refptr<base::TaskRunner> task_runner); | |
| 34 | |
| 27 explicit NetworkContext( | 35 explicit NetworkContext( |
| 28 scoped_ptr<net::URLRequestContext> url_request_context); | 36 scoped_ptr<net::URLRequestContext> url_request_context); |
| 29 explicit NetworkContext(const base::FilePath& base_path); | 37 NetworkContext(const base::FilePath& base_path); |
|
qsr
2015/09/16 13:27:05
Why did you remove this explicit?
ppi
2015/09/16 14:20:59
accident:). Done.
| |
| 30 ~NetworkContext(); | 38 ~NetworkContext(); |
| 31 | 39 |
| 32 net::URLRequestContext* url_request_context() { | 40 net::URLRequestContext* url_request_context() { |
| 33 return url_request_context_.get(); | 41 return url_request_context_.get(); |
| 34 } | 42 } |
| 35 | 43 |
| 36 // These are called by individual url loaders as they are being created and | 44 // These are called by individual url loaders as they are being created and |
| 37 // destroyed. | 45 // destroyed. |
| 38 void RegisterURLLoader(URLLoaderImpl* url_loader); | 46 void RegisterURLLoader(URLLoaderImpl* url_loader); |
| 39 void DeregisterURLLoader(URLLoaderImpl* url_loader); | 47 void DeregisterURLLoader(URLLoaderImpl* url_loader); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 58 // Set when entering the destructor, in order to avoid manipulations of the | 66 // Set when entering the destructor, in order to avoid manipulations of the |
| 59 // |url_loaders_| (as a url_loader might delete itself in Cleanup()). | 67 // |url_loaders_| (as a url_loader might delete itself in Cleanup()). |
| 60 bool in_shutdown_; | 68 bool in_shutdown_; |
| 61 | 69 |
| 62 DISALLOW_COPY_AND_ASSIGN(NetworkContext); | 70 DISALLOW_COPY_AND_ASSIGN(NetworkContext); |
| 63 }; | 71 }; |
| 64 | 72 |
| 65 } // namespace mojo | 73 } // namespace mojo |
| 66 | 74 |
| 67 #endif // MOJO_SERVICES_NETWORK_NETWORK_CONTEXT_H_ | 75 #endif // MOJO_SERVICES_NETWORK_NETWORK_CONTEXT_H_ |
| OLD | NEW |