OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_COMMON_NET_URL_REQUEST_CONTEXT_GETTER_H_ | 5 #ifndef CHROME_COMMON_NET_URL_REQUEST_CONTEXT_GETTER_H_ |
6 #define CHROME_COMMON_NET_URL_REQUEST_CONTEXT_GETTER_H_ | 6 #define CHROME_COMMON_NET_URL_REQUEST_CONTEXT_GETTER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/task.h" | 10 #include "base/message_loop_helpers.h" |
11 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 class MessageLoopProxy; | 14 class MessageLoopProxy; |
15 } | 15 } |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 class CookieStore; | 18 class CookieStore; |
19 class URLRequestContext; | 19 class URLRequestContext; |
20 | 20 |
(...skipping 12 matching lines...) Expand all Loading... |
33 | 33 |
34 // Returns a MessageLoopProxy corresponding to the thread on which the | 34 // Returns a MessageLoopProxy corresponding to the thread on which the |
35 // request IO happens (the thread on which the returned net::URLRequestContext | 35 // request IO happens (the thread on which the returned net::URLRequestContext |
36 // may be used). | 36 // may be used). |
37 virtual scoped_refptr<base::MessageLoopProxy> | 37 virtual scoped_refptr<base::MessageLoopProxy> |
38 GetIOMessageLoopProxy() const = 0; | 38 GetIOMessageLoopProxy() const = 0; |
39 | 39 |
40 protected: | 40 protected: |
41 friend class base::RefCountedThreadSafe<URLRequestContextGetter, | 41 friend class base::RefCountedThreadSafe<URLRequestContextGetter, |
42 URLRequestContextGetterTraits>; | 42 URLRequestContextGetterTraits>; |
43 friend class DeleteTask<const URLRequestContextGetter>; | 43 friend class base::DeleteHelper<URLRequestContextGetter>; |
44 friend struct URLRequestContextGetterTraits; | 44 friend struct URLRequestContextGetterTraits; |
45 | 45 |
46 URLRequestContextGetter(); | 46 URLRequestContextGetter(); |
47 virtual ~URLRequestContextGetter(); | 47 virtual ~URLRequestContextGetter(); |
48 | 48 |
49 private: | 49 private: |
50 // OnDestruct is meant to ensure deletion on the thread on which the request | 50 // OnDestruct is meant to ensure deletion on the thread on which the request |
51 // IO happens. | 51 // IO happens. |
52 void OnDestruct() const; | 52 void OnDestruct() const; |
53 }; | 53 }; |
54 | 54 |
55 struct URLRequestContextGetterTraits { | 55 struct URLRequestContextGetterTraits { |
56 static void Destruct(const URLRequestContextGetter* context_getter) { | 56 static void Destruct(const URLRequestContextGetter* context_getter) { |
57 context_getter->OnDestruct(); | 57 context_getter->OnDestruct(); |
58 } | 58 } |
59 }; | 59 }; |
60 | 60 |
61 } // namespace net | 61 } // namespace net |
62 | 62 |
63 #endif // CHROME_COMMON_NET_URL_REQUEST_CONTEXT_GETTER_H_ | 63 #endif // CHROME_COMMON_NET_URL_REQUEST_CONTEXT_GETTER_H_ |
OLD | NEW |