summaryrefslogtreecommitdiffstats
path: root/mojo/runner/native_application_support.h
blob: 5fbbea065e9b843961da46f05c2ce9e2208f5c1b (plain)
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
// Copyright 2014 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.

#ifndef MOJO_RUNNER_NATIVE_APPLICATION_SUPPORT_H_
#define MOJO_RUNNER_NATIVE_APPLICATION_SUPPORT_H_

#include "base/native_library.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "mojo/shell/native_runner.h"

namespace base {
class FilePath;
}

namespace mojo {

class Application;

namespace runner {

// Loads the native Mojo application from the DSO specified by |app_path|.
// Returns the |base::NativeLibrary| for the application on success (or null on
// failure).
//
// Note: The caller may choose to eventually unload the returned DSO. If so,
// this should be done only after the thread on which |LoadNativeApplication()|
// and |RunNativeApplication()| were called has terminated, so that any
// thread-local destructors have been executed.
base::NativeLibrary LoadNativeApplication(const base::FilePath& app_path);

// Runs the native Mojo application from the DSO that was loaded using
// |LoadNativeApplication()|; this tolerates |app_library| being null. This
// should be called on the same thread as |LoadNativeApplication()|. Returns
// true if |MojoMain()| was called (even if it returns an error), and false
// otherwise.
// TODO(vtl): Maybe this should also have a |MojoResult| as an out parameter?
bool RunNativeApplication(base::NativeLibrary app_library,
                          InterfaceRequest<Application> application_request);

}  // namespace runner
}  // namespace mojo

#endif  // MOJO_RUNNER_NATIVE_APPLICATION_SUPPORT_H_