summaryrefslogtreecommitdiffstats
path: root/ppapi/native_client
diff options
context:
space:
mode:
authorteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-07 00:15:34 +0000
committerteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-07 00:15:34 +0000
commit1158ce6d2a309411e37ad2236c07d529cc299b1d (patch)
tree1aceacaac3320a559fcb5c5d9fd42828401d2a89 /ppapi/native_client
parent8463895c98b69b40dc37bc0fdec2228cba88ab3f (diff)
downloadchromium_src-1158ce6d2a309411e37ad2236c07d529cc299b1d.zip
chromium_src-1158ce6d2a309411e37ad2236c07d529cc299b1d.tar.gz
chromium_src-1158ce6d2a309411e37ad2236c07d529cc299b1d.tar.bz2
Pepper: Fix caching for translated nexes.
A refactor of FileDownloader (r284961) broke the caching behavior for nexes that were translated from pexes; the cache would always end up with entries of length 0, breaking future loads of the pexe. This is the translated nexe was written to the wrong file handle, preventing caching of the result. This change causes the translated nexe to be written to the correct file handle, fixing the caching behavior. I manually tested this change on the "game of life" demo at https://gonativeclient.appspot.com/demo/life, verifying that a cached translated nexe for the pexe was successfully loaded. BUG=401121 Review URL: https://codereview.chromium.org/447013002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287912 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/native_client')
-rw-r--r--ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc11
-rw-r--r--ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h3
2 files changed, 8 insertions, 6 deletions
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc
index c8d56c3..5781530 100644
--- a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc
@@ -63,9 +63,11 @@ void DidCacheHit(void* user_data, PP_FileHandle nexe_file_handle) {
coordinator->BitcodeStreamCacheHit(nexe_file_handle);
}
-void DidCacheMiss(void* user_data, int64_t expected_pexe_size) {
+void DidCacheMiss(void* user_data, int64_t expected_pexe_size,
+ PP_FileHandle temp_nexe_file) {
PnaclCoordinator* coordinator = static_cast<PnaclCoordinator*>(user_data);
- coordinator->BitcodeStreamCacheMiss(expected_pexe_size);
+ coordinator->BitcodeStreamCacheMiss(expected_pexe_size,
+ temp_nexe_file);
}
void DidStreamData(void* user_data, const void* stream_data, int32_t length) {
@@ -329,7 +331,8 @@ void PnaclCoordinator::BitcodeStreamCacheHit(PP_FileHandle handle) {
NexeReadDidOpen(temp_nexe_file_->Open(false));
}
-void PnaclCoordinator::BitcodeStreamCacheMiss(int64_t expected_pexe_size) {
+void PnaclCoordinator::BitcodeStreamCacheMiss(int64_t expected_pexe_size,
+ PP_FileHandle nexe_handle) {
expected_pexe_size_ = expected_pexe_size;
for (int i = 0; i < split_module_count_; i++) {
@@ -348,8 +351,6 @@ void PnaclCoordinator::BitcodeStreamCacheMiss(int64_t expected_pexe_size) {
}
invalid_desc_wrapper_.reset(plugin_->wrapper_factory()->MakeInvalid());
- PP_FileHandle nexe_handle =
- plugin_->nacl_interface()->CreateTemporaryFile(plugin_->pp_instance());
temp_nexe_file_.reset(new TempFile(plugin_, nexe_handle));
// Open the nexe file for connecting ld and sel_ldr.
// Start translation when done with this last step of setup!
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h
index ac1a330..e802c8f 100644
--- a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h
@@ -88,7 +88,8 @@ class PnaclCoordinator {
void BitcodeStreamCacheHit(PP_FileHandle handle);
- void BitcodeStreamCacheMiss(int64_t expected_pexe_size);
+ void BitcodeStreamCacheMiss(int64_t expected_pexe_size,
+ PP_FileHandle handle);
// Invoked when a pexe data chunk arrives (when using streaming translation)
void BitcodeStreamGotData(const void* data, int32_t length);