| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef WEBKIT_BLOB_SHAREABLE_FILE_REFERENCE_H_ | 5 #ifndef WEBKIT_BLOB_SHAREABLE_FILE_REFERENCE_H_ |
| 6 #define WEBKIT_BLOB_SHAREABLE_FILE_REFERENCE_H_ | 6 #define WEBKIT_BLOB_SHAREABLE_FILE_REFERENCE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "webkit/blob/blob_export.h" | 13 #include "webkit/storage/webkit_storage_export.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class TaskRunner; | 16 class TaskRunner; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace webkit_blob { | 19 namespace webkit_blob { |
| 20 | 20 |
| 21 // A refcounted wrapper around a FilePath that can optionally schedule | 21 // A refcounted wrapper around a FilePath that can optionally schedule |
| 22 // the file to be deleted upon final release and/or to notify a consumer | 22 // the file to be deleted upon final release and/or to notify a consumer |
| 23 // when final release occurs. This class is single-threaded and should | 23 // when final release occurs. This class is single-threaded and should |
| 24 // only be invoked on the IO thread in chrome. | 24 // only be invoked on the IO thread in chrome. |
| 25 class BLOB_EXPORT ShareableFileReference | 25 class WEBKIT_STORAGE_EXPORT ShareableFileReference |
| 26 : public base::RefCounted<ShareableFileReference> { | 26 : public base::RefCounted<ShareableFileReference> { |
| 27 public: | 27 public: |
| 28 typedef base::Callback<void(const FilePath&)> FinalReleaseCallback; | 28 typedef base::Callback<void(const FilePath&)> FinalReleaseCallback; |
| 29 | 29 |
| 30 enum FinalReleasePolicy { | 30 enum FinalReleasePolicy { |
| 31 DELETE_ON_FINAL_RELEASE, | 31 DELETE_ON_FINAL_RELEASE, |
| 32 DONT_DELETE_ON_FINAL_RELEASE, | 32 DONT_DELETE_ON_FINAL_RELEASE, |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 // Returns a ShareableFileReference for the given path, if no reference | 35 // Returns a ShareableFileReference for the given path, if no reference |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 const FinalReleasePolicy final_release_policy_; | 67 const FinalReleasePolicy final_release_policy_; |
| 68 const scoped_refptr<base::TaskRunner> file_task_runner_; | 68 const scoped_refptr<base::TaskRunner> file_task_runner_; |
| 69 std::vector<FinalReleaseCallback> final_release_callbacks_; | 69 std::vector<FinalReleaseCallback> final_release_callbacks_; |
| 70 | 70 |
| 71 DISALLOW_COPY_AND_ASSIGN(ShareableFileReference); | 71 DISALLOW_COPY_AND_ASSIGN(ShareableFileReference); |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 } // namespace webkit_blob | 74 } // namespace webkit_blob |
| 75 | 75 |
| 76 #endif // WEBKIT_BLOB_SHAREABLE_FILE_REFERENCE_H_ | 76 #endif // WEBKIT_BLOB_SHAREABLE_FILE_REFERENCE_H_ |
| OLD | NEW |