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

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

Issue 8341117: Converted top-level NewRunnable* to Bind for Sync module (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Indenting. Removed trailing whitespace. Created 9 years, 1 month 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/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 DCHECK_EQ(MessageLoop::current(), created_on_loop_); 186 DCHECK_EQ(MessageLoop::current(), created_on_loop_);
187 if (DCHECK_IS_ON()) { 187 if (DCHECK_IS_ON()) {
188 base::AutoLock lock(fetch_state_lock_); 188 base::AutoLock lock(fetch_state_lock_);
189 DCHECK(!fetch_state_.request_completed); 189 DCHECK(!fetch_state_.request_completed);
190 } 190 }
191 DCHECK(url_for_request_.is_valid()) << "Invalid URL for request"; 191 DCHECK(url_for_request_.is_valid()) << "Invalid URL for request";
192 DCHECK(!content_type_.empty()) << "Payload not set"; 192 DCHECK(!content_type_.empty()) << "Payload not set";
193 193
194 if (!BrowserThread::PostTask( 194 if (!BrowserThread::PostTask(
195 BrowserThread::IO, FROM_HERE, 195 BrowserThread::IO, FROM_HERE,
196 NewRunnableMethod(this, &HttpBridge::CallMakeAsynchronousPost))) { 196 base::Bind(&HttpBridge::CallMakeAsynchronousPost, this))) {
197 // This usually happens when we're in a unit test. 197 // This usually happens when we're in a unit test.
198 LOG(WARNING) << "Could not post CallMakeAsynchronousPost task"; 198 LOG(WARNING) << "Could not post CallMakeAsynchronousPost task";
199 return false; 199 return false;
200 } 200 }
201 201
202 // Block until network request completes or is aborted. See 202 // Block until network request completes or is aborted. See
203 // OnURLFetchComplete and Abort. 203 // OnURLFetchComplete and Abort.
204 http_post_completed_.Wait(); 204 http_post_completed_.Wait();
205 205
206 base::AutoLock lock(fetch_state_lock_); 206 base::AutoLock lock(fetch_state_lock_);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 // URLFetcher, so it seems most natural / "polite" to let the stack unwind. 286 // URLFetcher, so it seems most natural / "polite" to let the stack unwind.
287 MessageLoop::current()->DeleteSoon(FROM_HERE, fetch_state_.url_poster); 287 MessageLoop::current()->DeleteSoon(FROM_HERE, fetch_state_.url_poster);
288 fetch_state_.url_poster = NULL; 288 fetch_state_.url_poster = NULL;
289 289
290 // Wake the blocked syncer thread in MakeSynchronousPost. 290 // Wake the blocked syncer thread in MakeSynchronousPost.
291 // WARNING: DONT DO ANYTHING AFTER THIS CALL! |this| may be deleted! 291 // WARNING: DONT DO ANYTHING AFTER THIS CALL! |this| may be deleted!
292 http_post_completed_.Signal(); 292 http_post_completed_.Signal();
293 } 293 }
294 294
295 } // namespace browser_sync 295 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/browser_thread_model_worker.cc ('k') | chrome/browser/sync/glue/password_data_type_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698