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

Unified Diff: mojo/shell/in_process_dynamic_service_runner.cc

Issue 397733003: mojo: kill app_thread before unloading main app library and add tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review + hack Created 6 years, 5 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/in_process_dynamic_service_runner.cc
diff --git a/mojo/shell/in_process_dynamic_service_runner.cc b/mojo/shell/in_process_dynamic_service_runner.cc
index 0d80d4096acdc13c8e526104d4604adff2405b40..31e558c3d0c8105befdf6d48f56f14380762b7e4 100644
--- a/mojo/shell/in_process_dynamic_service_runner.cc
+++ b/mojo/shell/in_process_dynamic_service_runner.cc
@@ -9,7 +9,6 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/message_loop/message_loop_proxy.h"
-#include "base/scoped_native_library.h"
#include "mojo/public/platform/native/system_thunks.h"
namespace mojo {
@@ -53,16 +52,15 @@ void InProcessDynamicServiceRunner::Run() {
do {
base::NativeLibraryLoadError error;
- base::ScopedNativeLibrary app_library(
- base::LoadNativeLibrary(app_path_, &error));
- if (!app_library.is_valid()) {
+ app_library_.Reset(base::LoadNativeLibrary(app_path_, &error));
+ if (!app_library_.is_valid()) {
LOG(ERROR) << "Failed to load app library (error: " << error.ToString()
<< ")";
break;
}
MojoSetSystemThunksFn mojo_set_system_thunks_fn =
- reinterpret_cast<MojoSetSystemThunksFn>(app_library.GetFunctionPointer(
+ reinterpret_cast<MojoSetSystemThunksFn>(app_library_.GetFunctionPointer(
"MojoSetSystemThunks"));
if (mojo_set_system_thunks_fn) {
MojoSystemThunks system_thunks = MojoMakeSystemThunks();
@@ -84,7 +82,7 @@ void InProcessDynamicServiceRunner::Run() {
typedef MojoResult (*MojoMainFunction)(MojoHandle);
MojoMainFunction main_function = reinterpret_cast<MojoMainFunction>(
- app_library.GetFunctionPointer("MojoMain"));
+ app_library_.GetFunctionPointer("MojoMain"));
if (!main_function) {
LOG(ERROR) << "Entrypoint MojoMain not found";
break;
@@ -94,6 +92,10 @@ void InProcessDynamicServiceRunner::Run() {
MojoResult result = main_function(service_handle_.release().value());
if (result < MOJO_RESULT_OK)
LOG(ERROR) << "MojoMain returned an error: " << result;
+ // TODO(tim): Remove this ugly hack.
darin (slow to review) 2014/07/19 21:18:00 nit: can you explain what this ugly hack is achiev
tim (not reviewing) 2014/07/19 21:59:42 Sorry about that. What was happening was: What's
+#if defined(COMPONENT_BUILD)
+ app_library_.Reset(base::NativeLibrary());
+#endif
} while (false);
bool success = app_completed_callback_runner_.Run();

Powered by Google App Engine
This is Rietveld 408576698