OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifdef _MSC_VER | 5 #ifdef _MSC_VER |
6 // Do not warn about use of std::copy with raw pointers. | 6 // Do not warn about use of std::copy with raw pointers. |
7 #pragma warning(disable : 4996) | 7 #pragma warning(disable : 4996) |
8 #endif | 8 #endif |
9 | 9 |
10 #include "native_client/src/trusted/plugin/plugin.h" | 10 #include "native_client/src/trusted/plugin/plugin.h" |
(...skipping 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1600 if (!SetManifestObject(manifest_json, &error_info)) { | 1600 if (!SetManifestObject(manifest_json, &error_info)) { |
1601 ReportLoadError(error_info); | 1601 ReportLoadError(error_info); |
1602 return; | 1602 return; |
1603 } | 1603 } |
1604 | 1604 |
1605 if (SelectProgramURLFromManifest(&program_url, &error_info, &is_portable)) { | 1605 if (SelectProgramURLFromManifest(&program_url, &error_info, &is_portable)) { |
1606 set_nacl_ready_state(LOADING); | 1606 set_nacl_ready_state(LOADING); |
1607 // Inform JavaScript that we found a nexe URL to load. | 1607 // Inform JavaScript that we found a nexe URL to load. |
1608 EnqueueProgressEvent(kProgressEventProgress); | 1608 EnqueueProgressEvent(kProgressEventProgress); |
1609 if (is_portable) { | 1609 if (is_portable) { |
1610 // TODO(jvoung): Do we want to check an ENV var if pnacl is enabled first? | 1610 pp::CompletionCallback translate_callback = |
1611 nacl::string llc_url; | 1611 callback_factory_.NewCallback(&Plugin::BitcodeDidTranslate); |
1612 nacl::string ld_url; | 1612 // Will always call the callback on success or failure. |
1613 if (SelectLLCURLFromManifest(&llc_url, &error_info) && | 1613 pnacl_.BitcodeToNative(program_url, translate_callback); |
1614 SelectLDURLFromManifest(&ld_url, &error_info)) { | 1614 return; |
1615 pp::CompletionCallback translate_callback = | |
1616 callback_factory_.NewCallback(&Plugin::BitcodeDidTranslate); | |
1617 // Will always call the callback on success or failure. | |
1618 pnacl_.BitcodeToNative(program_url, | |
1619 llc_url, | |
1620 ld_url, | |
1621 translate_callback); | |
1622 return; | |
1623 } | |
1624 } else { | 1615 } else { |
1625 pp::CompletionCallback open_callback = | 1616 pp::CompletionCallback open_callback = |
1626 callback_factory_.NewRequiredCallback(&Plugin::NexeFileDidOpen); | 1617 callback_factory_.NewRequiredCallback(&Plugin::NexeFileDidOpen); |
1627 // Will always call the callback on success or failure. | 1618 // Will always call the callback on success or failure. |
1628 CHECK( | 1619 CHECK( |
1629 nexe_downloader_.Open(program_url, | 1620 nexe_downloader_.Open(program_url, |
1630 DOWNLOAD_TO_FILE, | 1621 DOWNLOAD_TO_FILE, |
1631 open_callback, | 1622 open_callback, |
1632 &UpdateDownloadProgress)); | 1623 &UpdateDownloadProgress)); |
1633 return; | 1624 return; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1708 return manifest_->GetProgramURL(result, error_info, is_portable); | 1699 return manifest_->GetProgramURL(result, error_info, is_portable); |
1709 } | 1700 } |
1710 | 1701 |
1711 // TODO(jvoung): get rid of these when we have a better hosting solution | 1702 // TODO(jvoung): get rid of these when we have a better hosting solution |
1712 // for PNaCl's nexes. | 1703 // for PNaCl's nexes. |
1713 bool Plugin::SelectLLCURLFromManifest(nacl::string* result, | 1704 bool Plugin::SelectLLCURLFromManifest(nacl::string* result, |
1714 ErrorInfo* error_info) { | 1705 ErrorInfo* error_info) { |
1715 PLUGIN_PRINTF(("Plugin::SelectLLCURLFromManifest()\n")); | 1706 PLUGIN_PRINTF(("Plugin::SelectLLCURLFromManifest()\n")); |
1716 if (result == NULL || error_info == NULL || manifest_ == NULL) | 1707 if (result == NULL || error_info == NULL || manifest_ == NULL) |
1717 return false; | 1708 return false; |
1718 return manifest_->GetLLCURL(result, error_info); | 1709 return manifest_->GetLLCURL(result, error_info); |
jvoung - send to chromium...
2011/11/11 01:11:22
Sorry, there's also manifest_->GetLLCURL and kPnac
sehr (please use chromium)
2011/11/11 15:55:32
Sorry I missed that. Thanks for catching it.
| |
1719 } | 1710 } |
1720 | 1711 |
1721 bool Plugin::SelectLDURLFromManifest(nacl::string* result, | 1712 bool Plugin::SelectLDURLFromManifest(nacl::string* result, |
1722 ErrorInfo* error_info) { | 1713 ErrorInfo* error_info) { |
1723 PLUGIN_PRINTF(("Plugin::SelectLDURLFromManifest()\n")); | 1714 PLUGIN_PRINTF(("Plugin::SelectLDURLFromManifest()\n")); |
1724 if (result == NULL || error_info == NULL || manifest_ == NULL) | 1715 if (result == NULL || error_info == NULL || manifest_ == NULL) |
1725 return false; | 1716 return false; |
1726 return manifest_->GetLDURL(result, error_info); | 1717 return manifest_->GetLDURL(result, error_info); |
1727 } | 1718 } |
1728 // end TODO(jvoung) | 1719 // end TODO(jvoung) |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2041 std::string scheme = canonicalized.AsString().substr(comps.scheme.begin, | 2032 std::string scheme = canonicalized.AsString().substr(comps.scheme.begin, |
2042 comps.scheme.len); | 2033 comps.scheme.len); |
2043 if (scheme == kChromeExtensionUriScheme) | 2034 if (scheme == kChromeExtensionUriScheme) |
2044 return SCHEME_CHROME_EXTENSION; | 2035 return SCHEME_CHROME_EXTENSION; |
2045 if (scheme == kDataUriScheme) | 2036 if (scheme == kDataUriScheme) |
2046 return SCHEME_DATA; | 2037 return SCHEME_DATA; |
2047 return SCHEME_OTHER; | 2038 return SCHEME_OTHER; |
2048 } | 2039 } |
2049 | 2040 |
2050 } // namespace plugin | 2041 } // namespace plugin |
OLD | NEW |