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

Side by Side Diff: ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc

Issue 453073002: Fix PNaCl on Demand load faliures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment for dmichael Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h" 5 #include "ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "native_client/src/include/checked_cast.h" 10 #include "native_client/src/include/checked_cast.h"
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 ReportPpapiError(PP_NACL_ERROR_PNACL_CACHE_FETCH_OTHER, 268 ReportPpapiError(PP_NACL_ERROR_PNACL_CACHE_FETCH_OTHER,
269 pp_error, 269 pp_error,
270 "Failed to open translated nexe."); 270 "Failed to open translated nexe.");
271 return; 271 return;
272 } 272 }
273 273
274 translate_notify_callback_.Run(PP_OK); 274 translate_notify_callback_.Run(PP_OK);
275 } 275 }
276 276
277 void PnaclCoordinator::OpenBitcodeStream() { 277 void PnaclCoordinator::OpenBitcodeStream() {
278 // The component updater's resource throttles + OnDemand update/install
279 // should block the URL request until the compiler is present. Now we
280 // can load the resources (e.g. llc and ld nexes).
281 resources_.reset(new PnaclResources(plugin_));
282 CHECK(resources_ != NULL);
283
284 // The first step of loading resources: read the resource info file.
285 if (!resources_->ReadResourceInfo()) {
286 ExitWithError();
287 return;
288 }
289
290 // Second step of loading resources: call StartLoad to load pnacl-llc
291 // and pnacl-ld, based on the filenames found in the resource info file.
292 if (!resources_->StartLoad()) {
293 ReportNonPpapiError(
294 PP_NACL_ERROR_PNACL_RESOURCE_FETCH,
295 nacl::string("The Portable Native Client (pnacl) component is not "
296 "installed. Please consult chrome://components for more "
297 "information."));
298 return;
299 }
300
301 // Even though we haven't started downloading, create the translation 278 // Even though we haven't started downloading, create the translation
302 // thread object immediately. This ensures that any pieces of the file 279 // thread object immediately. This ensures that any pieces of the file
303 // that get downloaded before the compilation thread is accepting 280 // that get downloaded before the compilation thread is accepting
304 // SRPCs won't get dropped. 281 // SRPCs won't get dropped.
305 translate_thread_.reset(new PnaclTranslateThread()); 282 translate_thread_.reset(new PnaclTranslateThread());
306 if (translate_thread_ == NULL) { 283 if (translate_thread_ == NULL) {
307 ReportNonPpapiError( 284 ReportNonPpapiError(
308 PP_NACL_ERROR_PNACL_THREAD_CREATE, 285 PP_NACL_ERROR_PNACL_THREAD_CREATE,
309 "PnaclCoordinator: could not allocate translation thread."); 286 "PnaclCoordinator: could not allocate translation thread.");
310 return; 287 return;
(...skipping 15 matching lines...) Expand all
326 BitcodeStreamDidFinish(PP_ERROR_FAILED); 303 BitcodeStreamDidFinish(PP_ERROR_FAILED);
327 return; 304 return;
328 } 305 }
329 temp_nexe_file_.reset(new TempFile(plugin_, handle)); 306 temp_nexe_file_.reset(new TempFile(plugin_, handle));
330 // Open it for reading as the cached nexe file. 307 // Open it for reading as the cached nexe file.
331 NexeReadDidOpen(temp_nexe_file_->Open(false)); 308 NexeReadDidOpen(temp_nexe_file_->Open(false));
332 } 309 }
333 310
334 void PnaclCoordinator::BitcodeStreamCacheMiss(int64_t expected_pexe_size, 311 void PnaclCoordinator::BitcodeStreamCacheMiss(int64_t expected_pexe_size,
335 PP_FileHandle nexe_handle) { 312 PP_FileHandle nexe_handle) {
313 // IMPORTANT: Make sure that PnaclResources::StartLoad() is only
314 // called after you receive a response to a request for a .pexe file.
315 //
316 // The component updater's resource throttles + OnDemand update/install
317 // should block the URL request until the compiler is present. Now we
318 // can load the resources (e.g. llc and ld nexes).
319 resources_.reset(new PnaclResources(plugin_));
320 CHECK(resources_ != NULL);
321
322 // The first step of loading resources: read the resource info file.
323 if (!resources_->ReadResourceInfo()) {
324 ExitWithError();
325 return;
326 }
327
328 // Second step of loading resources: call StartLoad to load pnacl-llc
329 // and pnacl-ld, based on the filenames found in the resource info file.
330 if (!resources_->StartLoad()) {
331 ReportNonPpapiError(
332 PP_NACL_ERROR_PNACL_RESOURCE_FETCH,
333 nacl::string("The Portable Native Client (pnacl) component is not "
334 "installed. Please consult chrome://components for more "
335 "information."));
336 return;
337 }
338
336 expected_pexe_size_ = expected_pexe_size; 339 expected_pexe_size_ = expected_pexe_size;
337 340
338 for (int i = 0; i < split_module_count_; i++) { 341 for (int i = 0; i < split_module_count_; i++) {
339 PP_FileHandle obj_handle = 342 PP_FileHandle obj_handle =
340 plugin_->nacl_interface()->CreateTemporaryFile(plugin_->pp_instance()); 343 plugin_->nacl_interface()->CreateTemporaryFile(plugin_->pp_instance());
341 nacl::scoped_ptr<TempFile> temp_file(new TempFile(plugin_, obj_handle)); 344 nacl::scoped_ptr<TempFile> temp_file(new TempFile(plugin_, obj_handle));
342 int32_t pp_error = temp_file->Open(true); 345 int32_t pp_error = temp_file->Open(true);
343 if (pp_error != PP_OK) { 346 if (pp_error != PP_OK) {
344 ReportPpapiError(PP_NACL_ERROR_PNACL_CREATE_TEMP, 347 ReportPpapiError(PP_NACL_ERROR_PNACL_CREATE_TEMP,
345 pp_error, 348 pp_error,
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 invalid_desc_wrapper_.get(), 455 invalid_desc_wrapper_.get(),
453 &error_info_, 456 &error_info_,
454 resources_.get(), 457 resources_.get(),
455 &pnacl_options_, 458 &pnacl_options_,
456 architecture_attributes_, 459 architecture_attributes_,
457 this, 460 this,
458 plugin_); 461 plugin_);
459 } 462 }
460 463
461 } // namespace plugin 464 } // namespace plugin
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698