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

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

Issue 55463002: Remove PNaCl's RequestFirstInstall, use resource throttle instead (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove friend Created 7 years, 1 month 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
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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 } 419 }
420 ReportPpapiError(ERROR_PNACL_CACHE_FETCH_OTHER, 420 ReportPpapiError(ERROR_PNACL_CACHE_FETCH_OTHER,
421 pp_error, 421 pp_error,
422 "Failed to open translated nexe."); 422 "Failed to open translated nexe.");
423 return; 423 return;
424 } 424 }
425 425
426 translate_notify_callback_.Run(pp_error); 426 translate_notify_callback_.Run(pp_error);
427 } 427 }
428 428
429 void PnaclCoordinator::DidCheckPnaclInstalled(int32_t pp_error) {
430 if (pp_error != PP_OK) {
431 ReportNonPpapiError(
432 ERROR_PNACL_RESOURCE_FETCH,
433 nacl::string("The Portable Native Client (pnacl) component is not "
434 "installed. Please consult chrome://components for more "
435 "information."));
436 return;
437 }
438
439 // Loading resources (e.g. llc and ld nexes) is done with PnaclResources.
440 resources_.reset(new PnaclResources(plugin_,
441 this,
442 this->manifest_.get()));
443 CHECK(resources_ != NULL);
444
445 // The first step of loading resources: read the resource info file.
446 pp::CompletionCallback resource_info_read_cb =
447 callback_factory_.NewCallback(
448 &PnaclCoordinator::ResourceInfoWasRead);
449 resources_->ReadResourceInfo(PnaclUrls::GetResourceInfoUrl(),
cpu_(ooo_6.6-7.5) 2013/11/01 17:28:59 don't know where this moved to, just pointing it o
jvoung (off chromium) 2013/11/01 21:56:13 This was moved to line 527 (where it originally st
450 resource_info_read_cb);
451 }
452
453 void PnaclCoordinator::ResourceInfoWasRead(int32_t pp_error) { 429 void PnaclCoordinator::ResourceInfoWasRead(int32_t pp_error) {
454 PLUGIN_PRINTF(("PluginCoordinator::ResourceInfoWasRead (pp_error=%" 430 PLUGIN_PRINTF(("PluginCoordinator::ResourceInfoWasRead (pp_error=%"
455 NACL_PRId32 ")\n", pp_error)); 431 NACL_PRId32 ")\n", pp_error));
456 // Second step of loading resources: call StartLoad. 432 // Second step of loading resources: call StartLoad.
457 pp::CompletionCallback resources_cb = 433 pp::CompletionCallback resources_cb =
458 callback_factory_.NewCallback(&PnaclCoordinator::ResourcesDidLoad); 434 callback_factory_.NewCallback(&PnaclCoordinator::ResourcesDidLoad);
459 resources_->StartLoad(resources_cb); 435 resources_->StartLoad(resources_cb);
460 } 436 }
461 437
462 void PnaclCoordinator::ResourcesDidLoad(int32_t pp_error) { 438 void PnaclCoordinator::ResourcesDidLoad(int32_t pp_error) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 508
533 void PnaclCoordinator::BitcodeStreamDidOpen(int32_t pp_error) { 509 void PnaclCoordinator::BitcodeStreamDidOpen(int32_t pp_error) {
534 if (pp_error != PP_OK) { 510 if (pp_error != PP_OK) {
535 BitcodeStreamDidFinish(pp_error); 511 BitcodeStreamDidFinish(pp_error);
536 // We have not spun up the translation process yet, so we need to call 512 // We have not spun up the translation process yet, so we need to call
537 // TranslateFinished here. 513 // TranslateFinished here.
538 TranslateFinished(pp_error); 514 TranslateFinished(pp_error);
539 return; 515 return;
540 } 516 }
541 517
542 // Now that we've started the url request for the response headers and 518 // The component updater's resource throttles + OnDemand update/install
543 // for tickling the component updater's On-Demand API, check that the 519 // should block the URL request until the compiler is present. Now we
544 // compiler is present, or block until it is present or an error is hit. 520 // can load the resources (e.g. llc and ld nexes).
545 pp::CompletionCallback pnacl_installed_cb = 521 resources_.reset(new PnaclResources(plugin_, this, this->manifest_.get()));
546 callback_factory_.NewCallback(&PnaclCoordinator::DidCheckPnaclInstalled); 522 CHECK(resources_ != NULL);
547 plugin_->nacl_interface()->EnsurePnaclInstalled( 523
548 plugin_->pp_instance(), 524 // The first step of loading resources: read the resource info file.
549 pnacl_installed_cb.pp_completion_callback()); 525 pp::CompletionCallback resource_info_read_cb =
526 callback_factory_.NewCallback(&PnaclCoordinator::ResourceInfoWasRead);
527 resources_->ReadResourceInfo(PnaclUrls::GetResourceInfoUrl(),
528 resource_info_read_cb);
550 } 529 }
551 530
552 void PnaclCoordinator::NexeFdDidOpen(int32_t pp_error) { 531 void PnaclCoordinator::NexeFdDidOpen(int32_t pp_error) {
553 PLUGIN_PRINTF(("PnaclCoordinator::NexeFdDidOpen (pp_error=%" 532 PLUGIN_PRINTF(("PnaclCoordinator::NexeFdDidOpen (pp_error=%"
554 NACL_PRId32 ", hit=%d, handle=%d)\n", pp_error, 533 NACL_PRId32 ", hit=%d, handle=%d)\n", pp_error,
555 is_cache_hit_ == PP_TRUE, 534 is_cache_hit_ == PP_TRUE,
556 *temp_nexe_file_->existing_handle())); 535 *temp_nexe_file_->existing_handle()));
557 if (pp_error < PP_OK) { 536 if (pp_error < PP_OK) {
558 ReportPpapiError(ERROR_PNACL_CREATE_TEMP, pp_error, 537 ReportPpapiError(ERROR_PNACL_CREATE_TEMP, pp_error,
559 nacl::string("GetNexeFd failed")); 538 nacl::string("GetNexeFd failed"));
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 obj_file_.get(), 690 obj_file_.get(),
712 temp_nexe_file_.get(), 691 temp_nexe_file_.get(),
713 &error_info_, 692 &error_info_,
714 resources_.get(), 693 resources_.get(),
715 &pnacl_options_, 694 &pnacl_options_,
716 this, 695 this,
717 plugin_); 696 plugin_);
718 } 697 }
719 698
720 } // namespace plugin 699 } // namespace plugin
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698