| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/nacl/renderer/ppb_nacl_private_impl.h" | 5 #include "components/nacl/renderer/ppb_nacl_private_impl.h" |
| 6 | 6 |
| 7 #include <numeric> | 7 #include <numeric> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 base::Bind(callback, base::Passed(base::File()), 0, 0)); | 260 base::Bind(callback, base::Passed(base::File()), 0, 0)); |
| 261 return; | 261 return; |
| 262 } | 262 } |
| 263 | 263 |
| 264 std::string url; | 264 std::string url; |
| 265 // TODO(teravest): Clean up pnacl_options logic in JsonManifest so we don't | 265 // TODO(teravest): Clean up pnacl_options logic in JsonManifest so we don't |
| 266 // have to initialize it like this here. | 266 // have to initialize it like this here. |
| 267 PP_PNaClOptions pnacl_options; | 267 PP_PNaClOptions pnacl_options; |
| 268 pnacl_options.translate = PP_FALSE; | 268 pnacl_options.translate = PP_FALSE; |
| 269 pnacl_options.is_debug = PP_FALSE; | 269 pnacl_options.is_debug = PP_FALSE; |
| 270 pnacl_options.use_subzero = PP_FALSE; |
| 270 pnacl_options.opt_level = 2; | 271 pnacl_options.opt_level = 2; |
| 271 bool is_helper_process = process_type_ == kPNaClTranslatorProcessType; | 272 bool is_helper_process = process_type_ == kPNaClTranslatorProcessType; |
| 272 if (!ManifestResolveKey(pp_instance_, is_helper_process, key, &url, | 273 if (!ManifestResolveKey(pp_instance_, is_helper_process, key, &url, |
| 273 &pnacl_options)) { | 274 &pnacl_options)) { |
| 274 base::MessageLoop::current()->PostTask( | 275 base::MessageLoop::current()->PostTask( |
| 275 FROM_HERE, | 276 FROM_HERE, |
| 276 base::Bind(callback, base::Passed(base::File()), 0, 0)); | 277 base::Bind(callback, base::Passed(base::File()), 0, 0)); |
| 277 return; | 278 return; |
| 278 } | 279 } |
| 279 | 280 |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 return sender->Send(new NaClHostMsg_NaClGetNumProcessors(&num_processors)) ? | 665 return sender->Send(new NaClHostMsg_NaClGetNumProcessors(&num_processors)) ? |
| 665 num_processors : 1; | 666 num_processors : 1; |
| 666 } | 667 } |
| 667 | 668 |
| 668 void GetNexeFd(PP_Instance instance, | 669 void GetNexeFd(PP_Instance instance, |
| 669 const std::string& pexe_url, | 670 const std::string& pexe_url, |
| 670 uint32_t opt_level, | 671 uint32_t opt_level, |
| 671 const base::Time& last_modified_time, | 672 const base::Time& last_modified_time, |
| 672 const std::string& etag, | 673 const std::string& etag, |
| 673 bool has_no_store_header, | 674 bool has_no_store_header, |
| 675 bool use_subzero, |
| 674 base::Callback<void(int32_t, bool, PP_FileHandle)> callback) { | 676 base::Callback<void(int32_t, bool, PP_FileHandle)> callback) { |
| 675 if (!InitializePnaclResourceHost()) { | 677 if (!InitializePnaclResourceHost()) { |
| 676 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( | 678 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( |
| 677 FROM_HERE, | 679 FROM_HERE, |
| 678 base::Bind(callback, | 680 base::Bind(callback, |
| 679 static_cast<int32_t>(PP_ERROR_FAILED), | 681 static_cast<int32_t>(PP_ERROR_FAILED), |
| 680 false, | 682 false, |
| 681 PP_kInvalidFileHandle)); | 683 PP_kInvalidFileHandle)); |
| 682 return; | 684 return; |
| 683 } | 685 } |
| 684 | 686 |
| 685 PnaclCacheInfo cache_info; | 687 PnaclCacheInfo cache_info; |
| 686 cache_info.pexe_url = GURL(pexe_url); | 688 cache_info.pexe_url = GURL(pexe_url); |
| 687 // TODO(dschuff): Get this value from the pnacl json file after it | 689 // TODO(dschuff): Get this value from the pnacl json file after it |
| 688 // rolls in from NaCl. | 690 // rolls in from NaCl. |
| 689 cache_info.abi_version = 1; | 691 cache_info.abi_version = 1; |
| 690 cache_info.opt_level = opt_level; | 692 cache_info.opt_level = opt_level; |
| 691 cache_info.last_modified = last_modified_time; | 693 cache_info.last_modified = last_modified_time; |
| 692 cache_info.etag = etag; | 694 cache_info.etag = etag; |
| 693 cache_info.has_no_store_header = has_no_store_header; | 695 cache_info.has_no_store_header = has_no_store_header; |
| 696 cache_info.use_subzero = use_subzero; |
| 694 cache_info.sandbox_isa = GetSandboxArch(); | 697 cache_info.sandbox_isa = GetSandboxArch(); |
| 695 cache_info.extra_flags = GetCpuFeatures(); | 698 cache_info.extra_flags = GetCpuFeatures(); |
| 696 | 699 |
| 697 g_pnacl_resource_host.Get()->RequestNexeFd( | 700 g_pnacl_resource_host.Get()->RequestNexeFd( |
| 698 GetRoutingID(instance), | 701 GetRoutingID(instance), |
| 699 instance, | 702 instance, |
| 700 cache_info, | 703 cache_info, |
| 701 callback); | 704 callback); |
| 702 } | 705 } |
| 703 | 706 |
| 704 void ReportTranslationFinished(PP_Instance instance, | 707 void ReportTranslationFinished(PP_Instance instance, |
| 705 PP_Bool success, | 708 PP_Bool success, |
| 706 int32_t opt_level, | 709 int32_t opt_level, |
| 710 PP_Bool use_subzero, |
| 707 int64_t pexe_size, | 711 int64_t pexe_size, |
| 708 int64_t compile_time_us) { | 712 int64_t compile_time_us) { |
| 713 // TODO(jvoung): Log use_subzero stat in UMA. |
| 714 (void)use_subzero; |
| 709 if (success == PP_TRUE) { | 715 if (success == PP_TRUE) { |
| 710 static const int32_t kUnknownOptLevel = 4; | 716 static const int32_t kUnknownOptLevel = 4; |
| 711 if (opt_level < 0 || opt_level > 3) | 717 if (opt_level < 0 || opt_level > 3) |
| 712 opt_level = kUnknownOptLevel; | 718 opt_level = kUnknownOptLevel; |
| 713 HistogramEnumerate("NaCl.Options.PNaCl.OptLevel", | 719 HistogramEnumerate("NaCl.Options.PNaCl.OptLevel", |
| 714 opt_level, | 720 opt_level, |
| 715 kUnknownOptLevel + 1); | 721 kUnknownOptLevel + 1); |
| 716 HistogramKBPerSec("NaCl.Perf.PNaClLoadTime.CompileKBPerSec", | 722 HistogramKBPerSec("NaCl.Perf.PNaClLoadTime.CompileKBPerSec", |
| 717 pexe_size / 1024, | 723 pexe_size / 1024, |
| 718 compile_time_us); | 724 compile_time_us); |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1051 if (manifest == NULL) | 1057 if (manifest == NULL) |
| 1052 return PP_FALSE; | 1058 return PP_FALSE; |
| 1053 | 1059 |
| 1054 bool uses_nonsfi_mode; | 1060 bool uses_nonsfi_mode; |
| 1055 std::string full_url; | 1061 std::string full_url; |
| 1056 JsonManifest::ErrorInfo error_info; | 1062 JsonManifest::ErrorInfo error_info; |
| 1057 if (manifest->GetProgramURL(&full_url, pnacl_options, &uses_nonsfi_mode, | 1063 if (manifest->GetProgramURL(&full_url, pnacl_options, &uses_nonsfi_mode, |
| 1058 &error_info)) { | 1064 &error_info)) { |
| 1059 *pp_full_url = ppapi::StringVar::StringToPPVar(full_url); | 1065 *pp_full_url = ppapi::StringVar::StringToPPVar(full_url); |
| 1060 *pp_uses_nonsfi_mode = PP_FromBool(uses_nonsfi_mode); | 1066 *pp_uses_nonsfi_mode = PP_FromBool(uses_nonsfi_mode); |
| 1067 // Check if we should use Subzero (x86-32 / non-debugging case for now). |
| 1068 if (pnacl_options->opt_level == 0 && !pnacl_options->is_debug && |
| 1069 strcmp(GetSandboxArch(), "x86-32") == 0 && |
| 1070 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1071 switches::kEnablePNaClSubzero)) { |
| 1072 pnacl_options->use_subzero = PP_TRUE; |
| 1073 // Subzero -O2 is closer to LLC -O0, so indicate -O2. |
| 1074 pnacl_options->opt_level = 2; |
| 1075 } |
| 1061 return PP_TRUE; | 1076 return PP_TRUE; |
| 1062 } | 1077 } |
| 1063 | 1078 |
| 1064 if (load_manager) | 1079 if (load_manager) |
| 1065 load_manager->ReportLoadError(error_info.error, error_info.string); | 1080 load_manager->ReportLoadError(error_info.error, error_info.string); |
| 1066 return PP_FALSE; | 1081 return PP_FALSE; |
| 1067 } | 1082 } |
| 1068 | 1083 |
| 1069 bool ManifestResolveKey(PP_Instance instance, | 1084 bool ManifestResolveKey(PP_Instance instance, |
| 1070 bool is_helper_process, | 1085 bool is_helper_process, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1092 | 1107 |
| 1093 JsonManifest* manifest = GetJsonManifest(instance); | 1108 JsonManifest* manifest = GetJsonManifest(instance); |
| 1094 if (manifest == NULL) | 1109 if (manifest == NULL) |
| 1095 return false; | 1110 return false; |
| 1096 | 1111 |
| 1097 return manifest->ResolveKey(key, full_url, pnacl_options); | 1112 return manifest->ResolveKey(key, full_url, pnacl_options); |
| 1098 } | 1113 } |
| 1099 | 1114 |
| 1100 PP_Bool GetPNaClResourceInfo(PP_Instance instance, | 1115 PP_Bool GetPNaClResourceInfo(PP_Instance instance, |
| 1101 PP_Var* llc_tool_name, | 1116 PP_Var* llc_tool_name, |
| 1102 PP_Var* ld_tool_name) { | 1117 PP_Var* ld_tool_name, |
| 1118 PP_Var* subzero_tool_name) { |
| 1103 static const char kFilename[] = "chrome://pnacl-translator/pnacl.json"; | 1119 static const char kFilename[] = "chrome://pnacl-translator/pnacl.json"; |
| 1104 NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 1120 NexeLoadManager* load_manager = GetNexeLoadManager(instance); |
| 1105 DCHECK(load_manager); | 1121 DCHECK(load_manager); |
| 1106 if (!load_manager) | 1122 if (!load_manager) |
| 1107 return PP_FALSE; | 1123 return PP_FALSE; |
| 1108 | 1124 |
| 1109 uint64_t nonce_lo = 0; | 1125 uint64_t nonce_lo = 0; |
| 1110 uint64_t nonce_hi = 0; | 1126 uint64_t nonce_hi = 0; |
| 1111 base::File file(GetReadonlyPnaclFd(kFilename, false /* is_executable */, | 1127 base::File file(GetReadonlyPnaclFd(kFilename, false /* is_executable */, |
| 1112 &nonce_lo, &nonce_hi)); | 1128 &nonce_lo, &nonce_hi)); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 if (!json_data.isObject()) { | 1185 if (!json_data.isObject()) { |
| 1170 load_manager->ReportLoadError( | 1186 load_manager->ReportLoadError( |
| 1171 PP_NACL_ERROR_PNACL_RESOURCE_FETCH, | 1187 PP_NACL_ERROR_PNACL_RESOURCE_FETCH, |
| 1172 "Parsing resource info failed: Malformed JSON dictionary"); | 1188 "Parsing resource info failed: Malformed JSON dictionary"); |
| 1173 return PP_FALSE; | 1189 return PP_FALSE; |
| 1174 } | 1190 } |
| 1175 | 1191 |
| 1176 if (json_data.isMember("pnacl-llc-name")) { | 1192 if (json_data.isMember("pnacl-llc-name")) { |
| 1177 Json::Value json_name = json_data["pnacl-llc-name"]; | 1193 Json::Value json_name = json_data["pnacl-llc-name"]; |
| 1178 if (json_name.isString()) { | 1194 if (json_name.isString()) { |
| 1179 std::string llc_tool_name_str = json_name.asString(); | 1195 *llc_tool_name = ppapi::StringVar::StringToPPVar(json_name.asString()); |
| 1180 *llc_tool_name = ppapi::StringVar::StringToPPVar(llc_tool_name_str); | |
| 1181 } | 1196 } |
| 1182 } | 1197 } |
| 1183 | 1198 |
| 1184 if (json_data.isMember("pnacl-ld-name")) { | 1199 if (json_data.isMember("pnacl-ld-name")) { |
| 1185 Json::Value json_name = json_data["pnacl-ld-name"]; | 1200 Json::Value json_name = json_data["pnacl-ld-name"]; |
| 1186 if (json_name.isString()) { | 1201 if (json_name.isString()) { |
| 1187 std::string ld_tool_name_str = json_name.asString(); | 1202 *ld_tool_name = ppapi::StringVar::StringToPPVar(json_name.asString()); |
| 1188 *ld_tool_name = ppapi::StringVar::StringToPPVar(ld_tool_name_str); | |
| 1189 } | 1203 } |
| 1190 } | 1204 } |
| 1205 |
| 1206 if (json_data.isMember("pnacl-sz-name")) { |
| 1207 Json::Value json_name = json_data["pnacl-sz-name"]; |
| 1208 if (json_name.isString()) { |
| 1209 *subzero_tool_name = |
| 1210 ppapi::StringVar::StringToPPVar(json_name.asString()); |
| 1211 } |
| 1212 } else { |
| 1213 // TODO(jvoung): remove fallback after one chrome release |
| 1214 // or when we bump the kMinPnaclVersion. |
| 1215 // TODO(jvoung): Just use strings instead of PP_Var! |
| 1216 *subzero_tool_name = ppapi::StringVar::StringToPPVar("pnacl-sz.nexe"); |
| 1217 } |
| 1218 |
| 1191 return PP_TRUE; | 1219 return PP_TRUE; |
| 1192 } | 1220 } |
| 1193 | 1221 |
| 1194 PP_Var GetCpuFeatureAttrs() { | 1222 PP_Var GetCpuFeatureAttrs() { |
| 1195 return ppapi::StringVar::StringToPPVar(GetCpuFeatures()); | 1223 return ppapi::StringVar::StringToPPVar(GetCpuFeatures()); |
| 1196 } | 1224 } |
| 1197 | 1225 |
| 1198 // Encapsulates some of the state for a call to DownloadNexe to prevent | 1226 // Encapsulates some of the state for a call to DownloadNexe to prevent |
| 1199 // argument lists from getting too long. | 1227 // argument lists from getting too long. |
| 1200 struct DownloadNexeRequest { | 1228 struct DownloadNexeRequest { |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1484 } | 1512 } |
| 1485 | 1513 |
| 1486 // PexeDownloader is responsible for deleting itself when the download | 1514 // PexeDownloader is responsible for deleting itself when the download |
| 1487 // finishes. | 1515 // finishes. |
| 1488 class PexeDownloader : public blink::WebURLLoaderClient { | 1516 class PexeDownloader : public blink::WebURLLoaderClient { |
| 1489 public: | 1517 public: |
| 1490 PexeDownloader(PP_Instance instance, | 1518 PexeDownloader(PP_Instance instance, |
| 1491 scoped_ptr<blink::WebURLLoader> url_loader, | 1519 scoped_ptr<blink::WebURLLoader> url_loader, |
| 1492 const std::string& pexe_url, | 1520 const std::string& pexe_url, |
| 1493 int32_t pexe_opt_level, | 1521 int32_t pexe_opt_level, |
| 1522 bool use_subzero, |
| 1494 const PPP_PexeStreamHandler* stream_handler, | 1523 const PPP_PexeStreamHandler* stream_handler, |
| 1495 void* stream_handler_user_data) | 1524 void* stream_handler_user_data) |
| 1496 : instance_(instance), | 1525 : instance_(instance), |
| 1497 url_loader_(url_loader.Pass()), | 1526 url_loader_(url_loader.Pass()), |
| 1498 pexe_url_(pexe_url), | 1527 pexe_url_(pexe_url), |
| 1499 pexe_opt_level_(pexe_opt_level), | 1528 pexe_opt_level_(pexe_opt_level), |
| 1529 use_subzero_(use_subzero), |
| 1500 stream_handler_(stream_handler), | 1530 stream_handler_(stream_handler), |
| 1501 stream_handler_user_data_(stream_handler_user_data), | 1531 stream_handler_user_data_(stream_handler_user_data), |
| 1502 success_(false), | 1532 success_(false), |
| 1503 expected_content_length_(-1), | 1533 expected_content_length_(-1), |
| 1504 weak_factory_(this) { } | 1534 weak_factory_(this) {} |
| 1505 | 1535 |
| 1506 void Load(const blink::WebURLRequest& request) { | 1536 void Load(const blink::WebURLRequest& request) { |
| 1507 url_loader_->loadAsynchronously(request, this); | 1537 url_loader_->loadAsynchronously(request, this); |
| 1508 } | 1538 } |
| 1509 | 1539 |
| 1510 private: | 1540 private: |
| 1511 virtual void didReceiveResponse(blink::WebURLLoader* loader, | 1541 virtual void didReceiveResponse(blink::WebURLLoader* loader, |
| 1512 const blink::WebURLResponse& response) { | 1542 const blink::WebURLResponse& response) { |
| 1513 success_ = (response.httpStatusCode() == 200); | 1543 success_ = (response.httpStatusCode() == 200); |
| 1514 if (!success_) | 1544 if (!success_) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1532 | 1562 |
| 1533 std::vector<std::string> values; | 1563 std::vector<std::string> values; |
| 1534 base::SplitString(cache_control, ',', &values); | 1564 base::SplitString(cache_control, ',', &values); |
| 1535 for (std::vector<std::string>::const_iterator it = values.begin(); | 1565 for (std::vector<std::string>::const_iterator it = values.begin(); |
| 1536 it != values.end(); | 1566 it != values.end(); |
| 1537 ++it) { | 1567 ++it) { |
| 1538 if (base::StringToLowerASCII(*it) == "no-store") | 1568 if (base::StringToLowerASCII(*it) == "no-store") |
| 1539 has_no_store_header = true; | 1569 has_no_store_header = true; |
| 1540 } | 1570 } |
| 1541 | 1571 |
| 1542 GetNexeFd(instance_, | 1572 GetNexeFd( |
| 1543 pexe_url_, | 1573 instance_, pexe_url_, pexe_opt_level_, last_modified_time, etag, |
| 1544 pexe_opt_level_, | 1574 has_no_store_header, use_subzero_, |
| 1545 last_modified_time, | 1575 base::Bind(&PexeDownloader::didGetNexeFd, weak_factory_.GetWeakPtr())); |
| 1546 etag, | |
| 1547 has_no_store_header, | |
| 1548 base::Bind(&PexeDownloader::didGetNexeFd, | |
| 1549 weak_factory_.GetWeakPtr())); | |
| 1550 } | 1576 } |
| 1551 | 1577 |
| 1552 virtual void didGetNexeFd(int32_t pp_error, | 1578 virtual void didGetNexeFd(int32_t pp_error, |
| 1553 bool cache_hit, | 1579 bool cache_hit, |
| 1554 PP_FileHandle file_handle) { | 1580 PP_FileHandle file_handle) { |
| 1555 if (!content::PepperPluginInstance::Get(instance_)) { | 1581 if (!content::PepperPluginInstance::Get(instance_)) { |
| 1556 delete this; | 1582 delete this; |
| 1557 return; | 1583 return; |
| 1558 } | 1584 } |
| 1559 | 1585 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1599 | 1625 |
| 1600 virtual void didFail(blink::WebURLLoader* loader, | 1626 virtual void didFail(blink::WebURLLoader* loader, |
| 1601 const blink::WebURLError& error) { | 1627 const blink::WebURLError& error) { |
| 1602 success_ = false; | 1628 success_ = false; |
| 1603 } | 1629 } |
| 1604 | 1630 |
| 1605 PP_Instance instance_; | 1631 PP_Instance instance_; |
| 1606 scoped_ptr<blink::WebURLLoader> url_loader_; | 1632 scoped_ptr<blink::WebURLLoader> url_loader_; |
| 1607 std::string pexe_url_; | 1633 std::string pexe_url_; |
| 1608 int32_t pexe_opt_level_; | 1634 int32_t pexe_opt_level_; |
| 1635 bool use_subzero_; |
| 1609 const PPP_PexeStreamHandler* stream_handler_; | 1636 const PPP_PexeStreamHandler* stream_handler_; |
| 1610 void* stream_handler_user_data_; | 1637 void* stream_handler_user_data_; |
| 1611 bool success_; | 1638 bool success_; |
| 1612 int64_t expected_content_length_; | 1639 int64_t expected_content_length_; |
| 1613 base::WeakPtrFactory<PexeDownloader> weak_factory_; | 1640 base::WeakPtrFactory<PexeDownloader> weak_factory_; |
| 1614 }; | 1641 }; |
| 1615 | 1642 |
| 1616 void StreamPexe(PP_Instance instance, | 1643 void StreamPexe(PP_Instance instance, |
| 1617 const char* pexe_url, | 1644 const char* pexe_url, |
| 1618 int32_t opt_level, | 1645 int32_t opt_level, |
| 1646 PP_Bool use_subzero, |
| 1619 const PPP_PexeStreamHandler* handler, | 1647 const PPP_PexeStreamHandler* handler, |
| 1620 void* handler_user_data) { | 1648 void* handler_user_data) { |
| 1621 content::PepperPluginInstance* plugin_instance = | 1649 content::PepperPluginInstance* plugin_instance = |
| 1622 content::PepperPluginInstance::Get(instance); | 1650 content::PepperPluginInstance::Get(instance); |
| 1623 if (!plugin_instance) { | 1651 if (!plugin_instance) { |
| 1624 base::MessageLoop::current()->PostTask( | 1652 base::MessageLoop::current()->PostTask( |
| 1625 FROM_HERE, | 1653 FROM_HERE, |
| 1626 base::Bind(handler->DidFinishStream, | 1654 base::Bind(handler->DidFinishStream, |
| 1627 handler_user_data, | 1655 handler_user_data, |
| 1628 static_cast<int32_t>(PP_ERROR_FAILED))); | 1656 static_cast<int32_t>(PP_ERROR_FAILED))); |
| 1629 return; | 1657 return; |
| 1630 } | 1658 } |
| 1631 | 1659 |
| 1632 GURL gurl(pexe_url); | 1660 GURL gurl(pexe_url); |
| 1633 const blink::WebDocument& document = | 1661 const blink::WebDocument& document = |
| 1634 plugin_instance->GetContainer()->element().document(); | 1662 plugin_instance->GetContainer()->element().document(); |
| 1635 scoped_ptr<blink::WebURLLoader> url_loader( | 1663 scoped_ptr<blink::WebURLLoader> url_loader( |
| 1636 CreateWebURLLoader(document, gurl)); | 1664 CreateWebURLLoader(document, gurl)); |
| 1637 PexeDownloader* downloader = new PexeDownloader(instance, | 1665 PexeDownloader* downloader = |
| 1638 url_loader.Pass(), | 1666 new PexeDownloader(instance, url_loader.Pass(), pexe_url, opt_level, |
| 1639 pexe_url, | 1667 PP_ToBool(use_subzero), handler, handler_user_data); |
| 1640 opt_level, | |
| 1641 handler, | |
| 1642 handler_user_data); | |
| 1643 | 1668 |
| 1644 blink::WebURLRequest url_request = CreateWebURLRequest(document, gurl); | 1669 blink::WebURLRequest url_request = CreateWebURLRequest(document, gurl); |
| 1645 // Mark the request as requesting a PNaCl bitcode file, | 1670 // Mark the request as requesting a PNaCl bitcode file, |
| 1646 // so that component updater can detect this user action. | 1671 // so that component updater can detect this user action. |
| 1647 url_request.addHTTPHeaderField( | 1672 url_request.addHTTPHeaderField( |
| 1648 blink::WebString::fromUTF8("Accept"), | 1673 blink::WebString::fromUTF8("Accept"), |
| 1649 blink::WebString::fromUTF8("application/x-pnacl, */*")); | 1674 blink::WebString::fromUTF8("application/x-pnacl, */*")); |
| 1650 url_request.setRequestContext(blink::WebURLRequest::RequestContextObject); | 1675 url_request.setRequestContext(blink::WebURLRequest::RequestContextObject); |
| 1651 downloader->Load(url_request); | 1676 downloader->Load(url_request); |
| 1652 } | 1677 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1679 &StreamPexe | 1704 &StreamPexe |
| 1680 }; | 1705 }; |
| 1681 | 1706 |
| 1682 } // namespace | 1707 } // namespace |
| 1683 | 1708 |
| 1684 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 1709 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
| 1685 return &nacl_interface; | 1710 return &nacl_interface; |
| 1686 } | 1711 } |
| 1687 | 1712 |
| 1688 } // namespace nacl | 1713 } // namespace nacl |
| OLD | NEW |