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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 // TODO(jkarlin): Delete caches that are in the directory and not returned | 331 // TODO(jkarlin): Delete caches that are in the directory and not returned |
332 // in LoadIndex. | 332 // in LoadIndex. |
333 callback.Run(names.Pass()); | 333 callback.Run(names.Pass()); |
334 } | 334 } |
335 | 335 |
336 private: | 336 private: |
337 ~SimpleCacheLoader() override {} | 337 ~SimpleCacheLoader() override {} |
338 | 338 |
339 static std::string HexedHash(const std::string& value) { | 339 static std::string HexedHash(const std::string& value) { |
340 std::string value_hash = base::SHA1HashString(value); | 340 std::string value_hash = base::SHA1HashString(value); |
341 std::string valued_hexed_hash = base::StringToLowerASCII( | 341 std::string valued_hexed_hash = base::ToLowerASCII( |
342 base::HexEncode(value_hash.c_str(), value_hash.length())); | 342 base::HexEncode(value_hash.c_str(), value_hash.length())); |
343 return valued_hexed_hash; | 343 return valued_hexed_hash; |
344 } | 344 } |
345 | 345 |
346 static base::FilePath CreatePersistentCachePath( | 346 static base::FilePath CreatePersistentCachePath( |
347 const base::FilePath& origin_path, | 347 const base::FilePath& origin_path, |
348 const std::string& cache_name) { | 348 const std::string& cache_name) { |
349 return origin_path.AppendASCII(HexedHash(cache_name)); | 349 return origin_path.AppendASCII(HexedHash(cache_name)); |
350 } | 350 } |
351 | 351 |
(...skipping 503 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 |