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