OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ | 5 #ifndef CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ |
6 #define CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ | 6 #define CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 CONTEXT_TYPE_MAIN, | 34 CONTEXT_TYPE_MAIN, |
35 CONTEXT_TYPE_MEDIA, | 35 CONTEXT_TYPE_MEDIA, |
36 CONTEXT_TYPE_EXTENSIONS, | 36 CONTEXT_TYPE_EXTENSIONS, |
37 CONTEXT_TYPE_APP | 37 CONTEXT_TYPE_APP |
38 }; | 38 }; |
39 ChromeURLRequestContext(ContextType type, | 39 ChromeURLRequestContext(ContextType type, |
40 chrome_browser_net::LoadTimeStats* load_time_stats); | 40 chrome_browser_net::LoadTimeStats* load_time_stats); |
41 virtual ~ChromeURLRequestContext(); | 41 virtual ~ChromeURLRequestContext(); |
42 | 42 |
43 base::WeakPtr<ChromeURLRequestContext> GetWeakPtr() { | 43 base::WeakPtr<ChromeURLRequestContext> GetWeakPtr() { |
44 return base::AsWeakPtr(this); | 44 return weak_factory_.GetWeakPtr(); |
45 } | 45 } |
46 | 46 |
47 // Copies the state from |other| into this context. | 47 // Copies the state from |other| into this context. |
48 void CopyFrom(ChromeURLRequestContext* other); | 48 void CopyFrom(ChromeURLRequestContext* other); |
49 | 49 |
50 private: | 50 private: |
| 51 base::WeakPtrFactory<ChromeURLRequestContext> weak_factory_; |
| 52 |
51 // --------------------------------------------------------------------------- | 53 // --------------------------------------------------------------------------- |
52 // Important: When adding any new members below, consider whether they need to | 54 // Important: When adding any new members below, consider whether they need to |
53 // be added to CopyFrom. | 55 // be added to CopyFrom. |
54 // --------------------------------------------------------------------------- | 56 // --------------------------------------------------------------------------- |
55 | 57 |
56 chrome_browser_net::LoadTimeStats* load_time_stats_; | 58 chrome_browser_net::LoadTimeStats* load_time_stats_; |
57 | 59 |
58 // --------------------------------------------------------------------------- | 60 // --------------------------------------------------------------------------- |
59 // Important: When adding any new members above, consider whether they need to | 61 // Important: When adding any new members above, consider whether they need to |
60 // be added to CopyFrom. | 62 // be added to CopyFrom. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 154 |
153 // NULL if not yet initialized. Otherwise, it is the ChromeURLRequestContext | 155 // NULL if not yet initialized. Otherwise, it is the ChromeURLRequestContext |
154 // instance that was lazily created by GetURLRequestContext(). | 156 // instance that was lazily created by GetURLRequestContext(). |
155 // Access only from the IO thread. | 157 // Access only from the IO thread. |
156 base::WeakPtr<ChromeURLRequestContext> url_request_context_; | 158 base::WeakPtr<ChromeURLRequestContext> url_request_context_; |
157 | 159 |
158 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter); | 160 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter); |
159 }; | 161 }; |
160 | 162 |
161 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ | 163 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ |
OLD | NEW |