• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_ISOLATE_CONFIGURATOR_H_
6 #define FLUTTER_SHELL_PLATFORM_FUCHSIA_ISOLATE_CONFIGURATOR_H_
7 
8 #include <fuchsia/sys/cpp/fidl.h>
9 #include <fuchsia/ui/scenic/cpp/fidl.h>
10 
11 #include "flutter/fml/macros.h"
12 #include "unique_fdio_ns.h"
13 
14 namespace flutter_runner {
15 
16 // Contains all the information necessary to configure a new root isolate. This
17 // is a single use item. The lifetime of this object must extend past that of
18 // the root isolate.
19 class IsolateConfigurator final {
20  public:
21   IsolateConfigurator(
22       UniqueFDIONS fdio_ns,
23       fidl::InterfaceHandle<fuchsia::sys::Environment> environment,
24       zx::channel directory_request);
25 
26   ~IsolateConfigurator();
27 
28   // Can be used only once and only on the UI thread with the newly created
29   // isolate already current.
30   bool ConfigureCurrentIsolate();
31 
32  private:
33   bool used_ = false;
34   UniqueFDIONS fdio_ns_;
35   fidl::InterfaceHandle<fuchsia::sys::Environment> environment_;
36   zx::channel directory_request_;
37 
38   void BindFuchsia();
39 
40   void BindZircon();
41 
42   void BindDartIO();
43 
44   FML_DISALLOW_COPY_AND_ASSIGN(IsolateConfigurator);
45 };
46 
47 }  // namespace flutter_runner
48 
49 #endif  // FLUTTER_SHELL_PLATFORM_FUCHSIA_ISOLATE_CONFIGURATOR_H_
50