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

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: Extra import 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
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..8690e308d243a21f3042943526218d417c442901 100644
--- a/mojo/shell/app_child_process.cc
+++ b/mojo/shell/app_child_process.cc
@@ -23,6 +23,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 +227,8 @@ 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);
+ base::ScopedNativeLibrary app_library(
DaveMoore 2014/10/29 22:15:13 This keeps the semantics of unloading the library.
viettrungluu 2014/10/29 23:11:43 We probably shouldn't. (I don't know if TLS destru
DaveMoore 2014/10/30 15:32:56 Done.
+ DynamicServiceRunner::LoadAndRunService(app_path, service.Pass()));
}
base::ThreadChecker thread_checker_;

Powered by Google App Engine
This is Rietveld 408576698