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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 } | 215 } |
216 | 216 |
217 void HttpBridge::MakeAsynchronousPost() { | 217 void HttpBridge::MakeAsynchronousPost() { |
218 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 218 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
219 base::AutoLock lock(fetch_state_lock_); | 219 base::AutoLock lock(fetch_state_lock_); |
220 DCHECK(!fetch_state_.request_completed); | 220 DCHECK(!fetch_state_.request_completed); |
221 if (fetch_state_.aborted) | 221 if (fetch_state_.aborted) |
222 return; | 222 return; |
223 | 223 |
224 fetch_state_.url_poster = content::URLFetcher::Create( | 224 fetch_state_.url_poster = content::URLFetcher::Create( |
225 url_for_request_, content::URLFetcher::POST, this); | 225 url_for_request_, net::URLFetcher::POST, this); |
226 fetch_state_.url_poster->SetRequestContext(context_getter_for_request_); | 226 fetch_state_.url_poster->SetRequestContext(context_getter_for_request_); |
227 fetch_state_.url_poster->SetUploadData(content_type_, request_content_); | 227 fetch_state_.url_poster->SetUploadData(content_type_, request_content_); |
228 fetch_state_.url_poster->SetExtraRequestHeaders(extra_headers_); | 228 fetch_state_.url_poster->SetExtraRequestHeaders(extra_headers_); |
229 fetch_state_.url_poster->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES); | 229 fetch_state_.url_poster->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES); |
230 fetch_state_.url_poster->Start(); | 230 fetch_state_.url_poster->Start(); |
231 } | 231 } |
232 | 232 |
233 int HttpBridge::GetResponseContentLength() const { | 233 int HttpBridge::GetResponseContentLength() const { |
234 DCHECK_EQ(MessageLoop::current(), created_on_loop_); | 234 DCHECK_EQ(MessageLoop::current(), created_on_loop_); |
235 base::AutoLock lock(fetch_state_lock_); | 235 base::AutoLock lock(fetch_state_lock_); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |