1 // Copyright 2014 The Chromium 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.
5 #ifndef MOJO_RUNNER_NATIVE_APPLICATION_SUPPORT_H_
6 #define MOJO_RUNNER_NATIVE_APPLICATION_SUPPORT_H_
8 #include "base/native_library.h"
9 #include "mojo/public/cpp/bindings/interface_request.h"
10 #include "mojo/shell/native_runner.h"
22 // Loads the native Mojo application from the DSO specified by |app_path|.
23 // Returns the |base::NativeLibrary| for the application on success (or null on
24 // failure). If |cleanup| is |DELETE|, it will delete |app_path| (regardless of
25 // sucess or failure).
27 // Note: The caller may choose to eventually unload the returned DSO. If so,
28 // this should be done only after the thread on which |LoadNativeApplication()|
29 // and |RunNativeApplication()| were called has terminated, so that any
30 // thread-local destructors have been executed.
31 base::NativeLibrary
LoadNativeApplication(
32 const base::FilePath
& app_path
,
33 shell::NativeApplicationCleanup cleanup
);
35 // Runs the native Mojo application from the DSO that was loaded using
36 // |LoadNativeApplication()|; this tolerates |app_library| being null. This
37 // should be called on the same thread as |LoadNativeApplication()|. Returns
38 // true if |MojoMain()| was called (even if it returns an error), and false
40 // TODO(vtl): Maybe this should also have a |MojoResult| as an out parameter?
41 bool RunNativeApplication(base::NativeLibrary app_library
,
42 InterfaceRequest
<Application
> application_request
);
47 #endif // MOJO_RUNNER_NATIVE_APPLICATION_SUPPORT_H_