| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_HANDLE_H_ |
| 6 #define CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_HANDLE_H_ |
| 7 |
| 8 #include "base/memory/weak_ptr.h" |
| 9 #include "content/browser/cache_storage/cache_storage.h" |
| 10 #include "content/browser/cache_storage/cache_storage_cache.h" |
| 11 |
| 12 namespace content { |
| 13 |
| 14 // Holds a reference to a CacheStorageCache. The CacheStorage will keep the |
| 15 // CacheStorageCache alive until the last handle is destroyed or the |
| 16 // CacheStorage is deleted. |
| 17 class CONTENT_EXPORT CacheStorageCacheHandle { |
| 18 public: |
| 19 ~CacheStorageCacheHandle(); |
| 20 |
| 21 // Returns the underlying CacheStorageCache*. Will return nullptr if the |
| 22 // CacheStorage has been deleted. |
| 23 CacheStorageCache* value() { return cache_storage_cache_.get(); } |
| 24 |
| 25 std::unique_ptr<CacheStorageCacheHandle> Clone(); |
| 26 |
| 27 private: |
| 28 friend class CacheStorage; |
| 29 |
| 30 CacheStorageCacheHandle(base::WeakPtr<CacheStorageCache> cache_storage_cache, |
| 31 base::WeakPtr<CacheStorage> cache_storage); |
| 32 |
| 33 base::WeakPtr<CacheStorageCache> cache_storage_cache_; |
| 34 base::WeakPtr<CacheStorage> cache_storage_; |
| 35 |
| 36 DISALLOW_COPY_AND_ASSIGN(CacheStorageCacheHandle); |
| 37 }; |
| 38 |
| 39 } // namespace content |
| 40 |
| 41 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_HANDLE_H_ |
| OLD | NEW |