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

Unified Diff: http_fetcher.h

Issue 6516026: AU: Make proxy resolution asynchronous. (Closed) Base URL: http://git.chromium.org/git/update_engine.git@master
Patch Set: fix utils.* include paths Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome_proxy_resolver_unittest.cc ('k') | http_fetcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: http_fetcher.h
diff --git a/http_fetcher.h b/http_fetcher.h
old mode 100644
new mode 100755
index e4f791a13a18184165e0fe4bdb2d82b04975659c..f4ee9b7a1456fbe0cf4c20be21e8939037a04bbe
--- a/http_fetcher.h
+++ b/http_fetcher.h
@@ -12,6 +12,7 @@
#include <base/basictypes.h>
#include <base/logging.h>
#include <glib.h>
+#include <google/protobuf/stubs/common.h>
#include "update_engine/proxy_resolver.h"
@@ -36,8 +37,10 @@ class HttpFetcher {
http_response_code_(0),
delegate_(NULL),
proxies_(1, kNoProxy),
- proxy_resolver_(proxy_resolver) {}
- virtual ~HttpFetcher() {}
+ proxy_resolver_(proxy_resolver),
+ no_resolver_idle_id_(0),
+ callback_(NULL) {}
+ virtual ~HttpFetcher();
void set_delegate(HttpFetcherDelegate* delegate) { delegate_ = delegate; }
HttpFetcherDelegate* delegate() const { return delegate_; }
@@ -48,7 +51,9 @@ class HttpFetcher {
void SetPostData(const void* data, size_t size);
// Proxy methods to set the proxies, then to pop them off.
- void ResolveProxiesForUrl(const std::string& url);
+ // Returns true on success.
+ bool ResolveProxiesForUrl(const std::string& url,
+ google::protobuf::Closure* callback);
void SetProxies(const std::deque<std::string>& proxies) {
proxies_ = proxies;
@@ -110,10 +115,23 @@ class HttpFetcher {
// Proxy servers
std::deque<std::string> proxies_;
-
+
ProxyResolver* const proxy_resolver_;
+ // The ID of the idle callback, used when we have no proxy resolver.
+ guint no_resolver_idle_id_;
+
+ // Callback for when we are resolving proxies
+ google::protobuf::Closure* callback_;
+
private:
+ // Callback from the proxy resolver
+ void ProxiesResolved(const std::deque<std::string>& proxies);
+ static void StaticProxiesResolved(const std::deque<std::string>& proxies,
+ void* data) {
+ reinterpret_cast<HttpFetcher*>(data)->ProxiesResolved(proxies);
+ }
+
DISALLOW_COPY_AND_ASSIGN(HttpFetcher);
};
« no previous file with comments | « chrome_proxy_resolver_unittest.cc ('k') | http_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698