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

Unified Diff: storage/common/blob/shareable_file_reference.h

Issue 810403004: [Storage] Blob Storage Refactoring pt 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed copyright Created 5 years, 11 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: storage/common/blob/shareable_file_reference.h
diff --git a/storage/common/blob/shareable_file_reference.h b/storage/common/blob/shareable_file_reference.h
deleted file mode 100644
index bd9d050374925b8ee9339de1316a3174e898c7ad..0000000000000000000000000000000000000000
--- a/storage/common/blob/shareable_file_reference.h
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright (c) 2012 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 STORAGE_COMMON_BLOB_SHAREABLE_FILE_REFERENCE_H_
-#define STORAGE_COMMON_BLOB_SHAREABLE_FILE_REFERENCE_H_
-
-#include <vector>
-
-#include "storage/common/blob/scoped_file.h"
-
-namespace storage {
-
-// ShareableFileReference allows consumers to share FileReference for the
-// same path if it already exists in its internal map.
-// This class is non-thread-safe and all methods must be called on a single
-// thread.
-class STORAGE_COMMON_EXPORT ShareableFileReference
- : public base::RefCounted<ShareableFileReference> {
- public:
- typedef ScopedFile::ScopeOutCallback FinalReleaseCallback;
-
- enum FinalReleasePolicy {
- DELETE_ON_FINAL_RELEASE = ScopedFile::DELETE_ON_SCOPE_OUT,
- DONT_DELETE_ON_FINAL_RELEASE = ScopedFile::DONT_DELETE_ON_SCOPE_OUT,
- };
-
- // Returns a ShareableFileReference for the given path, if no reference
- // for this path exists returns NULL.
- static scoped_refptr<ShareableFileReference> Get(const base::FilePath& path);
-
- // Returns a ShareableFileReference for the given path, creating a new
- // reference if none yet exists. If there's a pre-existing reference for
- // the path, the policy parameter of this method is ignored.
- static scoped_refptr<ShareableFileReference> GetOrCreate(
- const base::FilePath& path,
- FinalReleasePolicy policy,
- base::TaskRunner* file_task_runner);
-
- // Returns a ShareableFileReference for the given path of the |scoped_file|,
- // creating a new reference if none yet exists. The ownership of |scoped_file|
- // is passed to this reference.
- // If there's a pre-existing reference for the path, the scope out policy
- // and scope-out-callbacks of the given |scoped_file| is ignored.
- // If the given scoped_file has an empty path (e.g. maybe already
- // released) this returns NULL reference.
- //
- // TODO(kinuko): Make sure if this behavior is ok, we could alternatively
- // merge callbacks to the existing one.
- static scoped_refptr<ShareableFileReference> GetOrCreate(
- ScopedFile scoped_file);
-
- // The full file path.
- const base::FilePath& path() const { return scoped_file_.path(); }
-
- // The |callback| is fired when the final reference of this instance
- // is released. If release policy is DELETE_ON_FINAL_RELEASE the
- // callback task(s) is/are posted before the deletion is scheduled.
- void AddFinalReleaseCallback(const FinalReleaseCallback& callback);
-
- private:
- friend class base::RefCounted<ShareableFileReference>;
-
- ShareableFileReference(ScopedFile scoped_file);
- ~ShareableFileReference();
-
- ScopedFile scoped_file_;
-
- DISALLOW_COPY_AND_ASSIGN(ShareableFileReference);
-};
-
-} // namespace storage
-
-#endif // STORAGE_COMMON_BLOB_SHAREABLE_FILE_REFERENCE_H_

Powered by Google App Engine
This is Rietveld 408576698