OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/cache_storage/cache_storage.h" | 5 #include "content/browser/cache_storage/cache_storage.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/barrier_closure.h" | 9 #include "base/barrier_closure.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
269 base::ThreadTaskRunnerHandle::Get())); | 269 base::ThreadTaskRunnerHandle::Get())); |
270 } | 270 } |
271 | 271 |
272 static void WriteIndexWriteToFileInPool( | 272 static void WriteIndexWriteToFileInPool( |
273 const base::FilePath& tmp_path, | 273 const base::FilePath& tmp_path, |
274 const base::FilePath& index_path, | 274 const base::FilePath& index_path, |
275 const std::string& data, | 275 const std::string& data, |
276 const BoolCallback& callback, | 276 const BoolCallback& callback, |
277 const scoped_refptr<base::SingleThreadTaskRunner>& original_task_runner) { | 277 const scoped_refptr<base::SingleThreadTaskRunner>& original_task_runner) { |
278 int bytes_written = base::WriteFile(tmp_path, data.c_str(), data.size()); | 278 int bytes_written = base::WriteFile(tmp_path, data.c_str(), data.size()); |
279 if (bytes_written != implicit_cast<int>(data.size())) { | 279 if (bytes_written != static_cast<int>(data.size())) { |
vmpstr
2015/09/11 21:00:49
Same here, maybe?
danakj
2015/09/11 21:20:28
Here we pass data.size() to base::WriteFile which
| |
280 base::DeleteFile(tmp_path, /* recursive */ false); | 280 base::DeleteFile(tmp_path, /* recursive */ false); |
281 original_task_runner->PostTask(FROM_HERE, base::Bind(callback, false)); | 281 original_task_runner->PostTask(FROM_HERE, base::Bind(callback, false)); |
282 } | 282 } |
283 | 283 |
284 // Atomically rename the temporary index file to become the real one. | 284 // Atomically rename the temporary index file to become the real one. |
285 bool rv = base::ReplaceFile(tmp_path, index_path, NULL); | 285 bool rv = base::ReplaceFile(tmp_path, index_path, NULL); |
286 original_task_runner->PostTask(FROM_HERE, base::Bind(callback, rv)); | 286 original_task_runner->PostTask(FROM_HERE, base::Bind(callback, rv)); |
287 } | 287 } |
288 | 288 |
289 void LoadIndex(scoped_ptr<std::vector<std::string>> names, | 289 void LoadIndex(scoped_ptr<std::vector<std::string>> names, |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
855 scoped_ptr<ServiceWorkerResponse> response, | 855 scoped_ptr<ServiceWorkerResponse> response, |
856 scoped_ptr<storage::BlobDataHandle> blob_data_handle) { | 856 scoped_ptr<storage::BlobDataHandle> blob_data_handle) { |
857 base::WeakPtr<CacheStorage> cache_storage = weak_factory_.GetWeakPtr(); | 857 base::WeakPtr<CacheStorage> cache_storage = weak_factory_.GetWeakPtr(); |
858 | 858 |
859 callback.Run(error, response.Pass(), blob_data_handle.Pass()); | 859 callback.Run(error, response.Pass(), blob_data_handle.Pass()); |
860 if (cache_storage) | 860 if (cache_storage) |
861 scheduler_->CompleteOperationAndRunNext(); | 861 scheduler_->CompleteOperationAndRunNext(); |
862 } | 862 } |
863 | 863 |
864 } // namespace content | 864 } // namespace content |
OLD | NEW |