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

Side by Side Diff: chromeos/dbus/services/proxy_resolution_service_provider.h

Issue 2786103002: chromeos: Avoid DCHECK in ProxyResolutionServiceProvider. (Closed)
Patch Set: merge with change to create net::ProxyService in tests Created 3 years, 8 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 (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 CHROMEOS_DBUS_SERVICES_PROXY_RESOLUTION_SERVICE_PROVIDER_H_ 5 #ifndef CHROMEOS_DBUS_SERVICES_PROXY_RESOLUTION_SERVICE_PROVIDER_H_
6 #define CHROMEOS_DBUS_SERVICES_PROXY_RESOLUTION_SERVICE_PROVIDER_H_ 6 #define CHROMEOS_DBUS_SERVICES_PROXY_RESOLUTION_SERVICE_PROVIDER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // Called when ResolveProxy() is exported as a D-Bus method. 96 // Called when ResolveProxy() is exported as a D-Bus method.
97 void OnExported(const std::string& interface_name, 97 void OnExported(const std::string& interface_name,
98 const std::string& method_name, 98 const std::string& method_name,
99 bool success); 99 bool success);
100 100
101 // Callback invoked when Chrome OS clients send network proxy resolution 101 // Callback invoked when Chrome OS clients send network proxy resolution
102 // requests to the service. Called on UI thread. 102 // requests to the service. Called on UI thread.
103 void ResolveProxy(dbus::MethodCall* method_call, 103 void ResolveProxy(dbus::MethodCall* method_call,
104 dbus::ExportedObject::ResponseSender response_sender); 104 dbus::ExportedObject::ResponseSender response_sender);
105 105
106 // Callback passed to network thread static methods to run
107 // NotifyProxyResolved() on |origin_thread_|.
108 using NotifyCallback = base::Callback<void(std::unique_ptr<Request>)>;
109
106 // Helper method for ResolveProxy() that runs on network thread. 110 // Helper method for ResolveProxy() that runs on network thread.
107 void ResolveProxyOnNetworkThread(std::unique_ptr<Request> request); 111 static void ResolveProxyOnNetworkThread(
112 std::unique_ptr<Request> request,
113 scoped_refptr<base::SingleThreadTaskRunner> notify_thread,
114 NotifyCallback notify_callback);
James Cook 2017/04/03 15:30:23 I really appreciate your consistent naming of thin
108 115
109 // Callback on network thread for when net::ProxyService::ResolveProxy() 116 // Callback on network thread for when net::ProxyService::ResolveProxy()
110 // completes, synchronously or asynchronously. 117 // completes, synchronously or asynchronously.
111 void OnResolutionComplete(std::unique_ptr<Request> request, int result); 118 static void OnResolutionComplete(
119 std::unique_ptr<Request> request,
120 scoped_refptr<base::SingleThreadTaskRunner> notify_thread,
121 NotifyCallback notify_callback,
122 int result);
112 123
113 // Called on UI thread from OnResolutionComplete() to pass the resolved proxy 124 // Called on UI thread from OnResolutionComplete() to pass the resolved proxy
114 // information to the client over D-Bus. 125 // information to the client over D-Bus.
115 void NotifyProxyResolved(std::unique_ptr<Request> request); 126 void NotifyProxyResolved(std::unique_ptr<Request> request);
116 127
117 std::unique_ptr<Delegate> delegate_; 128 std::unique_ptr<Delegate> delegate_;
118 scoped_refptr<dbus::ExportedObject> exported_object_; 129 scoped_refptr<dbus::ExportedObject> exported_object_;
119 scoped_refptr<base::SingleThreadTaskRunner> origin_thread_; 130 scoped_refptr<base::SingleThreadTaskRunner> origin_thread_;
120 base::WeakPtrFactory<ProxyResolutionServiceProvider> weak_ptr_factory_; 131 base::WeakPtrFactory<ProxyResolutionServiceProvider> weak_ptr_factory_;
121 132
122 DISALLOW_COPY_AND_ASSIGN(ProxyResolutionServiceProvider); 133 DISALLOW_COPY_AND_ASSIGN(ProxyResolutionServiceProvider);
123 }; 134 };
124 135
125 } // namespace chromeos 136 } // namespace chromeos
126 137
127 #endif // CHROMEOS_DBUS_SERVICES_PROXY_RESOLUTION_SERVICE_PROVIDER_H_ 138 #endif // CHROMEOS_DBUS_SERVICES_PROXY_RESOLUTION_SERVICE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698