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

Side by Side Diff: chrome/browser/net/url_request_context_getter.h

Issue 1702016: Changed UrlFetcher to use a MessageLoopProxy instead of directly relying on C... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_URL_REQUEST_CONTEXT_GETTER_H_ 5 #ifndef CHROME_BROWSER_NET_URL_REQUEST_CONTEXT_GETTER_H_
6 #define CHROME_BROWSER_NET_URL_REQUEST_CONTEXT_GETTER_H_ 6 #define CHROME_BROWSER_NET_URL_REQUEST_CONTEXT_GETTER_H_
7 7
8 #include "base/ref_counted.h" 8 #include "base/ref_counted.h"
9 #include "chrome/browser/chrome_thread.h" 9 #include "base/task.h"
10 10
11 namespace net { 11 namespace net {
12 class CookieStore; 12 class CookieStore;
13 } 13 }
14 14
15 class MessageLoopProxy;
15 class URLRequestContext; 16 class URLRequestContext;
17 struct URLRequestContextGetterTraits;
16 18
17 // Interface for retrieving an URLRequestContext. 19 // Interface for retrieving an URLRequestContext.
18 class URLRequestContextGetter 20 class URLRequestContextGetter
19 : public base::RefCountedThreadSafe<URLRequestContextGetter, 21 : public base::RefCountedThreadSafe<URLRequestContextGetter,
20 ChromeThread::DeleteOnIOThread> { 22 URLRequestContextGetterTraits> {
21 public: 23 public:
22 virtual URLRequestContext* GetURLRequestContext() = 0; 24 virtual URLRequestContext* GetURLRequestContext() = 0;
23 25
24 // Defaults to GetURLRequestContext()->cookie_store(), but 26 // Defaults to GetURLRequestContext()->cookie_store(), but
25 // implementations can override it. 27 // implementations can override it.
26 virtual net::CookieStore* GetCookieStore(); 28 virtual net::CookieStore* GetCookieStore();
29 // Returns a MessageLoopProxy corresponding to the thread on which the
30 // request IO happens (the thread on which the returned URLRequestContext
31 // may be used).
32 virtual scoped_refptr<MessageLoopProxy> GetIOMessageLoopProxy() = 0;
27 33
28 protected: 34 protected:
29 friend class ChromeThread;
30 friend class DeleteTask<URLRequestContextGetter>; 35 friend class DeleteTask<URLRequestContextGetter>;
36 friend struct URLRequestContextGetterTraits;
31 37
32 virtual ~URLRequestContextGetter() {} 38 virtual ~URLRequestContextGetter() {}
39 private:
40 // OnDestruct is meant to ensure deletion on the thread on which the request
41 // IO happens.
42 void OnDestruct();
43 };
44
45 struct URLRequestContextGetterTraits {
46 static void Destruct(URLRequestContextGetter* context_getter) {
47 context_getter->OnDestruct();
48 }
33 }; 49 };
34 50
35 #endif // CHROME_BROWSER_NET_URL_REQUEST_CONTEXT_GETTER_H_ 51 #endif // CHROME_BROWSER_NET_URL_REQUEST_CONTEXT_GETTER_H_
36 52
OLDNEW
« no previous file with comments | « chrome/browser/net/url_fetcher_unittest.cc ('k') | chrome/browser/net/url_request_context_getter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698