OLD | NEW |
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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 BitcodeStreamDidFinish(pp_error); | 370 BitcodeStreamDidFinish(pp_error); |
371 // We have not spun up the translation process yet, so we need to call | 371 // We have not spun up the translation process yet, so we need to call |
372 // TranslateFinished here. | 372 // TranslateFinished here. |
373 TranslateFinished(pp_error); | 373 TranslateFinished(pp_error); |
374 return; | 374 return; |
375 } | 375 } |
376 | 376 |
377 // The component updater's resource throttles + OnDemand update/install | 377 // The component updater's resource throttles + OnDemand update/install |
378 // should block the URL request until the compiler is present. Now we | 378 // should block the URL request until the compiler is present. Now we |
379 // can load the resources (e.g. llc and ld nexes). | 379 // can load the resources (e.g. llc and ld nexes). |
380 resources_.reset(new PnaclResources(plugin_, this)); | 380 resources_.reset(new PnaclResources(plugin_)); |
381 CHECK(resources_ != NULL); | 381 CHECK(resources_ != NULL); |
382 | 382 |
383 // The first step of loading resources: read the resource info file. | 383 // The first step of loading resources: read the resource info file. |
384 pp::CompletionCallback resource_info_read_cb = | 384 pp::CompletionCallback resource_info_read_cb = |
385 callback_factory_.NewCallback(&PnaclCoordinator::ResourceInfoWasRead); | 385 callback_factory_.NewCallback(&PnaclCoordinator::ResourceInfoWasRead); |
386 resources_->ReadResourceInfo(resource_info_read_cb); | 386 resources_->ReadResourceInfo(resource_info_read_cb); |
387 } | 387 } |
388 | 388 |
389 void PnaclCoordinator::ResourceInfoWasRead(int32_t pp_error) { | 389 void PnaclCoordinator::ResourceInfoWasRead(int32_t pp_error) { |
390 PLUGIN_PRINTF(("PluginCoordinator::ResourceInfoWasRead (pp_error=%" | 390 PLUGIN_PRINTF(("PluginCoordinator::ResourceInfoWasRead (pp_error=%" |
391 NACL_PRId32 ")\n", pp_error)); | 391 NACL_PRId32 ")\n", pp_error)); |
| 392 if (pp_error != PP_OK) { |
| 393 ExitWithError(); |
| 394 return; |
| 395 } |
392 // Second step of loading resources: call StartLoad to load pnacl-llc | 396 // Second step of loading resources: call StartLoad to load pnacl-llc |
393 // and pnacl-ld, based on the filenames found in the resource info file. | 397 // and pnacl-ld, based on the filenames found in the resource info file. |
394 pp::CompletionCallback resources_cb = | 398 pp::CompletionCallback resources_cb = |
395 callback_factory_.NewCallback(&PnaclCoordinator::ResourcesDidLoad); | 399 callback_factory_.NewCallback(&PnaclCoordinator::ResourcesDidLoad); |
396 resources_->StartLoad(resources_cb); | 400 resources_->StartLoad(resources_cb); |
397 } | 401 } |
398 | 402 |
399 void PnaclCoordinator::ResourcesDidLoad(int32_t pp_error) { | 403 void PnaclCoordinator::ResourcesDidLoad(int32_t pp_error) { |
400 PLUGIN_PRINTF(("PnaclCoordinator::ResourcesDidLoad (pp_error=%" | 404 PLUGIN_PRINTF(("PnaclCoordinator::ResourcesDidLoad (pp_error=%" |
401 NACL_PRId32 ")\n", pp_error)); | 405 NACL_PRId32 ")\n", pp_error)); |
402 if (pp_error != PP_OK) { | 406 if (pp_error != PP_OK) { |
403 // Finer-grained error code should have already been reported by | 407 ReportNonPpapiError( |
404 // the PnaclResources class. | 408 PP_NACL_ERROR_PNACL_RESOURCE_FETCH, |
| 409 nacl::string("The Portable Native Client (pnacl) component is not " |
| 410 "installed. Please consult chrome://components for more " |
| 411 "information.")); |
405 return; | 412 return; |
406 } | 413 } |
407 | 414 |
408 // Okay, now that we've started the HTTP request for the pexe | 415 // Okay, now that we've started the HTTP request for the pexe |
409 // and we've ensured that the PNaCl compiler + metadata is installed, | 416 // and we've ensured that the PNaCl compiler + metadata is installed, |
410 // get the cache key from the response headers and from the | 417 // get the cache key from the response headers and from the |
411 // compiler's version metadata. | 418 // compiler's version metadata. |
412 nacl::string headers = streaming_downloader_->GetResponseHeaders(); | 419 nacl::string headers = streaming_downloader_->GetResponseHeaders(); |
413 | 420 |
414 temp_nexe_file_.reset(new TempFile(plugin_)); | 421 temp_nexe_file_.reset(new TempFile(plugin_)); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 invalid_desc_wrapper_.get(), | 616 invalid_desc_wrapper_.get(), |
610 &error_info_, | 617 &error_info_, |
611 resources_.get(), | 618 resources_.get(), |
612 &pnacl_options_, | 619 &pnacl_options_, |
613 architecture_attributes_, | 620 architecture_attributes_, |
614 this, | 621 this, |
615 plugin_); | 622 plugin_); |
616 } | 623 } |
617 | 624 |
618 } // namespace plugin | 625 } // namespace plugin |
OLD | NEW |