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

Side by Side Diff: components/cronet/android/cronet_url_request_context_adapter.h

Issue 586143002: Initial implementation of Cronet Async API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Helen's comments, add CronetUrlRequestContextTest. Created 6 years, 1 month 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 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"
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.
32 class CronetURLRequestContextAdapter {
33 public:
34 CronetURLRequestContextAdapter();
35 void Initialize(scoped_ptr<URLRequestContextConfig> config,
36 const base::Closure& init_java_network_thread);
37 // Releases all resources for the request context and deletes the object.
38 void Destroy();
39
40 // net::URLRequestContextGetter implementation:
41 net::URLRequestContext* GetURLRequestContext();
42 scoped_refptr<base::SingleThreadTaskRunner>
43 GetNetworkTaskRunner() const;
44
45 void StartNetLogToFile(const std::string& file_name);
46 void StopNetLog();
47
48 virtual ~CronetURLRequestContextAdapter();
49
50 private:
51 scoped_ptr<net::URLRequestContext> context_;
52 base::Thread* network_thread_;
53 scoped_ptr<net::NetLogLogger> net_log_logger_;
54
55 // Initializes |context_| on the Network thread.
56 void InitializeOnNetworkThread(scoped_ptr<URLRequestContextConfig> config,
57 const base::Closure& init_java_network_thread);
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698