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

Side by Side Diff: net/tools/quic/quic_in_memory_cache.cc

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | « net/tools/gdig/gdig.cc ('k') | net/tools/tld_cleanup/tld_cleanup_util.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/tools/quic/quic_in_memory_cache.h" 5 #include "net/tools/quic/quic_in_memory_cache.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_enumerator.h" 8 #include "base/files/file_enumerator.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 10
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 while (!file.empty()) { 133 while (!file.empty()) {
134 // Need to skip files in .svn directories 134 // Need to skip files in .svn directories
135 if (file.value().find("/.svn/") != std::string::npos) { 135 if (file.value().find("/.svn/") != std::string::npos) {
136 file = file_list.Next(); 136 file = file_list.Next();
137 continue; 137 continue;
138 } 138 }
139 139
140 BalsaHeaders request_headers, response_headers; 140 BalsaHeaders request_headers, response_headers;
141 141
142 string file_contents; 142 string file_contents;
143 file_util::ReadFileToString(file, &file_contents); 143 base::ReadFileToString(file, &file_contents);
144 144
145 // Frame HTTP. 145 // Frame HTTP.
146 CachingBalsaVisitor caching_visitor; 146 CachingBalsaVisitor caching_visitor;
147 BalsaFrame framer; 147 BalsaFrame framer;
148 framer.set_balsa_headers(&response_headers); 148 framer.set_balsa_headers(&response_headers);
149 framer.set_balsa_visitor(&caching_visitor); 149 framer.set_balsa_visitor(&caching_visitor);
150 size_t processed = 0; 150 size_t processed = 0;
151 while (processed < file_contents.length() && 151 while (processed < file_contents.length() &&
152 !caching_visitor.done_framing()) { 152 !caching_visitor.done_framing()) {
153 processed += framer.ProcessInput(file_contents.c_str() + processed, 153 processed += framer.ProcessInput(file_contents.c_str() + processed,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } else if (StringPieceUtils::StartsWithIgnoreCase(uri, "https://")) { 216 } else if (StringPieceUtils::StartsWithIgnoreCase(uri, "https://")) {
217 uri.remove_prefix(8); 217 uri.remove_prefix(8);
218 } else if (StringPieceUtils::StartsWithIgnoreCase(uri, "http://")) { 218 } else if (StringPieceUtils::StartsWithIgnoreCase(uri, "http://")) {
219 uri.remove_prefix(7); 219 uri.remove_prefix(7);
220 } 220 }
221 return host.as_string() + uri.as_string(); 221 return host.as_string() + uri.as_string();
222 } 222 }
223 223
224 } // namespace tools 224 } // namespace tools
225 } // namespace net 225 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/gdig/gdig.cc ('k') | net/tools/tld_cleanup/tld_cleanup_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698