OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_DELETABLE_FILE_REFERENCE_H_ | 5 #ifndef WEBKIT_BLOB_DELETABLE_FILE_REFERENCE_H_ |
6 #define WEBKIT_BLOB_DELETABLE_FILE_REFERENCE_H_ | 6 #define WEBKIT_BLOB_DELETABLE_FILE_REFERENCE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "webkit/blob/blob_export.h" |
14 | 15 |
15 namespace base { | 16 namespace base { |
16 class MessageLoopProxy; | 17 class MessageLoopProxy; |
17 } | 18 } |
18 | 19 |
19 namespace webkit_blob { | 20 namespace webkit_blob { |
20 | 21 |
21 // A refcounted wrapper around a FilePath that schedules the file | 22 // A refcounted wrapper around a FilePath that schedules the file |
22 // to be deleted upon final release. | 23 // to be deleted upon final release. |
23 class DeletableFileReference : public base::RefCounted<DeletableFileReference> { | 24 class BLOB_EXPORT DeletableFileReference : |
| 25 public base::RefCounted<DeletableFileReference> { |
24 public: | 26 public: |
25 typedef base::Callback<void(const FilePath&)> DeletionCallback; | 27 typedef base::Callback<void(const FilePath&)> DeletionCallback; |
26 | 28 |
27 // Returns a DeletableFileReference for the given path, if no reference | 29 // Returns a DeletableFileReference for the given path, if no reference |
28 // for this path exists returns NULL. | 30 // for this path exists returns NULL. |
29 static scoped_refptr<DeletableFileReference> Get(const FilePath& path); | 31 static scoped_refptr<DeletableFileReference> Get(const FilePath& path); |
30 | 32 |
31 // Returns a DeletableFileReference for the given path, creating a new | 33 // Returns a DeletableFileReference for the given path, creating a new |
32 // reference if none yet exists. | 34 // reference if none yet exists. |
33 static scoped_refptr<DeletableFileReference> GetOrCreate( | 35 static scoped_refptr<DeletableFileReference> GetOrCreate( |
(...skipping 15 matching lines...) Expand all Loading... |
49 scoped_refptr<base::MessageLoopProxy> file_thread_; | 51 scoped_refptr<base::MessageLoopProxy> file_thread_; |
50 | 52 |
51 std::vector<DeletionCallback> deletion_callbacks_; | 53 std::vector<DeletionCallback> deletion_callbacks_; |
52 | 54 |
53 DISALLOW_COPY_AND_ASSIGN(DeletableFileReference); | 55 DISALLOW_COPY_AND_ASSIGN(DeletableFileReference); |
54 }; | 56 }; |
55 | 57 |
56 } // namespace webkit_blob | 58 } // namespace webkit_blob |
57 | 59 |
58 #endif // BASE_DELETABLE_FILE_REFERENCE_H_ | 60 #endif // BASE_DELETABLE_FILE_REFERENCE_H_ |
OLD | NEW |