OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MOJO_RUNNER_NATIVE_APPLICATION_SUPPORT_H_ | 5 #ifndef MOJO_RUNNER_NATIVE_APPLICATION_SUPPORT_H_ |
6 #define MOJO_RUNNER_NATIVE_APPLICATION_SUPPORT_H_ | 6 #define MOJO_RUNNER_NATIVE_APPLICATION_SUPPORT_H_ |
7 | 7 |
8 #include "base/native_library.h" | 8 #include "base/native_library.h" |
9 #include "mojo/public/cpp/bindings/interface_request.h" | 9 #include "mojo/public/cpp/bindings/interface_request.h" |
10 #include "mojo/shell/native_runner.h" | 10 #include "mojo/shell/native_runner.h" |
11 | 11 |
12 namespace base { | 12 namespace base { |
13 class FilePath; | 13 class FilePath; |
14 } | 14 } |
15 | 15 |
16 namespace mojo { | 16 namespace mojo { |
17 | 17 |
18 class Application; | 18 class Application; |
19 | 19 |
20 namespace runner { | 20 namespace runner { |
21 | 21 |
22 // Loads the native Mojo application from the DSO specified by |app_path|. | 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 | 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 | 24 // failure). |
25 // success or failure). | |
26 // | 25 // |
27 // Note: The caller may choose to eventually unload the returned DSO. If so, | 26 // 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()| | 27 // this should be done only after the thread on which |LoadNativeApplication()| |
29 // and |RunNativeApplication()| were called has terminated, so that any | 28 // and |RunNativeApplication()| were called has terminated, so that any |
30 // thread-local destructors have been executed. | 29 // thread-local destructors have been executed. |
31 base::NativeLibrary LoadNativeApplication( | 30 base::NativeLibrary LoadNativeApplication(const base::FilePath& app_path); |
32 const base::FilePath& app_path, | |
33 shell::NativeApplicationCleanup cleanup); | |
34 | 31 |
35 // Runs the native Mojo application from the DSO that was loaded using | 32 // Runs the native Mojo application from the DSO that was loaded using |
36 // |LoadNativeApplication()|; this tolerates |app_library| being null. This | 33 // |LoadNativeApplication()|; this tolerates |app_library| being null. This |
37 // should be called on the same thread as |LoadNativeApplication()|. Returns | 34 // should be called on the same thread as |LoadNativeApplication()|. Returns |
38 // true if |MojoMain()| was called (even if it returns an error), and false | 35 // true if |MojoMain()| was called (even if it returns an error), and false |
39 // otherwise. | 36 // otherwise. |
40 // TODO(vtl): Maybe this should also have a |MojoResult| as an out parameter? | 37 // TODO(vtl): Maybe this should also have a |MojoResult| as an out parameter? |
41 bool RunNativeApplication(base::NativeLibrary app_library, | 38 bool RunNativeApplication(base::NativeLibrary app_library, |
42 InterfaceRequest<Application> application_request); | 39 InterfaceRequest<Application> application_request); |
43 | 40 |
44 } // namespace runner | 41 } // namespace runner |
45 } // namespace mojo | 42 } // namespace mojo |
46 | 43 |
47 #endif // MOJO_RUNNER_NATIVE_APPLICATION_SUPPORT_H_ | 44 #endif // MOJO_RUNNER_NATIVE_APPLICATION_SUPPORT_H_ |
OLD | NEW |