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

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

Issue 1090233003: Set up a NaCl load status callback to start replacing "start_module". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use the enum instead of int Created 5 years, 8 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
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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 } 493 }
494 494
495 *(static_cast<NaClHandle*>(imc_handle)) = ToNativeHandle(result_socket); 495 *(static_cast<NaClHandle*>(imc_handle)) = ToNativeHandle(result_socket);
496 496
497 // Store the crash information shared memory handle. 497 // Store the crash information shared memory handle.
498 load_manager->set_crash_info_shmem_handle( 498 load_manager->set_crash_info_shmem_handle(
499 launch_result.crash_info_shmem_handle); 499 launch_result.crash_info_shmem_handle);
500 500
501 // Create the trusted plugin channel. 501 // Create the trusted plugin channel.
502 if (IsValidChannelHandle(launch_result.trusted_ipc_channel_handle)) { 502 if (IsValidChannelHandle(launch_result.trusted_ipc_channel_handle)) {
503 bool report_exit_status = PP_ToBool(main_service_runtime); 503 bool is_helper_nexe = !PP_ToBool(main_service_runtime);
504 scoped_ptr<TrustedPluginChannel> trusted_plugin_channel( 504 scoped_ptr<TrustedPluginChannel> trusted_plugin_channel(
505 new TrustedPluginChannel( 505 new TrustedPluginChannel(
506 load_manager, 506 load_manager,
507 launch_result.trusted_ipc_channel_handle, 507 launch_result.trusted_ipc_channel_handle,
508 content::RenderThread::Get()->GetShutdownEvent(), 508 content::RenderThread::Get()->GetShutdownEvent(),
509 report_exit_status)); 509 is_helper_nexe));
510 load_manager->set_trusted_plugin_channel(trusted_plugin_channel.Pass()); 510 load_manager->set_trusted_plugin_channel(trusted_plugin_channel.Pass());
511 } else { 511 } else {
512 PostPPCompletionCallback(callback, PP_ERROR_FAILED); 512 PostPPCompletionCallback(callback, PP_ERROR_FAILED);
513 return; 513 return;
514 } 514 }
515 515
516 // Create the manifest service handle as well. 516 // Create the manifest service handle as well.
517 if (IsValidChannelHandle(launch_result.manifest_service_ipc_channel_handle)) { 517 if (IsValidChannelHandle(launch_result.manifest_service_ipc_channel_handle)) {
518 scoped_ptr<ManifestServiceChannel> manifest_service_channel( 518 scoped_ptr<ManifestServiceChannel> manifest_service_channel(
519 new ManifestServiceChannel( 519 new ManifestServiceChannel(
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 // FileDownloader deletes itself after invoking DownloadNexeCompletion. 1477 // FileDownloader deletes itself after invoking DownloadNexeCompletion.
1478 FileDownloader* file_downloader = new FileDownloader( 1478 FileDownloader* file_downloader = new FileDownloader(
1479 url_loader.Pass(), 1479 url_loader.Pass(),
1480 target_file.Pass(), 1480 target_file.Pass(),
1481 base::Bind(&DownloadFileCompletion, callback), 1481 base::Bind(&DownloadFileCompletion, callback),
1482 base::Bind(&ProgressEventRateLimiter::ReportProgress, 1482 base::Bind(&ProgressEventRateLimiter::ReportProgress,
1483 base::Owned(tracker), std::string(url))); 1483 base::Owned(tracker), std::string(url)));
1484 file_downloader->Load(url_request); 1484 file_downloader->Load(url_request);
1485 } 1485 }
1486 1486
1487 void ReportSelLdrStatus(PP_Instance instance,
1488 int32_t load_status,
1489 int32_t max_status) {
1490 HistogramEnumerate("NaCl.LoadStatus.SelLdr", load_status, max_status);
1491 NexeLoadManager* load_manager = GetNexeLoadManager(instance);
1492 DCHECK(load_manager);
1493 if (!load_manager)
1494 return;
1495
1496 // Gather data to see if being installed changes load outcomes.
1497 const char* name = load_manager->is_installed() ?
1498 "NaCl.LoadStatus.SelLdr.InstalledApp" :
1499 "NaCl.LoadStatus.SelLdr.NotInstalledApp";
1500 HistogramEnumerate(name, load_status, max_status);
1501 }
1502
1503 void LogTranslateTime(const char* histogram_name, 1487 void LogTranslateTime(const char* histogram_name,
1504 int64_t time_in_us) { 1488 int64_t time_in_us) {
1505 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( 1489 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask(
1506 FROM_HERE, 1490 FROM_HERE,
1507 base::Bind(&HistogramTimeTranslation, 1491 base::Bind(&HistogramTimeTranslation,
1508 std::string(histogram_name), 1492 std::string(histogram_name),
1509 time_in_us / 1000)); 1493 time_in_us / 1000));
1510 } 1494 }
1511 1495
1512 void LogBytesCompiledVsDowloaded(PP_Bool use_subzero, 1496 void LogBytesCompiledVsDowloaded(PP_Bool use_subzero,
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 &GetSandboxArch, 1694 &GetSandboxArch,
1711 &Vlog, 1695 &Vlog,
1712 &InitializePlugin, 1696 &InitializePlugin,
1713 &RequestNaClManifest, 1697 &RequestNaClManifest,
1714 &GetManifestBaseURL, 1698 &GetManifestBaseURL,
1715 &ProcessNaClManifest, 1699 &ProcessNaClManifest,
1716 &ManifestGetProgramURL, 1700 &ManifestGetProgramURL,
1717 &GetPNaClResourceInfo, 1701 &GetPNaClResourceInfo,
1718 &GetCpuFeatureAttrs, 1702 &GetCpuFeatureAttrs,
1719 &DownloadNexe, 1703 &DownloadNexe,
1720 &ReportSelLdrStatus,
1721 &LogTranslateTime, 1704 &LogTranslateTime,
1722 &LogBytesCompiledVsDowloaded, 1705 &LogBytesCompiledVsDowloaded,
1723 &SetPNaClStartTime, 1706 &SetPNaClStartTime,
1724 &StreamPexe 1707 &StreamPexe
1725 }; 1708 };
1726 1709
1727 } // namespace 1710 } // namespace
1728 1711
1729 const PPB_NaCl_Private* GetNaClPrivateInterface() { 1712 const PPB_NaCl_Private* GetNaClPrivateInterface() {
1730 return &nacl_interface; 1713 return &nacl_interface;
1731 } 1714 }
1732 1715
1733 } // namespace nacl 1716 } // namespace nacl
OLDNEW
« no previous file with comments | « components/nacl/renderer/ppb_nacl_private.h ('k') | components/nacl/renderer/trusted_plugin_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698