OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ | |
6 #define COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/macros.h" | |
11 #include "base/memory/ref_counted.h" | |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/threading/thread.h" | |
14 #include "net/base/net_log.h" | |
15 #include "net/base/network_change_notifier.h" | |
16 #include "net/url_request/url_request_context_getter.h" | |
mmenke
2014/10/31 15:49:22
Not used
mef
2014/10/31 20:39:16
Done.
| |
17 | |
18 namespace base { | |
19 class SingleThreadTaskRunner; | |
20 } // namespace base | |
21 | |
22 namespace net { | |
23 class NetLogLogger; | |
24 class URLRequestContext; | |
25 } // namespace net | |
26 | |
27 namespace cronet { | |
28 | |
29 struct URLRequestContextConfig; | |
30 | |
31 // Adapter between Java CronetUrlRequestContext and URLRequestContextGetter. | |
mmenke
2014/10/31 15:49:22
URLRequestContextGetter -> URLRequestContext
mef
2014/10/31 20:39:16
Done.
| |
32 class CronetURLRequestContextAdapter { | |
33 public: | |
34 CronetURLRequestContextAdapter(); | |
35 void Initialize(scoped_ptr<URLRequestContextConfig> config, | |
36 const base::Closure& init_java_network_thread); | |
mmenke
2014/10/31 15:49:22
nit: suggest a linebreak above and below Initiali
mef
2014/10/31 20:39:16
Done.
| |
37 // Releases all resources for the request context and deletes the object. | |
38 void Destroy(); | |
39 | |
40 // net::URLRequestContextGetter implementation: | |
mmenke
2014/10/31 15:49:22
Not true.
mef
2014/10/31 20:39:16
Done.
| |
41 net::URLRequestContext* GetURLRequestContext(); | |
mmenke
2014/10/31 15:49:22
Add line break after method.
mef
2014/10/31 20:39:16
Done.
| |
42 scoped_refptr<base::SingleThreadTaskRunner> | |
mmenke
2014/10/31 15:49:23
Maybe const scoped_refptr<>&, to avoid an extra re
mef
2014/10/31 20:39:16
Done.
| |
43 GetNetworkTaskRunner() const; | |
44 | |
45 void StartNetLogToFile(const std::string& file_name); | |
46 void StopNetLog(); | |
47 | |
48 virtual ~CronetURLRequestContextAdapter(); | |
mmenke
2014/10/31 15:49:23
-virtual
mef
2014/10/31 20:39:16
Done.
| |
49 | |
50 private: | |
51 scoped_ptr<net::URLRequestContext> context_; | |
mmenke
2014/10/31 15:49:22
Should mention that the context_ and logger_ may o
mmenke
2014/10/31 15:49:23
Context should be last, after everything it depend
mef
2014/10/31 20:39:16
Done.
mef
2014/10/31 20:39:16
Done.
| |
52 base::Thread* network_thread_; | |
mmenke
2014/10/31 15:49:22
Hrm...guess we can't put this into a scoped_ptr an
mef
2014/10/31 20:39:16
Acknowledged.
| |
53 scoped_ptr<net::NetLogLogger> net_log_logger_; | |
54 | |
55 // Initializes |context_| on the Network thread. | |
56 void InitializeOnNetworkThread(scoped_ptr<URLRequestContextConfig> config, | |
mmenke
2014/10/31 15:49:22
Fix indent (Either move config to the next line, o
mef
2014/10/31 20:39:16
Done.
| |
57 const base::Closure& init_java_network_thread); | |
mmenke
2014/10/31 15:49:22
Should include callback.h
mef
2014/10/31 20:39:16
Done.
| |
58 void StartNetLogToFileOnNetworkThread(const std::string& file_name); | |
59 void StopNetLogOnNetworkThread(); | |
60 | |
61 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); | |
62 }; | |
63 | |
64 } // namespace cronet | |
65 | |
66 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ | |
OLD | NEW |