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

Side by Side Diff: net/url_request/url_request.cc

Issue 1502503004: Remove kuint64max. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@kint8
Patch Set: rebase Created 5 years 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
« no previous file with comments | « net/url_request/url_request.h ('k') | net/url_request/url_request_unittest.cc » ('j') | 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 "net/url_request/url_request.h" 5 #include "net/url_request/url_request.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 namespace net { 49 namespace net {
50 50
51 namespace { 51 namespace {
52 52
53 // Max number of http redirects to follow. Same number as gecko. 53 // Max number of http redirects to follow. Same number as gecko.
54 const int kMaxRedirects = 20; 54 const int kMaxRedirects = 20;
55 55
56 // TODO(battre): Delete this, see http://crbug.com/89321: 56 // TODO(battre): Delete this, see http://crbug.com/89321:
57 // This counter keeps track of the identifiers used for URL requests so far. 57 // This counter keeps track of the identifiers used for URL requests so far.
58 // 0 is reserved to represent an invalid ID. 58 // 0 is reserved to represent an invalid ID.
59 uint64 g_next_url_request_identifier = 1; 59 uint64_t g_next_url_request_identifier = 1;
60 60
61 // This lock protects g_next_url_request_identifier. 61 // This lock protects g_next_url_request_identifier.
62 base::LazyInstance<base::Lock>::Leaky 62 base::LazyInstance<base::Lock>::Leaky
63 g_next_url_request_identifier_lock = LAZY_INSTANCE_INITIALIZER; 63 g_next_url_request_identifier_lock = LAZY_INSTANCE_INITIALIZER;
64 64
65 // Returns an prior unused identifier for URL requests. 65 // Returns an prior unused identifier for URL requests.
66 uint64 GenerateURLRequestIdentifier() { 66 uint64_t GenerateURLRequestIdentifier() {
67 base::AutoLock lock(g_next_url_request_identifier_lock.Get()); 67 base::AutoLock lock(g_next_url_request_identifier_lock.Get());
68 return g_next_url_request_identifier++; 68 return g_next_url_request_identifier++;
69 } 69 }
70 70
71 // True once the first URLRequest was started. 71 // True once the first URLRequest was started.
72 bool g_url_requests_started = false; 72 bool g_url_requests_started = false;
73 73
74 // True if cookies are accepted by default. 74 // True if cookies are accepted by default.
75 bool g_default_can_use_cookies = true; 75 bool g_default_can_use_cookies = true;
76 76
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 return; 687 return;
688 } 688 }
689 DoCancel(error, ssl_info); 689 DoCancel(error, ssl_info);
690 } 690 }
691 691
692 void URLRequest::DoCancel(int error, const SSLInfo& ssl_info) { 692 void URLRequest::DoCancel(int error, const SSLInfo& ssl_info) {
693 DCHECK(error < 0); 693 DCHECK(error < 0);
694 // ~500,000 ERR_ABORTED < 100ms in Canary channel a day. Sample .01% to get 694 // ~500,000 ERR_ABORTED < 100ms in Canary channel a day. Sample .01% to get
695 // ~50 reports a day. 695 // ~50 reports a day.
696 // TODO(csharrison) Remove this code when crbug.com/557430 is resolved. 696 // TODO(csharrison) Remove this code when crbug.com/557430 is resolved.
697 int64 request_time = 697 int64_t request_time =
698 (base::TimeTicks::Now() - creation_time_).InMilliseconds(); 698 (base::TimeTicks::Now() - creation_time_).InMilliseconds();
699 if (!has_notified_completion_ && error == ERR_ABORTED && 699 if (!has_notified_completion_ && error == ERR_ABORTED &&
700 request_time <= 100 && load_flags_ & LOAD_MAIN_FRAME && 700 request_time <= 100 && load_flags_ & LOAD_MAIN_FRAME &&
701 base::RandDouble() < .00001) { 701 base::RandDouble() < .00001) {
702 static int dump_times = 0; 702 static int dump_times = 0;
703 if (dump_times < 5) { 703 if (dump_times < 5) {
704 char url_copy[256] = {0}; 704 char url_copy[256] = {0};
705 strncpy(url_copy, url().spec().c_str(), sizeof(url_copy)); 705 strncpy(url_copy, url().spec().c_str(), sizeof(url_copy));
706 base::debug::Alias(&url_copy); 706 base::debug::Alias(&url_copy);
707 base::debug::Alias(&request_time); 707 base::debug::Alias(&request_time);
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 --redirect_limit_; 998 --redirect_limit_;
999 999
1000 Start(); 1000 Start();
1001 return OK; 1001 return OK;
1002 } 1002 }
1003 1003
1004 const URLRequestContext* URLRequest::context() const { 1004 const URLRequestContext* URLRequest::context() const {
1005 return context_; 1005 return context_;
1006 } 1006 }
1007 1007
1008 int64 URLRequest::GetExpectedContentSize() const { 1008 int64_t URLRequest::GetExpectedContentSize() const {
1009 int64 expected_content_size = -1; 1009 int64_t expected_content_size = -1;
1010 if (job_.get()) 1010 if (job_.get())
1011 expected_content_size = job_->expected_content_size(); 1011 expected_content_size = job_->expected_content_size();
1012 1012
1013 return expected_content_size; 1013 return expected_content_size;
1014 } 1014 }
1015 1015
1016 void URLRequest::SetPriority(RequestPriority priority) { 1016 void URLRequest::SetPriority(RequestPriority priority) {
1017 DCHECK_GE(priority, MINIMUM_PRIORITY); 1017 DCHECK_GE(priority, MINIMUM_PRIORITY);
1018 DCHECK_LE(priority, MAXIMUM_PRIORITY); 1018 DCHECK_LE(priority, MAXIMUM_PRIORITY);
1019 1019
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 } 1222 }
1223 1223
1224 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const { 1224 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const {
1225 if (job_) 1225 if (job_)
1226 job_->GetConnectionAttempts(out); 1226 job_->GetConnectionAttempts(out);
1227 else 1227 else
1228 out->clear(); 1228 out->clear();
1229 } 1229 }
1230 1230
1231 } // namespace net 1231 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request.h ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698