| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 STORAGE_COMMON_BLOB_SCOPED_FILE_H_ | 5 #ifndef STORAGE_BROWSER_BLOB_SCOPED_FILE_H_ |
| 6 #define STORAGE_COMMON_BLOB_SCOPED_FILE_H_ | 6 #define STORAGE_BROWSER_BLOB_SCOPED_FILE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/move.h" | 13 #include "base/move.h" |
| 14 #include "storage/common/storage_common_export.h" | 14 #include "storage/browser/storage_browser_export.h" |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 class TaskRunner; | 17 class TaskRunner; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace storage { | 20 namespace storage { |
| 21 | 21 |
| 22 // A scoped reference for a FilePath that can optionally schedule the file | 22 // A scoped reference for a FilePath that can optionally schedule the file |
| 23 // to be deleted and/or to notify a consumer when it is going to be scoped out. | 23 // to be deleted and/or to notify a consumer when it is going to be scoped out. |
| 24 // This class supports move semantics, i.e. consumers can call Pass() to | 24 // This class supports move semantics, i.e. consumers can call Pass() to |
| 25 // pass the ownership of ScopedFile. | 25 // pass the ownership of ScopedFile. |
| 26 // | 26 // |
| 27 // TODO(kinuko): Probably this can be moved under base or somewhere more | 27 // TODO(kinuko): Probably this can be moved under base or somewhere more |
| 28 // common place. | 28 // common place. |
| 29 class STORAGE_COMMON_EXPORT ScopedFile { | 29 class STORAGE_EXPORT ScopedFile { |
| 30 // To support destructive assignment from an l-value assignment. | 30 // To support destructive assignment from an l-value assignment. |
| 31 // This provides Pass() method which creates an r-value for the current | 31 // This provides Pass() method which creates an r-value for the current |
| 32 // instance. (See base/move.h for details) | 32 // instance. (See base/move.h for details) |
| 33 MOVE_ONLY_TYPE_FOR_CPP_03(ScopedFile, RValue) | 33 MOVE_ONLY_TYPE_FOR_CPP_03(ScopedFile, RValue) |
| 34 | 34 |
| 35 public: | 35 public: |
| 36 typedef base::Callback<void(const base::FilePath&)> ScopeOutCallback; | 36 typedef base::Callback<void(const base::FilePath&)> ScopeOutCallback; |
| 37 typedef std::pair<ScopeOutCallback, scoped_refptr<base::TaskRunner> > | 37 typedef std::pair<ScopeOutCallback, scoped_refptr<base::TaskRunner> > |
| 38 ScopeOutCallbackPair; | 38 ScopeOutCallbackPair; |
| 39 typedef std::vector<ScopeOutCallbackPair> ScopeOutCallbackList; | 39 typedef std::vector<ScopeOutCallbackPair> ScopeOutCallbackList; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 void MoveFrom(ScopedFile& other); | 84 void MoveFrom(ScopedFile& other); |
| 85 | 85 |
| 86 base::FilePath path_; | 86 base::FilePath path_; |
| 87 ScopeOutPolicy scope_out_policy_; | 87 ScopeOutPolicy scope_out_policy_; |
| 88 scoped_refptr<base::TaskRunner> file_task_runner_; | 88 scoped_refptr<base::TaskRunner> file_task_runner_; |
| 89 ScopeOutCallbackList scope_out_callbacks_; | 89 ScopeOutCallbackList scope_out_callbacks_; |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 } // namespace storage | 92 } // namespace storage |
| 93 | 93 |
| 94 #endif // STORAGE_COMMON_BLOB_SCOPED_FILE_H_ | 94 #endif // STORAGE_BROWSER_BLOB_SCOPED_FILE_H_ |
| OLD | NEW |