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

Unified Diff: net/url_request/url_request_status.cc

Issue 1239993004: Fix all failed and canceled URLRequestStatuses without errors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix more failures Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/url_request/url_request_status.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_status.cc
diff --git a/net/url_request/url_request_status.cc b/net/url_request/url_request_status.cc
index c4643f260b8605827df9661379cbdc2967261926..2a6a2fae861c202a51fc677558a7f3584c286373 100644
--- a/net/url_request/url_request_status.cc
+++ b/net/url_request/url_request_status.cc
@@ -4,10 +4,36 @@
#include "net/url_request/url_request_status.h"
+#include "base/logging.h"
#include "net/base/net_errors.h"
namespace net {
+URLRequestStatus::URLRequestStatus(Status status, int error)
+ : status_(status), error_(error) {
+ // URLRequestStatus should get folded into error. However, it is possible to
+ // create URLRequestStatuses with inconsistent |status_| and |error_|
+ // fields. As callers are cleaned up, these assertions avoid regressing any
+ // invariants that have been established.
+ //
+ // https://crbug.com/490311
+ DCHECK_GE(0, error_);
+ switch (status_) {
+ case SUCCESS:
+ DCHECK_EQ(OK, error_);
+ break;
+ case IO_PENDING:
+ // TODO(davidben): Switch all IO_PENDING status to ERR_IO_PENDING.
+ DCHECK(error_ == 0 || error_ == ERR_IO_PENDING);
+ break;
+ case CANCELED:
+ case FAILED:
+ DCHECK_NE(OK, error_);
+ DCHECK_NE(ERR_IO_PENDING, error_);
+ break;
+ }
+}
+
URLRequestStatus URLRequestStatus::FromError(int error) {
if (error == OK) {
return URLRequestStatus(SUCCESS, OK);
« no previous file with comments | « net/url_request/url_request_status.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698