Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(439)

Side by Side Diff: components/nacl/renderer/ppb_nacl_private_impl.cc

Issue 356923002: Pepper: Move Pnacl init time out of trusted plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « components/nacl/renderer/nexe_load_manager.h ('k') | ppapi/api/private/ppb_nacl_private.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 handle, 652 handle,
653 enter.callback()); 653 enter.callback());
654 654
655 return enter.SetResult(PP_OK_COMPLETIONPENDING); 655 return enter.SetResult(PP_OK_COMPLETIONPENDING);
656 } 656 }
657 657
658 void ReportTranslationFinished(PP_Instance instance, 658 void ReportTranslationFinished(PP_Instance instance,
659 PP_Bool success, 659 PP_Bool success,
660 int32_t opt_level, 660 int32_t opt_level,
661 int64_t pexe_size, 661 int64_t pexe_size,
662 int64_t compile_time_us, 662 int64_t compile_time_us) {
663 int64_t total_time_us) {
664 if (success == PP_TRUE) { 663 if (success == PP_TRUE) {
665 static const int32_t kUnknownOptLevel = 4; 664 static const int32_t kUnknownOptLevel = 4;
666 if (opt_level < 0 || opt_level > 3) 665 if (opt_level < 0 || opt_level > 3)
667 opt_level = kUnknownOptLevel; 666 opt_level = kUnknownOptLevel;
668 HistogramEnumerate("NaCl.Options.PNaCl.OptLevel", 667 HistogramEnumerate("NaCl.Options.PNaCl.OptLevel",
669 opt_level, 668 opt_level,
670 kUnknownOptLevel + 1); 669 kUnknownOptLevel + 1);
671 HistogramKBPerSec("NaCl.Perf.PNaClLoadTime.CompileKBPerSec", 670 HistogramKBPerSec("NaCl.Perf.PNaClLoadTime.CompileKBPerSec",
672 pexe_size / 1024, 671 pexe_size / 1024,
673 compile_time_us); 672 compile_time_us);
674 HistogramSizeKB("NaCl.Perf.Size.Pexe", pexe_size / 1024); 673 HistogramSizeKB("NaCl.Perf.Size.Pexe", pexe_size / 1024);
675 674
676 HistogramTimeTranslation("NaCl.Perf.PNaClLoadTime.TotalUncachedTime", 675 NexeLoadManager* load_manager = GetNexeLoadManager(instance);
677 total_time_us / 1000); 676 if (load_manager) {
678 HistogramKBPerSec("NaCl.Perf.PNaClLoadTime.TotalUncachedKBPerSec", 677 base::TimeDelta total_time = base::Time::Now() -
679 pexe_size / 1024, 678 load_manager->pnacl_start_time();
680 total_time_us); 679 HistogramTimeTranslation("NaCl.Perf.PNaClLoadTime.TotalUncachedTime",
680 total_time.InMilliseconds());
681 HistogramKBPerSec("NaCl.Perf.PNaClLoadTime.TotalUncachedKBPerSec",
682 pexe_size / 1024,
683 total_time.InMicroseconds());
684 }
681 } 685 }
682 686
683 // If the resource host isn't initialized, don't try to do that here. 687 // If the resource host isn't initialized, don't try to do that here.
684 // Just return because something is already very wrong. 688 // Just return because something is already very wrong.
685 if (g_pnacl_resource_host.Get() == NULL) 689 if (g_pnacl_resource_host.Get() == NULL)
686 return; 690 return;
687 g_pnacl_resource_host.Get()->ReportTranslationFinished(instance, success); 691 g_pnacl_resource_host.Get()->ReportTranslationFinished(instance, success);
688 } 692 }
689 693
690 PP_FileHandle OpenNaClExecutable(PP_Instance instance, 694 PP_FileHandle OpenNaClExecutable(PP_Instance instance,
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 &pnacl_options)) { 1582 &pnacl_options)) {
1579 PostPPCompletionCallback(callback, PP_ERROR_FAILED); 1583 PostPPCompletionCallback(callback, PP_ERROR_FAILED);
1580 } 1584 }
1581 1585
1582 // TODO(teravest): Make a type like PP_NaClFileInfo to use for DownloadFile 1586 // TODO(teravest): Make a type like PP_NaClFileInfo to use for DownloadFile
1583 // that would close the file handle on destruction. 1587 // that would close the file handle on destruction.
1584 DownloadFile(instance, url, 1588 DownloadFile(instance, url,
1585 base::Bind(&DidOpenManifestEntry, out_file_info, callback)); 1589 base::Bind(&DidOpenManifestEntry, out_file_info, callback));
1586 } 1590 }
1587 1591
1592 void SetPNaClStartTime(PP_Instance instance) {
1593 NexeLoadManager* load_manager = GetNexeLoadManager(instance);
1594 if (load_manager)
1595 load_manager->set_pnacl_start_time(base::Time::Now());
1596 }
1597
1588 const PPB_NaCl_Private nacl_interface = { 1598 const PPB_NaCl_Private nacl_interface = {
1589 &LaunchSelLdr, 1599 &LaunchSelLdr,
1590 &StartPpapiProxy, 1600 &StartPpapiProxy,
1591 &UrandomFD, 1601 &UrandomFD,
1592 &Are3DInterfacesDisabled, 1602 &Are3DInterfacesDisabled,
1593 &BrokerDuplicateHandle, 1603 &BrokerDuplicateHandle,
1594 &GetReadonlyPnaclFd, 1604 &GetReadonlyPnaclFd,
1595 &CreateTemporaryFile, 1605 &CreateTemporaryFile,
1596 &GetNumberOfProcessors, 1606 &GetNumberOfProcessors,
1597 &PPIsNonSFIModeEnabled, 1607 &PPIsNonSFIModeEnabled,
(...skipping 19 matching lines...) Expand all
1617 &GetManifestBaseURL, 1627 &GetManifestBaseURL,
1618 &ProcessNaClManifest, 1628 &ProcessNaClManifest,
1619 &DevInterfacesEnabled, 1629 &DevInterfacesEnabled,
1620 &ManifestGetProgramURL, 1630 &ManifestGetProgramURL,
1621 &GetPNaClResourceInfo, 1631 &GetPNaClResourceInfo,
1622 &GetCpuFeatureAttrs, 1632 &GetCpuFeatureAttrs,
1623 &PostMessageToJavaScript, 1633 &PostMessageToJavaScript,
1624 &DownloadNexe, 1634 &DownloadNexe,
1625 &ReportSelLdrStatus, 1635 &ReportSelLdrStatus,
1626 &LogTranslateTime, 1636 &LogTranslateTime,
1627 &OpenManifestEntry 1637 &OpenManifestEntry,
1638 &SetPNaClStartTime
1628 }; 1639 };
1629 1640
1630 } // namespace 1641 } // namespace
1631 1642
1632 const PPB_NaCl_Private* GetNaClPrivateInterface() { 1643 const PPB_NaCl_Private* GetNaClPrivateInterface() {
1633 return &nacl_interface; 1644 return &nacl_interface;
1634 } 1645 }
1635 1646
1636 } // namespace nacl 1647 } // namespace nacl
OLDNEW
« no previous file with comments | « components/nacl/renderer/nexe_load_manager.h ('k') | ppapi/api/private/ppb_nacl_private.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698