| 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 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1455 | 1455 |
| 1456 void LogTranslateTime(const char* histogram_name, | 1456 void LogTranslateTime(const char* histogram_name, |
| 1457 int64_t time_in_us) { | 1457 int64_t time_in_us) { |
| 1458 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( | 1458 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( |
| 1459 FROM_HERE, | 1459 FROM_HERE, |
| 1460 base::Bind(&HistogramTimeTranslation, | 1460 base::Bind(&HistogramTimeTranslation, |
| 1461 std::string(histogram_name), | 1461 std::string(histogram_name), |
| 1462 time_in_us / 1000)); | 1462 time_in_us / 1000)); |
| 1463 } | 1463 } |
| 1464 | 1464 |
| 1465 void DidOpenManifestEntry(PP_NaClFileInfo* out_file_info, | |
| 1466 PP_CompletionCallback callback, | |
| 1467 int32_t pp_error, | |
| 1468 const PP_NaClFileInfo& file_info) { | |
| 1469 if (pp_error == PP_OK) | |
| 1470 *out_file_info = file_info; | |
| 1471 callback.func(callback.user_data, pp_error); | |
| 1472 } | |
| 1473 | |
| 1474 void OpenManifestEntry(PP_Instance instance, | |
| 1475 PP_Bool is_helper_process, | |
| 1476 const char* key, | |
| 1477 PP_NaClFileInfo* out_file_info, | |
| 1478 PP_CompletionCallback callback) { | |
| 1479 std::string url; | |
| 1480 PP_PNaClOptions pnacl_options; | |
| 1481 pnacl_options.translate = PP_FALSE; | |
| 1482 pnacl_options.is_debug = PP_FALSE; | |
| 1483 pnacl_options.opt_level = 2; | |
| 1484 if (!ManifestResolveKey(instance, | |
| 1485 PP_ToBool(is_helper_process), | |
| 1486 key, | |
| 1487 &url, | |
| 1488 &pnacl_options)) { | |
| 1489 PostPPCompletionCallback(callback, PP_ERROR_FAILED); | |
| 1490 } | |
| 1491 | |
| 1492 // TODO(teravest): Make a type like PP_NaClFileInfo to use for DownloadFile | |
| 1493 // that would close the file handle on destruction. | |
| 1494 DownloadFile(instance, url, | |
| 1495 base::Bind(&DidOpenManifestEntry, out_file_info, callback)); | |
| 1496 } | |
| 1497 | |
| 1498 void SetPNaClStartTime(PP_Instance instance) { | 1465 void SetPNaClStartTime(PP_Instance instance) { |
| 1499 NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 1466 NexeLoadManager* load_manager = GetNexeLoadManager(instance); |
| 1500 if (load_manager) | 1467 if (load_manager) |
| 1501 load_manager->set_pnacl_start_time(base::Time::Now()); | 1468 load_manager->set_pnacl_start_time(base::Time::Now()); |
| 1502 } | 1469 } |
| 1503 | 1470 |
| 1504 // PexeDownloader is responsible for deleting itself when the download | 1471 // PexeDownloader is responsible for deleting itself when the download |
| 1505 // finishes. | 1472 // finishes. |
| 1506 class PexeDownloader : public blink::WebURLLoaderClient { | 1473 class PexeDownloader : public blink::WebURLLoaderClient { |
| 1507 public: | 1474 public: |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1687 &RequestNaClManifest, | 1654 &RequestNaClManifest, |
| 1688 &GetManifestBaseURL, | 1655 &GetManifestBaseURL, |
| 1689 &ProcessNaClManifest, | 1656 &ProcessNaClManifest, |
| 1690 &DevInterfacesEnabled, | 1657 &DevInterfacesEnabled, |
| 1691 &ManifestGetProgramURL, | 1658 &ManifestGetProgramURL, |
| 1692 &GetPNaClResourceInfo, | 1659 &GetPNaClResourceInfo, |
| 1693 &GetCpuFeatureAttrs, | 1660 &GetCpuFeatureAttrs, |
| 1694 &DownloadNexe, | 1661 &DownloadNexe, |
| 1695 &ReportSelLdrStatus, | 1662 &ReportSelLdrStatus, |
| 1696 &LogTranslateTime, | 1663 &LogTranslateTime, |
| 1697 &OpenManifestEntry, | |
| 1698 &SetPNaClStartTime, | 1664 &SetPNaClStartTime, |
| 1699 &StreamPexe | 1665 &StreamPexe |
| 1700 }; | 1666 }; |
| 1701 | 1667 |
| 1702 } // namespace | 1668 } // namespace |
| 1703 | 1669 |
| 1704 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 1670 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
| 1705 return &nacl_interface; | 1671 return &nacl_interface; |
| 1706 } | 1672 } |
| 1707 | 1673 |
| 1708 } // namespace nacl | 1674 } // namespace nacl |
| OLD | NEW |