blob: 95b74e4e6c1cbb75c04c773ad7d8e3459b4205a5 [file] [log] [blame]
// 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;
};
// 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();
// Waits for a return code from the component.
//
// This call will return just before the component terminates and the
// interface is closed. If the interface closes without this call returning
// the caller may assume that the component terminated unexpectedly.
3: Wait() -> (int64 return_code);
// 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);
};