| 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 <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1407 net::CompletionCallback create_cache_callback = | 1407 net::CompletionCallback create_cache_callback = |
| 1408 base::Bind(&CacheStorageCache::CreateBackendDidCreate, | 1408 base::Bind(&CacheStorageCache::CreateBackendDidCreate, |
| 1409 weak_ptr_factory_.GetWeakPtr(), callback, | 1409 weak_ptr_factory_.GetWeakPtr(), callback, |
| 1410 base::Passed(std::move(backend_ptr))); | 1410 base::Passed(std::move(backend_ptr))); |
| 1411 | 1411 |
| 1412 // TODO(jkarlin): Use the cache task runner that ServiceWorkerCacheCore | 1412 // TODO(jkarlin): Use the cache task runner that ServiceWorkerCacheCore |
| 1413 // has for disk caches. | 1413 // has for disk caches. |
| 1414 int rv = disk_cache::CreateCacheBackend( | 1414 int rv = disk_cache::CreateCacheBackend( |
| 1415 cache_type, net::CACHE_BACKEND_SIMPLE, path_, kMaxCacheBytes, | 1415 cache_type, net::CACHE_BACKEND_SIMPLE, path_, kMaxCacheBytes, |
| 1416 false, /* force */ | 1416 false, /* force */ |
| 1417 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE).get(), | 1417 BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE).get(), NULL, |
| 1418 NULL, backend, create_cache_callback); | 1418 backend, create_cache_callback); |
| 1419 if (rv != net::ERR_IO_PENDING) | 1419 if (rv != net::ERR_IO_PENDING) |
| 1420 create_cache_callback.Run(rv); | 1420 create_cache_callback.Run(rv); |
| 1421 } | 1421 } |
| 1422 | 1422 |
| 1423 void CacheStorageCache::CreateBackendDidCreate( | 1423 void CacheStorageCache::CreateBackendDidCreate( |
| 1424 const CacheStorageCache::ErrorCallback& callback, | 1424 const CacheStorageCache::ErrorCallback& callback, |
| 1425 std::unique_ptr<ScopedBackendPtr> backend_ptr, | 1425 std::unique_ptr<ScopedBackendPtr> backend_ptr, |
| 1426 int rv) { | 1426 int rv) { |
| 1427 if (rv != net::OK) { | 1427 if (rv != net::OK) { |
| 1428 callback.Run(CACHE_STORAGE_ERROR_STORAGE); | 1428 callback.Run(CACHE_STORAGE_ERROR_STORAGE); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1578 temp_entry, INDEX_RESPONSE_BODY, INDEX_SIDE_DATA); | 1578 temp_entry, INDEX_RESPONSE_BODY, INDEX_SIDE_DATA); |
| 1579 return blob_storage_context_->AddFinishedBlob(&blob_data); | 1579 return blob_storage_context_->AddFinishedBlob(&blob_data); |
| 1580 } | 1580 } |
| 1581 | 1581 |
| 1582 std::unique_ptr<CacheStorageCacheHandle> | 1582 std::unique_ptr<CacheStorageCacheHandle> |
| 1583 CacheStorageCache::CreateCacheHandle() { | 1583 CacheStorageCache::CreateCacheHandle() { |
| 1584 return cache_storage_->CreateCacheHandle(this); | 1584 return cache_storage_->CreateCacheHandle(this); |
| 1585 } | 1585 } |
| 1586 | 1586 |
| 1587 } // namespace content | 1587 } // namespace content |
| OLD | NEW |