Flutter Engine
tempfs.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_SHELL_PLATFORM_FUCHSIA_RUNTIME_DART_UTILS_TEMPFS_H_
6 #define FLUTTER_SHELL_PLATFORM_FUCHSIA_RUNTIME_DART_UTILS_TEMPFS_H_
7 
8 #include <mutex>
9 
10 #include <lib/async-loop/cpp/loop.h>
11 #include <lib/fdio/namespace.h>
12 
13 namespace dart_utils {
14 
15 // Sets up /tmp for the dart_runner and flutter_runner.
16 class RunnerTemp {
17  public:
18  // Sets up a memfs bound to /tmp in the process-wide namespace that has the
19  // lifetime of this instance.
20  RunnerTemp();
21  ~RunnerTemp();
22 
23  // Take the memfs mapped into the process-wide namespace for /tmp, and map it
24  // to /tmp in the given namespace.
25  static void SetupComponent(fdio_ns_t* ns);
26 
27  private:
28  void Start();
29 
30  std::unique_ptr<async::Loop> loop_;
31 
32  // Disallow copy and assignment.
33  RunnerTemp(const RunnerTemp&) = delete;
34  RunnerTemp& operator=(const RunnerTemp&) = delete;
35 };
36 
37 } // namespace dart_utils
38 
39 #endif // FLUTTER_SHELL_PLATFORM_FUCHSIA_RUNTIME_DART_UTILS_TEMPFS_H_
static void SetupComponent(fdio_ns_t *ns)
Definition: tempfs.cc:63