huangcm
2025-08-30 0269911b91ed7e03c24005924cc6423abf245fb8
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// 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.
 
library fuchsia.sys;
 
enum TerminationReason {
  // The channel closed without giving a termination reason.
  UNKNOWN = 0;
  // Component ran and exited with a given return_code.
  EXITED = 1;
  // The given URL given to launch was invalid.
  URL_INVALID = 2;
  // The requested package could not be found.
  PACKAGE_NOT_FOUND = 3;
  // An internal error happened during the launch process.
  INTERNAL_ERROR = 4;
  // Process creation failed.
  PROCESS_CREATION_ERROR = 5;
  // A Runner failed to start.
  RUNNER_FAILED = 6;
  // A Runner terminated while attempting to run a component.
  RUNNER_TERMINATED = 7;
  // Attempted to use an unsupported feature.
  UNSUPPORTED = 8;
};
 
// An interface for controlling components.
//
// Closing this interface implicitly kills the controlled component unless
// the |Detach| method has been called.
//
// If the component exits, this interface will be closed.
//
// Typically obtained via |Launcher.CreateComponent|.
interface ComponentController {
  // Terminates the component.
  //
  // This ComponentController connection is closed when the component has
  // terminated.
  1: Kill();
 
  // Decouples the lifetime of the component from this controller.
  //
  // After calling |Detach|, the component will not be implicitly killed when
  // this interface is closed.
  2: Detach();
 
  // DEPRECATED: Use OnTerminated instead of Wait().
  // 3: Wait()
 
  // Event that is triggered when the component is terminated.
  //
  // This event provides the return code of the process and reason for
  // its termination. The return_code is only valid if the termination
  // reason is EXITED. If the termination reason is not EXITED, the
  // return code is guaranteed not to be 0.
  4: -> OnTerminated(int64 return_code, TerminationReason termination_reason);
 
  // Event that is triggered when the component's output directory is mounted.
  //
  // This event will not be triggered for every component, only those that
  // serve a directory over their PA_DIRECTORY_REQUEST handle.
  5: -> OnDirectoryReady();
};