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

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 d3a5c5984550a1804da0beea0b28a458cca5a738..c7b61a3f711b127ac9bd91cf1f983b89a4d32e7b 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.cc
+++ b/ppapi/native_client/src/trusted/plugin/plugin.cc
@@ -113,10 +113,15 @@ 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::Module::Get()->core()->CallOnMainThread(
+ 0,
+ callback_factory_.NewCallback(
+ &Plugin::LoadNexeAndStart,
+ service_runtime, info, nexe_started_callback));
service_runtime->WaitForNexeStart();
+
return nexe_started;
}
@@ -185,21 +190,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);
+ &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,
+ ServiceRuntime* service_runtime,
PP_NaClFileInfo file_info,
- ServiceRuntime* service_runtime) {
+ 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());
+ service_runtime->LoadNexeAndStart(file_info, callback);
}
bool Plugin::LoadNaClModuleContinuationIntern() {
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/plugin.h ('k') | ppapi/native_client/src/trusted/plugin/service_runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698