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

Side by Side Diff: net/url_request/url_request_context_getter.h

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_GETTER_H_
6 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_GETTER_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "base/sequenced_task_runner_helpers.h"
10 #include "net/base/net_export.h"
11
12 namespace base {
13 class SingleThreadTaskRunner;
14 } // namespace base
15
16 namespace net {
17 class CookieStore;
18 class URLRequestContext;
19
20 struct URLRequestContextGetterTraits;
21
22 // Interface for retrieving an net::URLRequestContext.
23 class NET_EXPORT URLRequestContextGetter
24 : public base::RefCountedThreadSafe<URLRequestContextGetter,
25 URLRequestContextGetterTraits> {
26 public:
27 virtual URLRequestContext* GetURLRequestContext() = 0;
28
29 // Returns a SingleThreadTaskRunner corresponding to the thread on
30 // which the network IO happens (the thread on which the returned
31 // net::URLRequestContext may be used).
32 virtual scoped_refptr<base::SingleThreadTaskRunner>
33 GetNetworkTaskRunner() const = 0;
34
35 protected:
36 friend class base::RefCountedThreadSafe<URLRequestContextGetter,
37 URLRequestContextGetterTraits>;
38 friend class base::DeleteHelper<URLRequestContextGetter>;
39 friend struct URLRequestContextGetterTraits;
40
41 URLRequestContextGetter();
42 virtual ~URLRequestContextGetter();
43
44 private:
45 // OnDestruct is meant to ensure deletion on the thread on which the request
46 // IO happens.
47 void OnDestruct() const;
48 };
49
50 struct URLRequestContextGetterTraits {
51 static void Destruct(const URLRequestContextGetter* context_getter) {
52 context_getter->OnDestruct();
53 }
54 };
55
56 // For use in shimming a URLRequestContext into a URLRequestContextGetter.
57 class NET_EXPORT TrivialURLRequestContextGetter
58 : public URLRequestContextGetter {
59 public:
60 TrivialURLRequestContextGetter(
61 net::URLRequestContext* context,
62 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner);
63
64 // net::URLRequestContextGetter implementation:
65 net::URLRequestContext* GetURLRequestContext() override;
66
67 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner()
68 const override;
69
70 private:
71 ~TrivialURLRequestContextGetter() override;
72
73 net::URLRequestContext* context_;
74 const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
75
76 DISALLOW_COPY_AND_ASSIGN(TrivialURLRequestContextGetter);
77 };
78
79 } // namespace net
80
81 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_GETTER_H_
OLDNEW
« no previous file with comments | « net/url_request/url_request_context_builder_unittest.cc ('k') | net/url_request/url_request_context_getter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698