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

Side by Side Diff: chrome/common/net/url_fetcher.cc

Issue 6166010: net: Remove typedef net::URLRequestStatus URLRequestStatus; (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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) 2010 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/common/net/url_fetcher.h" 5 #include "chrome/common/net/url_fetcher.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/lock.h" 11 #include "base/lock.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 DISALLOW_COPY_AND_ASSIGN(Registry); 84 DISALLOW_COPY_AND_ASSIGN(Registry);
85 }; 85 };
86 86
87 ~Core(); 87 ~Core();
88 88
89 // Wrapper functions that allow us to ensure actions happen on the right 89 // Wrapper functions that allow us to ensure actions happen on the right
90 // thread. 90 // thread.
91 void StartURLRequest(); 91 void StartURLRequest();
92 void StartURLRequestWhenAppropriate(); 92 void StartURLRequestWhenAppropriate();
93 void CancelURLRequest(); 93 void CancelURLRequest();
94 void OnCompletedURLRequest(const URLRequestStatus& status); 94 void OnCompletedURLRequest(const net::URLRequestStatus& status);
95 void NotifyMalformedContent(); 95 void NotifyMalformedContent();
96 96
97 // Deletes the request, removes it from the registry, and removes the 97 // Deletes the request, removes it from the registry, and removes the
98 // destruction observer. 98 // destruction observer.
99 void ReleaseRequest(); 99 void ReleaseRequest();
100 100
101 // Returns the max value of exponential back-off release time for 101 // Returns the max value of exponential back-off release time for
102 // |original_url_| and |url_|. 102 // |original_url_| and |url_|.
103 base::TimeTicks GetBackoffReleaseTime(); 103 base::TimeTicks GetBackoffReleaseTime();
104 104
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 ReleaseRequest(); 401 ReleaseRequest();
402 } 402 }
403 // Release the reference to the request context. There could be multiple 403 // Release the reference to the request context. There could be multiple
404 // references to URLFetcher::Core at this point so it may take a while to 404 // references to URLFetcher::Core at this point so it may take a while to
405 // delete the object, but we cannot delay the destruction of the request 405 // delete the object, but we cannot delay the destruction of the request
406 // context. 406 // context.
407 request_context_getter_ = NULL; 407 request_context_getter_ = NULL;
408 was_cancelled_ = true; 408 was_cancelled_ = true;
409 } 409 }
410 410
411 void URLFetcher::Core::OnCompletedURLRequest(const URLRequestStatus& status) { 411 void URLFetcher::Core::OnCompletedURLRequest(
412 const net::URLRequestStatus& status) {
412 DCHECK(delegate_loop_proxy_->BelongsToCurrentThread()); 413 DCHECK(delegate_loop_proxy_->BelongsToCurrentThread());
413 414
414 // Checks the response from server. 415 // Checks the response from server.
415 if (response_code_ >= 500 || 416 if (response_code_ >= 500 ||
416 status.os_error() == net::ERR_TEMPORARILY_THROTTLED) { 417 status.os_error() == net::ERR_TEMPORARILY_THROTTLED) {
417 // When encountering a server error, we will send the request again 418 // When encountering a server error, we will send the request again
418 // after backoff time. 419 // after backoff time.
419 ++num_retries_; 420 ++num_retries_;
420 // Restarts the request if we still need to notify the delegate. 421 // Restarts the request if we still need to notify the delegate.
421 if (delegate_) { 422 if (delegate_) {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 } 521 }
521 522
522 // static 523 // static
523 void URLFetcher::CancelAll() { 524 void URLFetcher::CancelAll() {
524 Core::CancelAll(); 525 Core::CancelAll();
525 } 526 }
526 527
527 URLFetcher::Delegate* URLFetcher::delegate() const { 528 URLFetcher::Delegate* URLFetcher::delegate() const {
528 return core_->delegate(); 529 return core_->delegate();
529 } 530 }
OLDNEW
« no previous file with comments | « chrome/common/net/test_url_fetcher_factory.cc ('k') | chrome/common/net/url_fetcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698