| Index: mojo/runner/child_process.cc
|
| diff --git a/mojo/runner/child_process.cc b/mojo/runner/child_process.cc
|
| index f5adb3030db70160cd4c0831752d760129085111..948256a6fd20b243f1ded0647789e89ea7aba5bb 100644
|
| --- a/mojo/runner/child_process.cc
|
| +++ b/mojo/runner/child_process.cc
|
| @@ -182,6 +182,7 @@ class ChildControllerImpl : public ChildController {
|
| // To be executed on the controller thread. Creates the |ChildController|,
|
| // etc.
|
| static void Init(AppContext* app_context,
|
| + base::NativeLibrary app_library,
|
| embedder::ScopedPlatformHandle platform_channel,
|
| const Blocker::Unblocker& unblocker) {
|
| DCHECK(app_context);
|
| @@ -190,7 +191,7 @@ class ChildControllerImpl : public ChildController {
|
| DCHECK(!app_context->controller());
|
|
|
| scoped_ptr<ChildControllerImpl> impl(
|
| - new ChildControllerImpl(app_context, unblocker));
|
| + new ChildControllerImpl(app_context, app_library, unblocker));
|
|
|
| ScopedMessagePipeHandle host_message_pipe(embedder::CreateChannel(
|
| platform_channel.Pass(),
|
| @@ -213,20 +214,14 @@ class ChildControllerImpl : public ChildController {
|
| }
|
|
|
| // |ChildController| methods:
|
| - void StartApp(const String& app_path,
|
| - bool clean_app_path,
|
| - InterfaceRequest<Application> application_request,
|
| + void StartApp(InterfaceRequest<Application> application_request,
|
| const StartAppCallback& on_app_complete) override {
|
| - DVLOG(2) << "ChildControllerImpl::StartApp(" << app_path << ", ...)";
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
| on_app_complete_ = on_app_complete;
|
| - unblocker_.Unblock(base::Bind(
|
| - &ChildControllerImpl::StartAppOnMainThread,
|
| - base::FilePath::FromUTF8Unsafe(app_path),
|
| - clean_app_path ? shell::NativeApplicationCleanup::DELETE
|
| - : shell::NativeApplicationCleanup::DONT_DELETE,
|
| - base::Passed(&application_request)));
|
| + unblocker_.Unblock(base::Bind(&ChildControllerImpl::StartAppOnMainThread,
|
| + base::Unretained(app_library_),
|
| + base::Passed(&application_request)));
|
| }
|
|
|
| void ExitNow(int32_t exit_code) override {
|
| @@ -236,8 +231,10 @@ class ChildControllerImpl : public ChildController {
|
|
|
| private:
|
| ChildControllerImpl(AppContext* app_context,
|
| + base::NativeLibrary app_library,
|
| const Blocker::Unblocker& unblocker)
|
| : app_context_(app_context),
|
| + app_library_(app_library),
|
| unblocker_(unblocker),
|
| channel_info_(nullptr),
|
| binding_(this) {
|
| @@ -252,21 +249,16 @@ class ChildControllerImpl : public ChildController {
|
| }
|
|
|
| static void StartAppOnMainThread(
|
| - const base::FilePath& app_path,
|
| - shell::NativeApplicationCleanup cleanup,
|
| + base::NativeLibrary app_library,
|
| InterfaceRequest<Application> application_request) {
|
| - // TODO(vtl): This is copied from in_process_native_runner.cc.
|
| - DVLOG(2) << "Loading/running Mojo app from " << app_path.value()
|
| - << " out of process";
|
| -
|
| - // We intentionally don't unload the native library as its lifetime is the
|
| - // same as that of the process.
|
| - base::NativeLibrary app_library = LoadNativeApplication(app_path, cleanup);
|
| - RunNativeApplication(app_library, application_request.Pass());
|
| + if (!RunNativeApplication(app_library, application_request.Pass())) {
|
| + LOG(ERROR) << "Failure to RunNativeApplication()";
|
| + }
|
| }
|
|
|
| base::ThreadChecker thread_checker_;
|
| AppContext* const app_context_;
|
| + base::NativeLibrary app_library_;
|
| Blocker::Unblocker unblocker_;
|
| StartAppCallback on_app_complete_;
|
|
|
| @@ -278,7 +270,7 @@ class ChildControllerImpl : public ChildController {
|
|
|
| } // namespace
|
|
|
| -int ChildProcessMain() {
|
| +int ChildProcessMain(base::NativeLibrary app_library) {
|
| DVLOG(2) << "ChildProcessMain()";
|
| const base::CommandLine& command_line =
|
| *base::CommandLine::ForCurrentProcess();
|
| @@ -296,7 +288,8 @@ int ChildProcessMain() {
|
| app_context.controller_runner()->PostTask(
|
| FROM_HERE,
|
| base::Bind(&ChildControllerImpl::Init, base::Unretained(&app_context),
|
| - base::Passed(&platform_channel), blocker.GetUnblocker()));
|
| + base::Unretained(app_library), base::Passed(&platform_channel),
|
| + blocker.GetUnblocker()));
|
| // This will block, then run whatever the controller wants.
|
| blocker.Block();
|
|
|
|
|