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

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

Issue 192057: Use "GURL::possibly_invalid_spec()" rather than "GURL::spec()", in case the G... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Make unittest better Created 11 years, 3 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 | 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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/singleton.h" 9 #include "base/singleton.h"
10 #include "base/stats_counters.h" 10 #include "base/stats_counters.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 InsertIntoGraveyard(ExtractInfo(node->url_request())); 94 InsertIntoGraveyard(ExtractInfo(node->url_request()));
95 } 95 }
96 96
97 // static 97 // static
98 const URLRequest::InstanceTracker::RecentRequestInfo 98 const URLRequest::InstanceTracker::RecentRequestInfo
99 URLRequest::InstanceTracker::ExtractInfo(URLRequest* url_request) { 99 URLRequest::InstanceTracker::ExtractInfo(URLRequest* url_request) {
100 RecentRequestInfo info; 100 RecentRequestInfo info;
101 info.original_url = url_request->original_url(); 101 info.original_url = url_request->original_url();
102 info.load_log = url_request->load_log(); 102 info.load_log = url_request->load_log();
103 103
104 // Paranoia check: truncate really big URLs. 104 // Paranoia check: truncate |info.original_url| if it is really big.
105 if (info.original_url.spec().size() > kMaxGraveyardURLSize) { 105 const std::string& spec = info.original_url.possibly_invalid_spec();
106 info.original_url = GURL(url_request->original_url().spec().substr( 106 if (spec.size() > kMaxGraveyardURLSize)
107 0, kMaxGraveyardURLSize)); 107 info.original_url = GURL(spec.substr(0, kMaxGraveyardURLSize));
108 }
109 return info; 108 return info;
110 } 109 }
111 110
112 void URLRequest::InstanceTracker::InsertIntoGraveyard( 111 void URLRequest::InstanceTracker::InsertIntoGraveyard(
113 const RecentRequestInfo& info) { 112 const RecentRequestInfo& info) {
114 if (graveyard_.size() < kMaxGraveyardSize) { 113 if (graveyard_.size() < kMaxGraveyardSize) {
115 // Still growing to maximum capacity. 114 // Still growing to maximum capacity.
116 DCHECK_EQ(next_graveyard_index_, graveyard_.size()); 115 DCHECK_EQ(next_graveyard_index_, graveyard_.size());
117 graveyard_.push_back(info); 116 graveyard_.push_back(info);
118 } else { 117 } else {
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 URLRequest::UserData* URLRequest::GetUserData(const void* key) const { 600 URLRequest::UserData* URLRequest::GetUserData(const void* key) const {
602 UserDataMap::const_iterator found = user_data_.find(key); 601 UserDataMap::const_iterator found = user_data_.find(key);
603 if (found != user_data_.end()) 602 if (found != user_data_.end())
604 return found->second.get(); 603 return found->second.get();
605 return NULL; 604 return NULL;
606 } 605 }
607 606
608 void URLRequest::SetUserData(const void* key, UserData* data) { 607 void URLRequest::SetUserData(const void* key, UserData* data) {
609 user_data_[key] = linked_ptr<UserData>(data); 608 user_data_[key] = linked_ptr<UserData>(data);
610 } 609 }
OLDNEW
« no previous file with comments | « no previous file | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698