Upstream version 7.35.139.0
[platform/framework/web/crosswalk.git] / src / ppapi / native_client / src / trusted / plugin / plugin.cc
index e98c4c8..512ac7e 100644 (file)
@@ -285,7 +285,7 @@ bool Plugin::LoadNaClModuleFromBackgroundThread(
                  static_cast<void*>(service_runtime)));
 
   // Now start the SelLdr instance.  This must be created on the main thread.
-  bool service_runtime_started;
+  bool service_runtime_started = false;
   pp::CompletionCallback sel_ldr_callback =
       callback_factory_.NewCallback(&Plugin::SignalStartSelLdrDone,
                                     &service_runtime_started,
@@ -295,7 +295,11 @@ bool Plugin::LoadNaClModuleFromBackgroundThread(
                                     service_runtime, params,
                                     sel_ldr_callback);
   pp::Module::Get()->core()->CallOnMainThread(0, callback, 0);
-  service_runtime->WaitForSelLdrStart();
+  if (!service_runtime->WaitForSelLdrStart()) {
+    PLUGIN_PRINTF(("Plugin::LoadNaClModuleFromBackgroundThread "
+                   "WaitForSelLdrStart timed out!\n"));
+    return false;
+  }
   PLUGIN_PRINTF(("Plugin::LoadNaClModuleFromBackgroundThread "
                  "(service_runtime_started=%d)\n",
                  service_runtime_started));