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

Side by Side Diff: chrome/browser/sync/glue/http_bridge.cc

Issue 8221021: Modify WaitableEvent::Wait() to return void (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed comment and style Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/browser/sync/glue/http_bridge.h" 5 #include "chrome/browser/sync/glue/http_bridge.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/message_loop_proxy.h" 8 #include "base/message_loop_proxy.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "content/browser/browser_thread.h" 10 #include "content/browser/browser_thread.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 DCHECK(!content_type_.empty()) << "Payload not set"; 191 DCHECK(!content_type_.empty()) << "Payload not set";
192 192
193 if (!BrowserThread::PostTask( 193 if (!BrowserThread::PostTask(
194 BrowserThread::IO, FROM_HERE, 194 BrowserThread::IO, FROM_HERE,
195 NewRunnableMethod(this, &HttpBridge::CallMakeAsynchronousPost))) { 195 NewRunnableMethod(this, &HttpBridge::CallMakeAsynchronousPost))) {
196 // This usually happens when we're in a unit test. 196 // This usually happens when we're in a unit test.
197 LOG(WARNING) << "Could not post CallMakeAsynchronousPost task"; 197 LOG(WARNING) << "Could not post CallMakeAsynchronousPost task";
198 return false; 198 return false;
199 } 199 }
200 200
201 if (!http_post_completed_.Wait()) // Block until network request completes 201 // Block until network request completes or is aborted. See
202 NOTREACHED(); // or is aborted. See OnURLFetchComplete 202 // OnURLFetchComplete and Abort.
203 // and Abort. 203 http_post_completed_.Wait();
204 204
205 base::AutoLock lock(fetch_state_lock_); 205 base::AutoLock lock(fetch_state_lock_);
206 DCHECK(fetch_state_.request_completed || fetch_state_.aborted); 206 DCHECK(fetch_state_.request_completed || fetch_state_.aborted);
207 *error_code = fetch_state_.error_code; 207 *error_code = fetch_state_.error_code;
208 *response_code = fetch_state_.http_response_code; 208 *response_code = fetch_state_.http_response_code;
209 return fetch_state_.request_succeeded; 209 return fetch_state_.request_succeeded;
210 } 210 }
211 211
212 void HttpBridge::MakeAsynchronousPost() { 212 void HttpBridge::MakeAsynchronousPost() {
213 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 213 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 // URLFetcher, so it seems most natural / "polite" to let the stack unwind. 290 // URLFetcher, so it seems most natural / "polite" to let the stack unwind.
291 MessageLoop::current()->DeleteSoon(FROM_HERE, fetch_state_.url_poster); 291 MessageLoop::current()->DeleteSoon(FROM_HERE, fetch_state_.url_poster);
292 fetch_state_.url_poster = NULL; 292 fetch_state_.url_poster = NULL;
293 293
294 // Wake the blocked syncer thread in MakeSynchronousPost. 294 // Wake the blocked syncer thread in MakeSynchronousPost.
295 // WARNING: DONT DO ANYTHING AFTER THIS CALL! |this| may be deleted! 295 // WARNING: DONT DO ANYTHING AFTER THIS CALL! |this| may be deleted!
296 http_post_completed_.Signal(); 296 http_post_completed_.Signal();
297 } 297 }
298 298
299 } // namespace browser_sync 299 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/process_singleton_uitest.cc ('k') | chrome/service/gaia/service_gaia_authenticator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698