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 a938b77243ea1247538eb127b1f46ec092270f1c..613abd4fa2b1958340f0a2e6935fa644cb197562 100644 |
--- a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc |
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc |
@@ -90,9 +90,11 @@ class PnaclManifest : public Manifest { |
"key did not start with files/"); |
return false; |
} |
- // Append what follows files to the pnacl URL prefix. |
+ // Resolve the full URL to the file. Provide it with a platform-specific |
+ // prefix. |
nacl::string key_basename = key.substr(kFilesPrefix.length()); |
- return ResolveURL(key_basename, full_url, error_info); |
+ return ResolveURL(PnaclUrls::PrependPlatformPrefix(key_basename), |
+ full_url, error_info); |
} |
private: |
@@ -237,22 +239,19 @@ PnaclCoordinator* PnaclCoordinator::BitcodeToNative( |
reinterpret_cast<const void*>(coordinator->manifest_.get()), |
coordinator->off_the_record_)); |
- // Load llc and ld. |
- std::vector<nacl::string> resource_urls; |
- resource_urls.push_back(PnaclUrls::GetLlcUrl()); |
- resource_urls.push_back(PnaclUrls::GetLdUrl()); |
- pp::CompletionCallback resources_cb = |
- coordinator->callback_factory_.NewCallback( |
- &PnaclCoordinator::ResourcesDidLoad); |
+ // Loading resources (e.g. llc and ld nexes) is done with PnaclResources. |
coordinator->resources_.reset( |
new PnaclResources(plugin, |
coordinator, |
- coordinator->manifest_.get(), |
- resource_urls, |
- resources_cb)); |
+ coordinator->manifest_.get())); |
CHECK(coordinator->resources_ != NULL); |
- coordinator->resources_->StartLoad(); |
- // ResourcesDidLoad will be invoked when all resources have been received. |
+ |
+ // The first step of loading resources: read the resource info file. |
+ pp::CompletionCallback resource_info_read_cb = |
+ coordinator->callback_factory_.NewCallback( |
+ &PnaclCoordinator::ResourceInfoWasRead); |
+ coordinator->resources_->ReadResourceInfo(PnaclUrls::GetResourceInfoUrl(), |
+ resource_info_read_cb); |
return coordinator; |
} |
@@ -649,6 +648,15 @@ void PnaclCoordinator::NexeReadDidOpen(int32_t pp_error) { |
translate_notify_callback_.Run(pp_error); |
} |
+void PnaclCoordinator::ResourceInfoWasRead(int32_t pp_error) { |
+ PLUGIN_PRINTF(("PluginCoordinator::ResourceInfoWasRead (pp_error=%" |
+ NACL_PRId32")\n", pp_error)); |
+ // Second step of loading resources: call StartLoad. |
+ pp::CompletionCallback resources_cb = |
+ callback_factory_.NewCallback(&PnaclCoordinator::ResourcesDidLoad); |
+ resources_->StartLoad(resources_cb); |
+} |
+ |
void PnaclCoordinator::ResourcesDidLoad(int32_t pp_error) { |
PLUGIN_PRINTF(("PnaclCoordinator::ResourcesDidLoad (pp_error=%" |
NACL_PRId32")\n", pp_error)); |