Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1026)

Unified Diff: content/browser/cache_storage/cache_storage_cache_handle.h

Issue 2056983004: [CacheStorage] Give ownership of all CacheStorageCaches to CacheStorage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/cache_storage/cache_storage_cache_handle.h
diff --git a/content/browser/cache_storage/cache_storage_cache_handle.h b/content/browser/cache_storage/cache_storage_cache_handle.h
new file mode 100644
index 0000000000000000000000000000000000000000..9a043bbd0e89f906c6baae66b091e8414d31b151
--- /dev/null
+++ b/content/browser/cache_storage/cache_storage_cache_handle.h
@@ -0,0 +1,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_
« no previous file with comments | « content/browser/cache_storage/cache_storage_cache.cc ('k') | content/browser/cache_storage/cache_storage_cache_handle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698