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

Unified Diff: ppapi/native_client/src/trusted/plugin/plugin.cc

Issue 321053004: Add limitation that LoadNexeAndStart must be called on the main thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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: ppapi/native_client/src/trusted/plugin/plugin.cc
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc
index 8edd127f032739e4e6f7d9e31aea08a8c7e509cf..c559db30f3820fd45e4549bdcaa93107f77980d6 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.cc
+++ b/ppapi/native_client/src/trusted/plugin/plugin.cc
@@ -113,10 +113,16 @@ bool Plugin::LoadNaClModuleFromBackgroundThread(
// have to roll our own blocking logic, similar to WaitForSelLdrStart()
// above, except without timeout logic.
bool nexe_started = false;
- pp::CompletionCallback started_cb = callback_factory_.NewCallback(
+ pp::CompletionCallback nexe_started_callback = callback_factory_.NewCallback(
&Plugin::SignalNexeStarted, &nexe_started, service_runtime);
- service_runtime->LoadNexeAndStart(info, started_cb, pp::CompletionCallback());
+
+ pp::Module::Get()->core()->CallOnMainThread(
+ 0,
+ callback_factory_.NewCallback(
+ &Plugin::LoadNexeAndStart,
+ service_runtime, info, nexe_started_callback));
service_runtime->WaitForNexeStart();
+
return nexe_started;
}
@@ -185,23 +191,23 @@ void Plugin::LoadNaClModule(PP_NaClFileInfo file_info,
return;
}
+ // We don't take any action once nexe loading has completed, so pass an empty
+ // callback here for |callback|.
pp::CompletionCallback callback = callback_factory_.NewCallback(
- &Plugin::LoadNexeAndStart, file_info, service_runtime, crash_cb);
+ &Plugin::LoadNexeAndStart,
+ service_runtime, file_info, pp::CompletionCallback());
StartSelLdrOnMainThread(
static_cast<int32_t>(PP_OK), service_runtime, params, callback);
}
void Plugin::LoadNexeAndStart(int32_t pp_error,
- PP_NaClFileInfo file_info,
ServiceRuntime* service_runtime,
- const pp::CompletionCallback& crash_cb) {
+ PP_NaClFileInfo file_info,
+ const pp::CompletionCallback& callback) {
+ CHECK(pp::Module::Get()->core()->IsMainThread());
if (pp_error != PP_OK)
return;
-
- // We don't take any action once nexe loading has completed, so pass an empty
- // callback here for |loaded_cb|.
- service_runtime->LoadNexeAndStart(file_info, pp::CompletionCallback(),
- crash_cb);
+ service_runtime->LoadNexeAndStart(file_info, callback);
}
bool Plugin::LoadNaClModuleContinuationIntern() {

Powered by Google App Engine
This is Rietveld 408576698