| 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_cache.h" | 5 #include "content/browser/cache_storage/cache_storage_cache.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1385 void CacheStorageCache::InitGotCacheSize(const base::Closure& callback, | 1385 void CacheStorageCache::InitGotCacheSize(const base::Closure& callback, |
| 1386 CacheStorageError cache_create_error, | 1386 CacheStorageError cache_create_error, |
| 1387 int cache_size) { | 1387 int cache_size) { |
| 1388 // Now that we know the cache size either 1) the cache size should be unknown | 1388 // Now that we know the cache size either 1) the cache size should be unknown |
| 1389 // (which is why the size was calculated), or 2) it must match the current | 1389 // (which is why the size was calculated), or 2) it must match the current |
| 1390 // size. If the sizes aren't equal then there is a bug in how the cache size | 1390 // size. If the sizes aren't equal then there is a bug in how the cache size |
| 1391 // is saved in the store's index. | 1391 // is saved in the store's index. |
| 1392 if (cache_size_ != CacheStorage::kSizeUnknown && cache_size_ != cache_size) { | 1392 if (cache_size_ != CacheStorage::kSizeUnknown && cache_size_ != cache_size) { |
| 1393 // TODO(cmumford): Add UMA for this. | 1393 // TODO(cmumford): Add UMA for this. |
| 1394 LOG(ERROR) << "Cache size/index mismatch"; | 1394 LOG(ERROR) << "Cache size/index mismatch"; |
| 1395 DCHECK_EQ(cache_size_, cache_size); | 1395 // Disabled for crbug.com/681900. |
| 1396 // DCHECK_EQ(cache_size_, cache_size); |
| 1396 } | 1397 } |
| 1397 cache_size_ = cache_size; | 1398 cache_size_ = cache_size; |
| 1398 initializing_ = false; | 1399 initializing_ = false; |
| 1399 backend_state_ = (cache_create_error == CACHE_STORAGE_OK && backend_ && | 1400 backend_state_ = (cache_create_error == CACHE_STORAGE_OK && backend_ && |
| 1400 backend_state_ == BACKEND_UNINITIALIZED) | 1401 backend_state_ == BACKEND_UNINITIALIZED) |
| 1401 ? BACKEND_OPEN | 1402 ? BACKEND_OPEN |
| 1402 : BACKEND_CLOSED; | 1403 : BACKEND_CLOSED; |
| 1403 | 1404 |
| 1404 UMA_HISTOGRAM_ENUMERATION("ServiceWorkerCache.InitBackendResult", | 1405 UMA_HISTOGRAM_ENUMERATION("ServiceWorkerCache.InitBackendResult", |
| 1405 cache_create_error, CACHE_STORAGE_ERROR_LAST + 1); | 1406 cache_create_error, CACHE_STORAGE_ERROR_LAST + 1); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1480 temp_entry, INDEX_RESPONSE_BODY, INDEX_SIDE_DATA); | 1481 temp_entry, INDEX_RESPONSE_BODY, INDEX_SIDE_DATA); |
| 1481 return blob_storage_context_->AddFinishedBlob(&blob_data); | 1482 return blob_storage_context_->AddFinishedBlob(&blob_data); |
| 1482 } | 1483 } |
| 1483 | 1484 |
| 1484 std::unique_ptr<CacheStorageCacheHandle> | 1485 std::unique_ptr<CacheStorageCacheHandle> |
| 1485 CacheStorageCache::CreateCacheHandle() { | 1486 CacheStorageCache::CreateCacheHandle() { |
| 1486 return cache_storage_->CreateCacheHandle(this); | 1487 return cache_storage_->CreateCacheHandle(this); |
| 1487 } | 1488 } |
| 1488 | 1489 |
| 1489 } // namespace content | 1490 } // namespace content |
| OLD | NEW |