summaryrefslogtreecommitdiff
path: root/chromium/components/filesystem/shared_temp_dir.h
blob: d403f73e5f68dcac363736804d84d1dc86bd31c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright 2016 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 COMPONENTS_FILESYSTEM_SHARED_TEMP_DIR_H_
#define COMPONENTS_FILESYSTEM_SHARED_TEMP_DIR_H_

#include "base/memory/ref_counted.h"

namespace base {
class ScopedTempDir;
}

namespace filesystem {

// A class to allow multiple mojom::Directory objects to hold a reference to a
// temporary directory.
class SharedTempDir : public base::RefCounted<SharedTempDir> {
 public:
  SharedTempDir(std::unique_ptr<base::ScopedTempDir> temp_dir);

 private:
  friend class base::RefCounted<SharedTempDir>;
  ~SharedTempDir();

  std::unique_ptr<base::ScopedTempDir> temp_dir_;

  DISALLOW_COPY_AND_ASSIGN(SharedTempDir);
};

}  // namespace filesystem

#endif  // COMPONENTS_FILESYSTEM_SHARED_TEMP_DIR_H_