| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_FILESYSTEM_SHARED_TEMP_DIR_H_ | 5 #ifndef COMPONENTS_FILESYSTEM_SHARED_TEMP_DIR_H_ |
| 6 #define COMPONENTS_FILESYSTEM_SHARED_TEMP_DIR_H_ | 6 #define COMPONENTS_FILESYSTEM_SHARED_TEMP_DIR_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 | 9 |
| 10 namespace base { | 10 namespace base { |
| 11 class ScopedTempDir; | 11 class ScopedTempDir; |
| 12 } | 12 } |
| 13 | 13 |
| 14 namespace filesystem { | 14 namespace filesystem { |
| 15 | 15 |
| 16 // A class to allow multiple Directory objects to hold a reference to a | 16 // A class to allow multiple mojom::Directory objects to hold a reference to a |
| 17 // temporary directory. | 17 // temporary directory. |
| 18 class SharedTempDir : public base::RefCounted<SharedTempDir> { | 18 class SharedTempDir : public base::RefCounted<SharedTempDir> { |
| 19 public: | 19 public: |
| 20 SharedTempDir(std::unique_ptr<base::ScopedTempDir> temp_dir); | 20 SharedTempDir(std::unique_ptr<base::ScopedTempDir> temp_dir); |
| 21 | 21 |
| 22 private: | 22 private: |
| 23 friend class base::RefCounted<SharedTempDir>; | 23 friend class base::RefCounted<SharedTempDir>; |
| 24 ~SharedTempDir(); | 24 ~SharedTempDir(); |
| 25 | 25 |
| 26 std::unique_ptr<base::ScopedTempDir> temp_dir_; | 26 std::unique_ptr<base::ScopedTempDir> temp_dir_; |
| 27 | 27 |
| 28 DISALLOW_COPY_AND_ASSIGN(SharedTempDir); | 28 DISALLOW_COPY_AND_ASSIGN(SharedTempDir); |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 } // namespace filesystem | 31 } // namespace filesystem |
| 32 | 32 |
| 33 #endif // COMPONENTS_FILESYSTEM_SHARED_TEMP_DIR_H_ | 33 #endif // COMPONENTS_FILESYSTEM_SHARED_TEMP_DIR_H_ |
| OLD | NEW |