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

Side by Side Diff: http_fetcher.cc

Issue 6693047: AU: HttpFetcher: Fix segfault with multi fetcher and small transfers (Closed) Base URL: http://git.chromium.org/git/update_engine.git@master
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | multi_range_http_fetcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium OS 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 #include "update_engine/http_fetcher.h" 5 #include "update_engine/http_fetcher.h"
6 6
7 using google::protobuf::Closure; 7 using google::protobuf::Closure;
8 using std::deque; 8 using std::deque;
9 using std::string; 9 using std::string;
10 10
(...skipping 13 matching lines...) Expand all
24 post_data_.insert(post_data_.end(), char_data, char_data + size); 24 post_data_.insert(post_data_.end(), char_data, char_data + size);
25 } 25 }
26 26
27 // Proxy methods to set the proxies, then to pop them off. 27 // Proxy methods to set the proxies, then to pop them off.
28 bool HttpFetcher::ResolveProxiesForUrl(const string& url, Closure* callback) { 28 bool HttpFetcher::ResolveProxiesForUrl(const string& url, Closure* callback) {
29 if (!proxy_resolver_) { 29 if (!proxy_resolver_) {
30 LOG(INFO) << "Not resolving proxies (no proxy resolver)."; 30 LOG(INFO) << "Not resolving proxies (no proxy resolver).";
31 no_resolver_idle_id_ = g_idle_add(utils::GlibRunClosure, callback); 31 no_resolver_idle_id_ = g_idle_add(utils::GlibRunClosure, callback);
32 return true; 32 return true;
33 } 33 }
34 CHECK_EQ(reinterpret_cast<Closure*>(NULL), callback_);
34 callback_ = callback; 35 callback_ = callback;
35 return proxy_resolver_->GetProxiesForUrl(url, 36 return proxy_resolver_->GetProxiesForUrl(url,
36 &HttpFetcher::StaticProxiesResolved, 37 &HttpFetcher::StaticProxiesResolved,
37 this); 38 this);
38 } 39 }
39 40
40 void HttpFetcher::ProxiesResolved(const std::deque<std::string>& proxies) { 41 void HttpFetcher::ProxiesResolved(const std::deque<std::string>& proxies) {
41 no_resolver_idle_id_ = 0; 42 no_resolver_idle_id_ = 0;
42 if (!proxies.empty()) 43 if (!proxies.empty())
43 SetProxies(proxies); 44 SetProxies(proxies);
44 callback_->Run(); 45 CHECK_NE(reinterpret_cast<Closure*>(NULL), callback_);
46 Closure* callback = callback_;
45 callback_ = NULL; 47 callback_ = NULL;
48 // This may indirectly call back into ResolveProxiesForUrl():
49 callback->Run();
46 } 50 }
47 51
48 } // namespace chromeos_update_engine 52 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « no previous file | multi_range_http_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698