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

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

Issue 922283002: Use @NativeClassQualifiedName in CronetUrlRequestContext.java (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Self review Created 5 years, 10 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ 5 #ifndef COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_
6 #define COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ 6 #define COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_
7 7
8 #include <jni.h>
8 #include <queue> 9 #include <queue>
9 #include <string> 10 #include <string>
10 11
11 #include "base/callback.h" 12 #include "base/callback.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
15 #include "base/threading/thread.h" 16 #include "base/threading/thread.h"
16 #include "net/base/net_log.h"
17 #include "net/base/network_change_notifier.h"
18 17
19 namespace base { 18 namespace base {
20 class SingleThreadTaskRunner; 19 class SingleThreadTaskRunner;
21 } // namespace base 20 } // namespace base
22 21
23 namespace net { 22 namespace net {
24 class NetLogLogger; 23 class NetLogLogger;
25 class URLRequestContext; 24 class URLRequestContext;
26 class ProxyConfigService; 25 class ProxyConfigService;
27 } // namespace net 26 } // namespace net
28 27
29 namespace cronet { 28 namespace cronet {
30 29
30 bool CronetUrlRequestContextAdapterRegisterJni(JNIEnv* env);
31
31 struct URLRequestContextConfig; 32 struct URLRequestContextConfig;
32 33
33 // Adapter between Java CronetUrlRequestContext and net::URLRequestContext. 34 // Adapter between Java CronetUrlRequestContext and net::URLRequestContext.
34 class CronetURLRequestContextAdapter { 35 class CronetURLRequestContextAdapter {
35 public: 36 public:
36 explicit CronetURLRequestContextAdapter( 37 explicit CronetURLRequestContextAdapter(
37 scoped_ptr<URLRequestContextConfig> context_config); 38 scoped_ptr<URLRequestContextConfig> context_config);
38 39
39 ~CronetURLRequestContextAdapter(); 40 ~CronetURLRequestContextAdapter();
40 41
41 // Called on main Java thread to initialize URLRequestContext. 42 // Called on main Java thread to initialize URLRequestContext.
42 void InitRequestContextOnMainThread( 43 void InitRequestContextOnMainThread(JNIEnv* env, jobject jcaller);
43 const base::Closure& java_init_network_thread);
44 44
45 // Releases all resources for the request context and deletes the object. 45 // Releases all resources for the request context and deletes the object.
46 // Blocks until network thread is destroyed after running all pending tasks. 46 // Blocks until network thread is destroyed after running all pending tasks.
47 void Destroy(); 47 void Destroy(JNIEnv* env, jobject jcaller);
48 48
49 // Posts a task that might depend on the context being initialized 49 // Posts a task that might depend on the context being initialized
50 // to the network thread. 50 // to the network thread.
51 void PostTaskToNetworkThread(const tracked_objects::Location& posted_from, 51 void PostTaskToNetworkThread(const tracked_objects::Location& posted_from,
52 const base::Closure& callback); 52 const base::Closure& callback);
53 53
54 bool IsOnNetworkThread() const; 54 bool IsOnNetworkThread() const;
55 55
56 net::URLRequestContext* GetURLRequestContext(); 56 net::URLRequestContext* GetURLRequestContext();
57 57
58 void StartNetLogToFile(const std::string& file_name); 58 void StartNetLogToFile(JNIEnv* env, jobject jcaller, jstring jfile_name);
59 59
60 void StopNetLog(); 60 void StopNetLog(JNIEnv* env, jobject jcaller);
61 61
62 // Default net::LOAD flags used to create requests. 62 // Default net::LOAD flags used to create requests.
63 int default_load_flags() const { return default_load_flags_; } 63 int default_load_flags() const { return default_load_flags_; }
64 64
65 // Called on main Java thread to initialize URLRequestContext. 65 // Called on main Java thread to initialize URLRequestContext.
66 void InitRequestContextOnMainThread(); 66 void InitRequestContextOnMainThread();
67 67
68 private: 68 private:
69 // Initializes |context_| on the Network thread. 69 // Initializes |context_| on the Network thread.
70 void InitializeOnNetworkThread( 70 void InitializeOnNetworkThread(
(...skipping 25 matching lines...) Expand all
96 std::queue<base::Closure> tasks_waiting_for_context_; 96 std::queue<base::Closure> tasks_waiting_for_context_;
97 bool is_context_initialized_; 97 bool is_context_initialized_;
98 int default_load_flags_; 98 int default_load_flags_;
99 99
100 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); 100 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter);
101 }; 101 };
102 102
103 } // namespace cronet 103 } // namespace cronet
104 104
105 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ 105 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698