Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Unified Diff: mojo/shell/app_child_process.cc

Issue 691653002: Factor out loading & running of DSOs (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Review nits Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/shell/BUILD.gn ('k') | mojo/shell/dynamic_service_runner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/app_child_process.cc
diff --git a/mojo/shell/app_child_process.cc b/mojo/shell/app_child_process.cc
index 79aaa49e8040492381a2e53cb49db160f6af3751..ed254257bf5bb49f5e65e5e8cd689edecdafb20d 100644
--- a/mojo/shell/app_child_process.cc
+++ b/mojo/shell/app_child_process.cc
@@ -13,7 +13,6 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
-#include "base/scoped_native_library.h"
#include "base/single_thread_task_runner.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/thread.h"
@@ -23,6 +22,7 @@
#include "mojo/edk/embedder/simple_platform_support.h"
#include "mojo/public/cpp/system/core.h"
#include "mojo/shell/app_child_process.mojom.h"
+#include "mojo/shell/dynamic_service_runner.h"
namespace mojo {
namespace shell {
@@ -226,30 +226,9 @@ class AppChildControllerImpl : public InterfaceImpl<AppChildController> {
DVLOG(2) << "Loading/running Mojo app from " << app_path.value()
<< " out of process";
- do {
- base::NativeLibraryLoadError load_error;
- base::ScopedNativeLibrary app_library(
- base::LoadNativeLibrary(app_path, &load_error));
- if (!app_library.is_valid()) {
- LOG(ERROR) << "Failed to load library (error: " << load_error.ToString()
- << ")";
- break;
- }
-
- typedef MojoResult (*MojoMainFunction)(MojoHandle);
- MojoMainFunction main_function = reinterpret_cast<MojoMainFunction>(
- app_library.GetFunctionPointer("MojoMain"));
- if (!main_function) {
- LOG(ERROR) << "Entrypoint MojoMain not found";
- break;
- }
-
- // TODO(vtl): Report the result back to our parent process.
- // |MojoMain()| takes ownership of the service handle.
- MojoResult result = main_function(service.release().value());
- if (result < MOJO_RESULT_OK)
- LOG(ERROR) << "MojoMain returned an error: " << result;
- } while (false);
+ // We intentionally don't unload the native library as its lifetime is the
+ // same as that of the process.
+ DynamicServiceRunner::LoadAndRunService(app_path, service.Pass());
}
base::ThreadChecker thread_checker_;
« no previous file with comments | « mojo/shell/BUILD.gn ('k') | mojo/shell/dynamic_service_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698