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

Side by Side Diff: net/proxy/proxy_config_service_android.h

Issue 10912132: Move ProxyConfigService construction onto the IO thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Avoid double-shutdown in services Created 8 years, 2 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) 2012 The Chromium Authors. All rights reserved. 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 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 NET_PROXY_PROXY_CONFIG_SERVICE_ANDROID_H_ 5 #ifndef NET_PROXY_PROXY_CONFIG_SERVICE_ANDROID_H_
6 #define NET_PROXY_PROXY_CONFIG_SERVICE_ANDROID_H_ 6 #define NET_PROXY_PROXY_CONFIG_SERVICE_ANDROID_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
(...skipping 10 matching lines...) Expand all
21 21
22 namespace net { 22 namespace net {
23 23
24 class ProxyConfig; 24 class ProxyConfig;
25 25
26 class NET_EXPORT ProxyConfigServiceAndroid : public ProxyConfigService { 26 class NET_EXPORT ProxyConfigServiceAndroid : public ProxyConfigService {
27 public: 27 public:
28 // Callback that returns the value of the property identified by the provided 28 // Callback that returns the value of the property identified by the provided
29 // key. If it was not found, an empty string is returned. Note that this 29 // key. If it was not found, an empty string is returned. Note that this
30 // interface does not let you distinguish an empty property from a 30 // interface does not let you distinguish an empty property from a
31 // non-existing property. This callback is invoked on the JNI thread. 31 // non-existing property. This callback is invoked on the network thread.
32 typedef base::Callback<std::string (const std::string& property)> 32 typedef base::Callback<std::string (const std::string& property)>
33 GetPropertyCallback; 33 GetPropertyCallback;
34 34
35 // Separate class whose instance is owned by the Delegate class implemented in 35 // Separate class whose instance is owned by the Delegate class implemented in
36 // the .cc file. 36 // the .cc file.
37 class JNIDelegate { 37 class JNIDelegate {
38 public: 38 public:
39 virtual ~JNIDelegate() {} 39 virtual ~JNIDelegate() {}
40 40
41 // Called from Java (on JNI thread) to signal that the proxy settings have 41 // Called from Java (on glib thread) to signal that the proxy settings
Philippe 2012/10/19 09:35:25 Maybe you should keep JNI here and in the cc file.
42 // changed. 42 // have changed.
43 virtual void ProxySettingsChanged(JNIEnv*, jobject) = 0; 43 virtual void ProxySettingsChanged(JNIEnv*, jobject) = 0;
44 }; 44 };
45 45
46 ProxyConfigServiceAndroid(base::SequencedTaskRunner* network_task_runner, 46 ProxyConfigServiceAndroid(base::SequencedTaskRunner* glib_task_runner,
47 base::SequencedTaskRunner* jni_task_runner); 47 base::SequencedTaskRunner* network_task_runner);
48 48
49 virtual ~ProxyConfigServiceAndroid(); 49 virtual ~ProxyConfigServiceAndroid();
50 50
51 // Register JNI bindings. 51 // Register JNI bindings.
52 static bool Register(JNIEnv* env); 52 static bool Register(JNIEnv* env);
53 53
54 // ProxyConfigService: 54 // ProxyConfigService:
55 // Called only on the network thread. 55 // Called only on the network thread.
56 virtual void AddObserver(Observer* observer) OVERRIDE; 56 virtual void AddObserver(Observer* observer) OVERRIDE;
57 virtual void RemoveObserver(Observer* observer) OVERRIDE; 57 virtual void RemoveObserver(Observer* observer) OVERRIDE;
58 virtual ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) OVERRIDE; 58 virtual ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) OVERRIDE;
59 // Called from glib thread.
60 virtual void StartTearDown() OVERRIDE;
59 61
60 private: 62 private:
61 friend class ProxyConfigServiceAndroidTestBase; 63 friend class ProxyConfigServiceAndroidTestBase;
62 class Delegate; 64 class Delegate;
63 65
64 66
65 // For tests. 67 // For tests.
66 ProxyConfigServiceAndroid(base::SequencedTaskRunner* network_task_runner, 68 ProxyConfigServiceAndroid(base::SequencedTaskRunner* network_task_runner,
67 base::SequencedTaskRunner* jni_task_runner, 69 base::SequencedTaskRunner* glib_task_runner,
68 GetPropertyCallback get_property_callback); 70 GetPropertyCallback get_property_callback);
69 71
70 // For tests. 72 // For tests.
71 void ProxySettingsChanged(); 73 void ProxySettingsChanged();
72 74
73 scoped_refptr<Delegate> delegate_; 75 scoped_refptr<Delegate> delegate_;
74 76
75 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceAndroid); 77 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceAndroid);
76 }; 78 };
77 79
78 } // namespace net 80 } // namespace net
79 81
80 #endif // NET_PROXY_PROXY_CONFIG_SERVICE_ANDROID_H_ 82 #endif // NET_PROXY_PROXY_CONFIG_SERVICE_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698