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

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

Issue 19863003: PNaCl on-demand installs: Make a separate async IPC to check if PNaCl is installed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: take out progress IPC for now Created 7 years, 4 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/pnacl_coordinator.cc
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc
index f22cfa437c6d33f6d5eb4351b95a01a1ba9ff59d..e5649f3dd8a89a388edbce54738e31b5271374f4 100644
--- a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc
@@ -241,19 +241,13 @@ PnaclCoordinator* PnaclCoordinator::BitcodeToNative(
reinterpret_cast<const void*>(coordinator->manifest_.get()),
coordinator->off_the_record_));
- // Loading resources (e.g. llc and ld nexes) is done with PnaclResources.
- coordinator->resources_.reset(
- new PnaclResources(plugin,
- coordinator,
- coordinator->manifest_.get()));
- CHECK(coordinator->resources_ != NULL);
-
- // The first step of loading resources: read the resource info file.
- pp::CompletionCallback resource_info_read_cb =
+ // First check that PNaCl is installed.
+ pp::CompletionCallback pnacl_installed_cb =
coordinator->callback_factory_.NewCallback(
- &PnaclCoordinator::ResourceInfoWasRead);
- coordinator->resources_->ReadResourceInfo(PnaclUrls::GetResourceInfoUrl(),
- resource_info_read_cb);
+ &PnaclCoordinator::DidCheckPnaclInstalled);
+ plugin->nacl_interface()->EnsurePnaclInstalled(
+ plugin->pp_instance(),
+ pnacl_installed_cb.pp_completion_callback());
return coordinator;
}
@@ -664,6 +658,29 @@ void PnaclCoordinator::NexeReadDidOpen(int32_t pp_error) {
translate_notify_callback_.Run(pp_error);
}
+void PnaclCoordinator::DidCheckPnaclInstalled(int32_t pp_error) {
+ if (pp_error != PP_OK) {
+ ReportNonPpapiError(
+ ERROR_PNACL_RESOURCE_FETCH,
+ nacl::string("The Portable Native Client component is not installed"
+ " or has been disabled."));
+ return;
+ }
+
+ // Loading resources (e.g. llc and ld nexes) is done with PnaclResources.
+ resources_.reset(new PnaclResources(plugin_,
+ this,
+ this->manifest_.get()));
+ CHECK(resources_ != NULL);
+
+ // The first step of loading resources: read the resource info file.
+ pp::CompletionCallback resource_info_read_cb =
+ callback_factory_.NewCallback(
+ &PnaclCoordinator::ResourceInfoWasRead);
+ resources_->ReadResourceInfo(PnaclUrls::GetResourceInfoUrl(),
+ resource_info_read_cb);
+}
+
void PnaclCoordinator::ResourceInfoWasRead(int32_t pp_error) {
PLUGIN_PRINTF(("PluginCoordinator::ResourceInfoWasRead (pp_error=%"
NACL_PRId32 ")\n", pp_error));

Powered by Google App Engine
This is Rietveld 408576698