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

Side by Side Diff: content/common/net/url_fetcher_core.cc

Issue 10105018: URLFetcher: Skip posting to IO thread if already on IO thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | no next file » | 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) 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 "content/common/net/url_fetcher_core.h" 5 #include "content/common/net/url_fetcher_core.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util_proxy.h" 8 #include "base/file_util_proxy.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 NOTREACHED(); 324 NOTREACHED();
325 } 325 }
326 } 326 }
327 327
328 void URLFetcherCore::Stop() { 328 void URLFetcherCore::Stop() {
329 if (delegate_loop_proxy_) // May be NULL in tests. 329 if (delegate_loop_proxy_) // May be NULL in tests.
330 DCHECK(delegate_loop_proxy_->BelongsToCurrentThread()); 330 DCHECK(delegate_loop_proxy_->BelongsToCurrentThread());
331 331
332 delegate_ = NULL; 332 delegate_ = NULL;
333 fetcher_ = NULL; 333 fetcher_ = NULL;
334 if (io_message_loop_proxy_.get()) { 334 if (!io_message_loop_proxy_.get())
335 return;
336 if (io_message_loop_proxy_->RunsTasksOnCurrentThread()) {
337 CancelURLRequest();
338 } else {
335 io_message_loop_proxy_->PostTask( 339 io_message_loop_proxy_->PostTask(
336 FROM_HERE, base::Bind(&URLFetcherCore::CancelURLRequest, this)); 340 FROM_HERE, base::Bind(&URLFetcherCore::CancelURLRequest, this));
337 } 341 }
338 } 342 }
339 343
340 void URLFetcherCore::SetUploadData(const std::string& upload_content_type, 344 void URLFetcherCore::SetUploadData(const std::string& upload_content_type,
341 const std::string& upload_content) { 345 const std::string& upload_content) {
342 DCHECK(!is_chunked_upload_); 346 DCHECK(!is_chunked_upload_);
343 upload_content_type_ = upload_content_type; 347 upload_content_type_ = upload_content_type;
344 upload_content_ = upload_content; 348 upload_content_ = upload_content;
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 original_url_throttler_entry_ != url_throttler_entry_) { 918 original_url_throttler_entry_ != url_throttler_entry_) {
915 destination_url_backoff = 919 destination_url_backoff =
916 url_throttler_entry_->GetExponentialBackoffReleaseTime(); 920 url_throttler_entry_->GetExponentialBackoffReleaseTime();
917 } 921 }
918 922
919 return original_url_backoff > destination_url_backoff ? 923 return original_url_backoff > destination_url_backoff ?
920 original_url_backoff : destination_url_backoff; 924 original_url_backoff : destination_url_backoff;
921 } 925 }
922 926
923 } // namespace content 927 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698