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

Unified Diff: chromeos/dbus/services/proxy_resolution_service_provider.h

Issue 2786103002: chromeos: Avoid DCHECK in ProxyResolutionServiceProvider. (Closed)
Patch Set: rename RunAllTasks to RunPendingTasks to avoid tricking future me Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chromeos/dbus/services/proxy_resolution_service_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/services/proxy_resolution_service_provider.h
diff --git a/chromeos/dbus/services/proxy_resolution_service_provider.h b/chromeos/dbus/services/proxy_resolution_service_provider.h
index 244994d347e16ca3aa76f796a1f8b3d514cb0d81..cd89ce1519f257aba31847320281040f213bb119 100644
--- a/chromeos/dbus/services/proxy_resolution_service_provider.h
+++ b/chromeos/dbus/services/proxy_resolution_service_provider.h
@@ -103,12 +103,27 @@ class CHROMEOS_EXPORT ProxyResolutionServiceProvider
void ResolveProxy(dbus::MethodCall* method_call,
dbus::ExportedObject::ResponseSender response_sender);
+ // Callback passed to network thread static methods to run
+ // NotifyProxyResolved() on |origin_thread_|. This callback can be bound to a
+ // WeakPtr from |weak_ptr_factory_| (since the pointer will be dereferenced on
+ // |origin_thread_|), but the network methods can't (since WeakPtr disallows
+ // use on threads besides the one where it was created) and are static as a
+ // result.
+ using NotifyCallback = base::Callback<void(std::unique_ptr<Request>)>;
+
// Helper method for ResolveProxy() that runs on network thread.
- void ResolveProxyOnNetworkThread(std::unique_ptr<Request> request);
+ static void ResolveProxyOnNetworkThread(
+ std::unique_ptr<Request> request,
+ scoped_refptr<base::SingleThreadTaskRunner> notify_thread,
+ NotifyCallback notify_callback);
// Callback on network thread for when net::ProxyService::ResolveProxy()
// completes, synchronously or asynchronously.
- void OnResolutionComplete(std::unique_ptr<Request> request, int result);
+ static void OnResolutionComplete(
+ std::unique_ptr<Request> request,
+ scoped_refptr<base::SingleThreadTaskRunner> notify_thread,
+ NotifyCallback notify_callback,
+ int result);
// Called on UI thread from OnResolutionComplete() to pass the resolved proxy
// information to the client over D-Bus.
« no previous file with comments | « no previous file | chromeos/dbus/services/proxy_resolution_service_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698