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

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

Issue 2481923002: [WIP] make GURL::path() return a StringPiece (Closed)
Patch Set: thanks asan Created 4 years, 1 month 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
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 // For loading files, we make use of overlapped i/o to ensure that reading from 5 // For loading files, we make use of overlapped i/o to ensure that reading from
6 // the filesystem (e.g., a network filesystem) does not block the calling 6 // the filesystem (e.g., a network filesystem) does not block the calling
7 // thread. An alternative approach would be to use a background thread or pool 7 // thread. An alternative approach would be to use a background thread or pool
8 // of threads, but it seems better to leverage the operating system's ability 8 // of threads, but it seems better to leverage the operating system's ability
9 // to do background file reads for us. 9 // to do background file reads for us.
10 // 10 //
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 107 }
108 108
109 return rv; 109 return rv;
110 } 110 }
111 111
112 bool URLRequestFileJob::IsRedirectResponse(GURL* location, 112 bool URLRequestFileJob::IsRedirectResponse(GURL* location,
113 int* http_status_code) { 113 int* http_status_code) {
114 if (meta_info_.is_directory) { 114 if (meta_info_.is_directory) {
115 // This happens when we discovered the file is a directory, so needs a 115 // This happens when we discovered the file is a directory, so needs a
116 // slash at the end of the path. 116 // slash at the end of the path.
117 std::string new_path = request_->url().path(); 117 std::string new_path = request_->url().path().as_string();
118 new_path.push_back('/'); 118 new_path.push_back('/');
119 GURL::Replacements replacements; 119 GURL::Replacements replacements;
120 replacements.SetPathStr(new_path); 120 replacements.SetPathStr(new_path);
121 121
122 *location = request_->url().ReplaceComponents(replacements); 122 *location = request_->url().ReplaceComponents(replacements);
123 *http_status_code = 301; // simulate a permanent redirect 123 *http_status_code = 301; // simulate a permanent redirect
124 return true; 124 return true;
125 } 125 }
126 126
127 #if defined(OS_WIN) 127 #if defined(OS_WIN)
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 DCHECK_GE(remaining_bytes_, 0); 295 DCHECK_GE(remaining_bytes_, 0);
296 } 296 }
297 297
298 OnReadComplete(buf.get(), result); 298 OnReadComplete(buf.get(), result);
299 buf = NULL; 299 buf = NULL;
300 300
301 ReadRawDataComplete(result); 301 ReadRawDataComplete(result);
302 } 302 }
303 303
304 } // namespace net 304 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/sdch_dictionary_fetcher_unittest.cc ('k') | net/websockets/websocket_stream_cookie_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698