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