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

Side by Side Diff: content/browser/cache_storage/cache_storage.cc

Issue 1340683002: Remove base's implicit_cast. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: implicitcast: numericstest Created 5 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
OLDNEW
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"
11 #include "base/files/memory_mapped_file.h" 11 #include "base/files/memory_mapped_file.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/metrics/histogram_macros.h" 14 #include "base/metrics/histogram_macros.h"
15 #include "base/numerics/safe_conversions.h"
15 #include "base/sha1.h" 16 #include "base/sha1.h"
16 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
17 #include "base/stl_util.h" 18 #include "base/stl_util.h"
18 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
19 #include "base/strings/string_util.h" 20 #include "base/strings/string_util.h"
20 #include "base/thread_task_runner_handle.h" 21 #include "base/thread_task_runner_handle.h"
21 #include "content/browser/cache_storage/cache_storage.pb.h" 22 #include "content/browser/cache_storage/cache_storage.pb.h"
22 #include "content/browser/cache_storage/cache_storage_cache.h" 23 #include "content/browser/cache_storage/cache_storage_cache.h"
23 #include "content/browser/cache_storage/cache_storage_scheduler.h" 24 #include "content/browser/cache_storage/cache_storage_scheduler.h"
24 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 base::ThreadTaskRunnerHandle::Get())); 270 base::ThreadTaskRunnerHandle::Get()));
270 } 271 }
271 272
272 static void WriteIndexWriteToFileInPool( 273 static void WriteIndexWriteToFileInPool(
273 const base::FilePath& tmp_path, 274 const base::FilePath& tmp_path,
274 const base::FilePath& index_path, 275 const base::FilePath& index_path,
275 const std::string& data, 276 const std::string& data,
276 const BoolCallback& callback, 277 const BoolCallback& callback,
277 const scoped_refptr<base::SingleThreadTaskRunner>& original_task_runner) { 278 const scoped_refptr<base::SingleThreadTaskRunner>& original_task_runner) {
278 int bytes_written = base::WriteFile(tmp_path, data.c_str(), data.size()); 279 int bytes_written = base::WriteFile(tmp_path, data.c_str(), data.size());
279 if (bytes_written != implicit_cast<int>(data.size())) { 280 if (bytes_written != base::checked_cast<int>(data.size())) {
280 base::DeleteFile(tmp_path, /* recursive */ false); 281 base::DeleteFile(tmp_path, /* recursive */ false);
281 original_task_runner->PostTask(FROM_HERE, base::Bind(callback, false)); 282 original_task_runner->PostTask(FROM_HERE, base::Bind(callback, false));
282 } 283 }
283 284
284 // Atomically rename the temporary index file to become the real one. 285 // Atomically rename the temporary index file to become the real one.
285 bool rv = base::ReplaceFile(tmp_path, index_path, NULL); 286 bool rv = base::ReplaceFile(tmp_path, index_path, NULL);
286 original_task_runner->PostTask(FROM_HERE, base::Bind(callback, rv)); 287 original_task_runner->PostTask(FROM_HERE, base::Bind(callback, rv));
287 } 288 }
288 289
289 void LoadIndex(scoped_ptr<std::vector<std::string>> names, 290 void LoadIndex(scoped_ptr<std::vector<std::string>> names,
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 scoped_ptr<ServiceWorkerResponse> response, 856 scoped_ptr<ServiceWorkerResponse> response,
856 scoped_ptr<storage::BlobDataHandle> blob_data_handle) { 857 scoped_ptr<storage::BlobDataHandle> blob_data_handle) {
857 base::WeakPtr<CacheStorage> cache_storage = weak_factory_.GetWeakPtr(); 858 base::WeakPtr<CacheStorage> cache_storage = weak_factory_.GetWeakPtr();
858 859
859 callback.Run(error, response.Pass(), blob_data_handle.Pass()); 860 callback.Run(error, response.Pass(), blob_data_handle.Pass());
860 if (cache_storage) 861 if (cache_storage)
861 scheduler_->CompleteOperationAndRunNext(); 862 scheduler_->CompleteOperationAndRunNext();
862 } 863 }
863 864
864 } // namespace content 865 } // namespace content
OLDNEW
« no previous file with comments | « components/history/core/browser/visitsegment_database.cc ('k') | net/disk_cache/backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698