OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 fetch_state_.url_poster = NULL; | 274 fetch_state_.url_poster = NULL; |
275 fetch_state_.error_code = net::ERR_ABORTED; | 275 fetch_state_.error_code = net::ERR_ABORTED; |
276 http_post_completed_.Signal(); | 276 http_post_completed_.Signal(); |
277 } | 277 } |
278 | 278 |
279 void HttpBridge::DestroyURLFetcherOnIOThread(content::URLFetcher* fetcher) { | 279 void HttpBridge::DestroyURLFetcherOnIOThread(content::URLFetcher* fetcher) { |
280 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 280 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
281 delete fetcher; | 281 delete fetcher; |
282 } | 282 } |
283 | 283 |
284 void HttpBridge::OnURLFetchComplete(const content::URLFetcher *source) { | 284 void HttpBridge::OnURLFetchComplete(const net::URLFetcher* source) { |
285 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 285 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
286 base::AutoLock lock(fetch_state_lock_); | 286 base::AutoLock lock(fetch_state_lock_); |
287 if (fetch_state_.aborted) | 287 if (fetch_state_.aborted) |
288 return; | 288 return; |
289 | 289 |
290 fetch_state_.request_completed = true; | 290 fetch_state_.request_completed = true; |
291 fetch_state_.request_succeeded = | 291 fetch_state_.request_succeeded = |
292 (net::URLRequestStatus::SUCCESS == source->GetStatus().status()); | 292 (net::URLRequestStatus::SUCCESS == source->GetStatus().status()); |
293 fetch_state_.http_response_code = source->GetResponseCode(); | 293 fetch_state_.http_response_code = source->GetResponseCode(); |
294 fetch_state_.error_code = source->GetStatus().error(); | 294 fetch_state_.error_code = source->GetStatus().error(); |
295 | 295 |
296 source->GetResponseAsString(&fetch_state_.response_content); | 296 source->GetResponseAsString(&fetch_state_.response_content); |
297 fetch_state_.response_headers = source->GetResponseHeaders(); | 297 fetch_state_.response_headers = source->GetResponseHeaders(); |
298 | 298 |
299 // End of the line for url_poster_. It lives only on the IO loop. | 299 // End of the line for url_poster_. It lives only on the IO loop. |
300 // We defer deletion because we're inside a callback from a component of the | 300 // We defer deletion because we're inside a callback from a component of the |
301 // URLFetcher, so it seems most natural / "polite" to let the stack unwind. | 301 // URLFetcher, so it seems most natural / "polite" to let the stack unwind. |
302 MessageLoop::current()->DeleteSoon(FROM_HERE, fetch_state_.url_poster); | 302 MessageLoop::current()->DeleteSoon(FROM_HERE, fetch_state_.url_poster); |
303 fetch_state_.url_poster = NULL; | 303 fetch_state_.url_poster = NULL; |
304 | 304 |
305 // Wake the blocked syncer thread in MakeSynchronousPost. | 305 // Wake the blocked syncer thread in MakeSynchronousPost. |
306 // WARNING: DONT DO ANYTHING AFTER THIS CALL! |this| may be deleted! | 306 // WARNING: DONT DO ANYTHING AFTER THIS CALL! |this| may be deleted! |
307 http_post_completed_.Signal(); | 307 http_post_completed_.Signal(); |
308 } | 308 } |
309 | 309 |
310 } // namespace browser_sync | 310 } // namespace browser_sync |
OLD | NEW |