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

Side by Side Diff: services/url_response_disk_cache/url_response_disk_cache_impl.cc

Issue 1408793006: Convert "return local_var.Pass();" to "return local_var;". (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "services/url_response_disk_cache/url_response_disk_cache_impl.h" 5 #include "services/url_response_disk_cache/url_response_disk_cache_impl.h"
6 6
7 #include <dirent.h> 7 #include <dirent.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 10
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 base::Bind(base::IgnoreResult(&base::DeleteFile), trash_dir, true), 78 base::Bind(base::IgnoreResult(&base::DeleteFile), trash_dir, true),
79 base::TimeDelta::FromSeconds(kTrashDelayInSeconds)); 79 base::TimeDelta::FromSeconds(kTrashDelayInSeconds));
80 } 80 }
81 81
82 Array<uint8_t> PathToArray(const base::FilePath& path) { 82 Array<uint8_t> PathToArray(const base::FilePath& path) {
83 if (path.empty()) 83 if (path.empty())
84 return Array<uint8_t>(); 84 return Array<uint8_t>();
85 const std::string& string = path.value(); 85 const std::string& string = path.value();
86 auto result = Array<uint8_t>::New(string.size()); 86 auto result = Array<uint8_t>::New(string.size());
87 memcpy(&result.front(), string.data(), string.size()); 87 memcpy(&result.front(), string.data(), string.size());
88 return result.Pass(); 88 return result;
89 } 89 }
90 90
91 // This method remove the query string of an url if one is present. It does 91 // This method remove the query string of an url if one is present. It does
92 // match the behavior of the application manager, which connects to the same app 92 // match the behavior of the application manager, which connects to the same app
93 // if requested twice with different query parameters. 93 // if requested twice with different query parameters.
94 std::string CanonicalizeURL(const std::string& url) { 94 std::string CanonicalizeURL(const std::string& url) {
95 GURL gurl(url); 95 GURL gurl(url);
96 96
97 if (!gurl.has_query()) { 97 if (!gurl.has_query()) {
98 return gurl.spec(); 98 return gurl.spec();
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 const Callback<void(Array<uint8_t>, Array<uint8_t>)>& callback, 200 const Callback<void(Array<uint8_t>, Array<uint8_t>)>& callback,
201 const base::FilePath& path1, 201 const base::FilePath& path1,
202 const base::FilePath& path2) { 202 const base::FilePath& path2) {
203 callback.Run(PathToArray(path1), PathToArray(path2)); 203 callback.Run(PathToArray(path1), PathToArray(path2));
204 } 204 }
205 205
206 mojo::URLResponsePtr GetMinimalResponse(const std::string& url) { 206 mojo::URLResponsePtr GetMinimalResponse(const std::string& url) {
207 mojo::URLResponsePtr response = mojo::URLResponse::New(); 207 mojo::URLResponsePtr response = mojo::URLResponse::New();
208 response->url = url; 208 response->url = url;
209 response->status_code = 200; 209 response->status_code = 200;
210 return response.Pass(); 210 return response;
211 } 211 }
212 212
213 void RunMojoCallbackWithResponse( 213 void RunMojoCallbackWithResponse(
214 const Callback<void(mojo::URLResponsePtr, Array<uint8_t>, Array<uint8_t>)>& 214 const Callback<void(mojo::URLResponsePtr, Array<uint8_t>, Array<uint8_t>)>&
215 callback, 215 callback,
216 const std::string& url, 216 const std::string& url,
217 const base::FilePath& path1, 217 const base::FilePath& path1,
218 const base::FilePath& path2) { 218 const base::FilePath& path2) {
219 mojo::URLResponsePtr response; 219 mojo::URLResponsePtr response;
220 if (!path1.empty()) 220 if (!path1.empty())
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 return; 515 return;
516 } 516 }
517 } 517 }
518 // We can ignore write error, as it will just force to clear the cache on the 518 // We can ignore write error, as it will just force to clear the cache on the
519 // next request. 519 // next request.
520 WriteFile(GetExtractionSentinel(entry_directory), nullptr, 0); 520 WriteFile(GetExtractionSentinel(entry_directory), nullptr, 0);
521 callback.Run(extraction_directory, consumer_cache_directory); 521 callback.Run(extraction_directory, consumer_cache_directory);
522 } 522 }
523 523
524 } // namespace mojo 524 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698