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

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

Issue 89243003: Move EmptyString, kWhitespace and the BOM to base. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « net/ftp/ftp_network_transaction.cc ('k') | net/url_request/url_request_http_job.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_context.h" 5 #include "net/url_request/url_request_context.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/debug/alias.h" 8 #include "base/debug/alias.h"
9 #include "base/debug/stack_trace.h" 9 #include "base/debug/stack_trace.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 URLRequest::Delegate* delegate) const { 74 URLRequest::Delegate* delegate) const {
75 return scoped_ptr<URLRequest>(new URLRequest(url, priority, delegate, this)); 75 return scoped_ptr<URLRequest>(new URLRequest(url, priority, delegate, this));
76 } 76 }
77 77
78 void URLRequestContext::set_cookie_store(CookieStore* cookie_store) { 78 void URLRequestContext::set_cookie_store(CookieStore* cookie_store) {
79 cookie_store_ = cookie_store; 79 cookie_store_ = cookie_store;
80 } 80 }
81 81
82 std::string URLRequestContext::GetAcceptLanguage() const { 82 std::string URLRequestContext::GetAcceptLanguage() const {
83 return http_user_agent_settings_ ? 83 return http_user_agent_settings_ ?
84 http_user_agent_settings_->GetAcceptLanguage() : EmptyString(); 84 http_user_agent_settings_->GetAcceptLanguage() : std::string();
85 } 85 }
86 86
87 std::string URLRequestContext::GetUserAgent(const GURL& url) const { 87 std::string URLRequestContext::GetUserAgent(const GURL& url) const {
88 return http_user_agent_settings_ ? 88 return http_user_agent_settings_ ?
89 http_user_agent_settings_->GetUserAgent(url) : EmptyString(); 89 http_user_agent_settings_->GetUserAgent(url) : std::string();
90 } 90 }
91 91
92 void URLRequestContext::AssertNoURLRequests() const { 92 void URLRequestContext::AssertNoURLRequests() const {
93 int num_requests = url_requests_->size(); 93 int num_requests = url_requests_->size();
94 if (num_requests != 0) { 94 if (num_requests != 0) {
95 // We're leaking URLRequests :( Dump the URL of the first one and record how 95 // We're leaking URLRequests :( Dump the URL of the first one and record how
96 // many we leaked so we have an idea of how bad it is. 96 // many we leaked so we have an idea of how bad it is.
97 char url_buf[128]; 97 char url_buf[128];
98 const URLRequest* request = *url_requests_->begin(); 98 const URLRequest* request = *url_requests_->begin();
99 base::strlcpy(url_buf, request->url().spec().c_str(), arraysize(url_buf)); 99 base::strlcpy(url_buf, request->url().spec().c_str(), arraysize(url_buf));
100 bool has_delegate = request->has_delegate(); 100 bool has_delegate = request->has_delegate();
101 int load_flags = request->load_flags(); 101 int load_flags = request->load_flags();
102 base::debug::StackTrace stack_trace(NULL, 0); 102 base::debug::StackTrace stack_trace(NULL, 0);
103 if (request->stack_trace()) 103 if (request->stack_trace())
104 stack_trace = *request->stack_trace(); 104 stack_trace = *request->stack_trace();
105 base::debug::Alias(url_buf); 105 base::debug::Alias(url_buf);
106 base::debug::Alias(&num_requests); 106 base::debug::Alias(&num_requests);
107 base::debug::Alias(&has_delegate); 107 base::debug::Alias(&has_delegate);
108 base::debug::Alias(&load_flags); 108 base::debug::Alias(&load_flags);
109 base::debug::Alias(&stack_trace); 109 base::debug::Alias(&stack_trace);
110 CHECK(false) << "Leaked " << num_requests << " URLRequest(s). First URL: " 110 CHECK(false) << "Leaked " << num_requests << " URLRequest(s). First URL: "
111 << request->url().spec().c_str() << "."; 111 << request->url().spec().c_str() << ".";
112 } 112 }
113 } 113 }
114 114
115 } // namespace net 115 } // namespace net
OLDNEW
« no previous file with comments | « net/ftp/ftp_network_transaction.cc ('k') | net/url_request/url_request_http_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698