| 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" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 void RegisterURLLoader(URLLoaderImpl* url_loader); | 38 void RegisterURLLoader(URLLoaderImpl* url_loader); |
| 39 void DeregisterURLLoader(URLLoaderImpl* url_loader); | 39 void DeregisterURLLoader(URLLoaderImpl* url_loader); |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 friend class UrlLoaderImplTest; | 42 friend class UrlLoaderImplTest; |
| 43 size_t GetURLLoaderCountForTesting(); | 43 size_t GetURLLoaderCountForTesting(); |
| 44 | 44 |
| 45 static scoped_ptr<net::URLRequestContext> MakeURLRequestContext( | 45 static scoped_ptr<net::URLRequestContext> MakeURLRequestContext( |
| 46 const base::FilePath& base_path); | 46 const base::FilePath& base_path); |
| 47 | 47 |
| 48 class MojoNetLog; |
| 49 scoped_ptr<class MojoNetLog> net_log_; |
| 50 |
| 48 scoped_ptr<net::URLRequestContext> url_request_context_; | 51 scoped_ptr<net::URLRequestContext> url_request_context_; |
| 49 // URLLoaderImpls register themselves with the NetworkContext so that they can | 52 // URLLoaderImpls register themselves with the NetworkContext so that they can |
| 50 // be cleaned up when the NetworkContext goes away. This is needed as | 53 // be cleaned up when the NetworkContext goes away. This is needed as |
| 51 // net::URLRequests held by URLLoaderImpls have to be gone when | 54 // net::URLRequests held by URLLoaderImpls have to be gone when |
| 52 // net::URLRequestContext (held by NetworkContext) is destroyed. | 55 // net::URLRequestContext (held by NetworkContext) is destroyed. |
| 53 std::set<URLLoaderImpl*> url_loaders_; | 56 std::set<URLLoaderImpl*> url_loaders_; |
| 54 | 57 |
| 55 // Set when entering the destructor, in order to avoid manipulations of the | 58 // Set when entering the destructor, in order to avoid manipulations of the |
| 56 // |url_loaders_| (as a url_loader might delete itself in Cleanup()). | 59 // |url_loaders_| (as a url_loader might delete itself in Cleanup()). |
| 57 bool in_shutdown_; | 60 bool in_shutdown_; |
| 58 | 61 |
| 59 DISALLOW_COPY_AND_ASSIGN(NetworkContext); | 62 DISALLOW_COPY_AND_ASSIGN(NetworkContext); |
| 60 }; | 63 }; |
| 61 | 64 |
| 62 } // namespace mojo | 65 } // namespace mojo |
| 63 | 66 |
| 64 #endif // MOJO_SERVICES_NETWORK_NETWORK_CONTEXT_H_ | 67 #endif // MOJO_SERVICES_NETWORK_NETWORK_CONTEXT_H_ |
| OLD | NEW |