diff options
author | teravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-27 21:10:59 +0000 |
---|---|---|
committer | teravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-27 21:10:59 +0000 |
commit | 427e3a280b2a02aac8ec8a515cc909150a032854 (patch) | |
tree | 907416175c121e0241053c3a740b3ab740efcfc5 /ppapi | |
parent | bfa7124dd7528c533413671e7c59ac6f756dd1ce (diff) | |
download | chromium_src-427e3a280b2a02aac8ec8a515cc909150a032854.zip chromium_src-427e3a280b2a02aac8ec8a515cc909150a032854.tar.gz chromium_src-427e3a280b2a02aac8ec8a515cc909150a032854.tar.bz2 |
Pepper: Move is_installed state to NexeLoadManager.
This will make it easier to move more code out of ppapi/native_client,
especially UMA/Histogram support.
BUG=239656
R=dmichael@chromium.org
Review URL: https://codereview.chromium.org/214973002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@259989 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/api/private/ppb_nacl_private.idl | 10 | ||||
-rw-r--r-- | ppapi/c/private/ppb_nacl_private.h | 9 | ||||
-rw-r--r-- | ppapi/native_client/src/trusted/plugin/plugin.cc | 41 | ||||
-rw-r--r-- | ppapi/native_client/src/trusted/plugin/plugin.h | 6 | ||||
-rw-r--r-- | ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c | 20 |
5 files changed, 54 insertions, 32 deletions
diff --git a/ppapi/api/private/ppb_nacl_private.idl b/ppapi/api/private/ppb_nacl_private.idl index c1e88c7..193916c 100644 --- a/ppapi/api/private/ppb_nacl_private.idl +++ b/ppapi/api/private/ppb_nacl_private.idl @@ -287,8 +287,7 @@ interface PPB_NaCl_Private { void ReportLoadError([in] PP_Instance instance, [in] PP_NaClError error, [in] str_t error_message, - [in] str_t console_message, - [in] PP_Bool is_installed); + [in] str_t console_message); /* Performs internal setup when an instance is created. */ void InstanceCreated([in] PP_Instance instance); @@ -326,4 +325,11 @@ interface PPB_NaCl_Private { /* Sets the NaCl readiness status for this instance. */ void SetNaClReadyState([in] PP_Instance instance, [in] PP_NaClReadyState ready_state); + + /* Returns true if the plugin is an installed app. */ + PP_Bool GetIsInstalled([in] PP_Instance instance); + + /* Sets whether the plugin is an installed app. */ + void SetIsInstalled([in] PP_Instance instance, + [in] PP_Bool is_installed); }; diff --git a/ppapi/c/private/ppb_nacl_private.h b/ppapi/c/private/ppb_nacl_private.h index 94b3acd..dd0a04f 100644 --- a/ppapi/c/private/ppb_nacl_private.h +++ b/ppapi/c/private/ppb_nacl_private.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From private/ppb_nacl_private.idl modified Wed Mar 26 10:20:49 2014. */ +/* From private/ppb_nacl_private.idl modified Thu Mar 27 10:43:40 2014. */ #ifndef PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_ #define PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_ @@ -294,8 +294,7 @@ struct PPB_NaCl_Private_1_0 { void (*ReportLoadError)(PP_Instance instance, PP_NaClError error, const char* error_message, - const char* console_message, - PP_Bool is_installed); + const char* console_message); /* Performs internal setup when an instance is created. */ void (*InstanceCreated)(PP_Instance instance); /* Performs internal cleanup when an instance is destroyed. */ @@ -321,6 +320,10 @@ struct PPB_NaCl_Private_1_0 { /* Sets the NaCl readiness status for this instance. */ void (*SetNaClReadyState)(PP_Instance instance, PP_NaClReadyState ready_state); + /* Returns true if the plugin is an installed app. */ + PP_Bool (*GetIsInstalled)(PP_Instance instance); + /* Sets whether the plugin is an installed app. */ + void (*SetIsInstalled)(PP_Instance instance, PP_Bool is_installed); }; typedef struct PPB_NaCl_Private_1_0 PPB_NaCl_Private; diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc index 97206952..e550805 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.cc +++ b/ppapi/native_client/src/trusted/plugin/plugin.cc @@ -230,25 +230,25 @@ void Plugin::HistogramEnumerateOsArch(const std::string& sandbox_isa) { HistogramEnumerate("NaCl.Client.OSArch", os_arch, kNaClOSArchMax, -1); } -void Plugin::HistogramEnumerateLoadStatus(PP_NaClError error_code, - bool is_installed) { +void Plugin::HistogramEnumerateLoadStatus(PP_NaClError error_code) { HistogramEnumerate("NaCl.LoadStatus.Plugin", error_code, PP_NACL_ERROR_MAX, PP_NACL_ERROR_UNKNOWN); // Gather data to see if being installed changes load outcomes. - const char* name = is_installed ? "NaCl.LoadStatus.Plugin.InstalledApp" : + const char* name = nacl_interface_->GetIsInstalled(pp_instance()) ? + "NaCl.LoadStatus.Plugin.InstalledApp" : "NaCl.LoadStatus.Plugin.NotInstalledApp"; HistogramEnumerate(name, error_code, PP_NACL_ERROR_MAX, PP_NACL_ERROR_UNKNOWN); } -void Plugin::HistogramEnumerateSelLdrLoadStatus(NaClErrorCode error_code, - bool is_installed) { +void Plugin::HistogramEnumerateSelLdrLoadStatus(NaClErrorCode error_code) { HistogramEnumerate("NaCl.LoadStatus.SelLdr", error_code, NACL_ERROR_CODE_MAX, LOAD_STATUS_UNKNOWN); // Gather data to see if being installed changes load outcomes. - const char* name = is_installed ? "NaCl.LoadStatus.SelLdr.InstalledApp" : + const char* name = nacl_interface_->GetIsInstalled(pp_instance()) ? + "NaCl.LoadStatus.SelLdr.InstalledApp" : "NaCl.LoadStatus.SelLdr.NotInstalledApp"; HistogramEnumerate(name, error_code, NACL_ERROR_CODE_MAX, LOAD_STATUS_UNKNOWN); @@ -591,7 +591,6 @@ Plugin::Plugin(PP_Instance pp_instance) uses_nonsfi_mode_(false), wrapper_factory_(NULL), enable_dev_interfaces_(false), - is_installed_(false), init_time_(0), ready_time_(0), nexe_size_(0), @@ -710,7 +709,7 @@ void Plugin::NexeFileDidOpen(int32_t pp_error) { PLUGIN_PRINTF(("Plugin::NexeFileDidOpen (file_desc=%" NACL_PRId32 ")\n", info.get_desc())); HistogramHTTPStatusCode( - is_installed_ ? + nacl_interface_->GetIsInstalled(pp_instance()) ? "NaCl.HttpStatusCodeClass.Nexe.InstalledApp" : "NaCl.HttpStatusCodeClass.Nexe.NotInstalledApp", nexe_downloader_.status_code()); @@ -976,7 +975,7 @@ void Plugin::NaClManifestFileDidOpen(int32_t pp_error) { HistogramTimeSmall("NaCl.Perf.StartupTime.ManifestDownload", nexe_downloader_.TimeSinceOpenMilliseconds()); HistogramHTTPStatusCode( - is_installed_ ? + nacl_interface_->GetIsInstalled(pp_instance()) ? "NaCl.HttpStatusCodeClass.Manifest.InstalledApp" : "NaCl.HttpStatusCodeClass.Manifest.NotInstalledApp", nexe_downloader_.status_code()); @@ -1054,8 +1053,11 @@ void Plugin::ProcessNaClManifest(const nacl::string& manifest_json) { if (manifest_->GetProgramURL( &program_url, &pnacl_options, &uses_nonsfi_mode, &error_info)) { pp::Var program_url_var(program_url); - is_installed_ = (nacl_interface_->GetUrlScheme(program_url_var.pp_var()) == - PP_SCHEME_CHROME_EXTENSION); + nacl_interface_->SetIsInstalled( + pp_instance(), + PP_FromBool( + nacl_interface_->GetUrlScheme(program_url_var.pp_var()) == + PP_SCHEME_CHROME_EXTENSION)); uses_nonsfi_mode_ = uses_nonsfi_mode; nacl_interface_->SetNaClReadyState(pp_instance(), PP_NACL_READY_STATE_LOADING); @@ -1112,8 +1114,11 @@ void Plugin::RequestNaClManifest(const nacl::string& url) { } PLUGIN_PRINTF(("Plugin::RequestNaClManifest (resolved url='%s')\n", nmf_resolved_url.AsString().c_str())); - is_installed_ = (nacl_interface_->GetUrlScheme(nmf_resolved_url.pp_var()) == - PP_SCHEME_CHROME_EXTENSION); + nacl_interface_->SetIsInstalled( + pp_instance(), + PP_FromBool( + nacl_interface_->GetUrlScheme(nmf_resolved_url.pp_var()) == + PP_SCHEME_CHROME_EXTENSION)); set_manifest_base_url(nmf_resolved_url.AsString()); // Inform JavaScript that a load is starting. nacl_interface_->SetNaClReadyState(pp_instance(), PP_NACL_READY_STATE_OPENED); @@ -1261,7 +1266,7 @@ void Plugin::ReportLoadSuccess(LengthComputable length_computable, PP_NACL_EVENT_LOADEND, url, length_computable, loaded_bytes, total_bytes); // UMA - HistogramEnumerateLoadStatus(PP_NACL_ERROR_LOAD_SUCCESS, is_installed_); + HistogramEnumerateLoadStatus(PP_NACL_ERROR_LOAD_SUCCESS); } @@ -1271,8 +1276,7 @@ void Plugin::ReportLoadError(const ErrorInfo& error_info) { nacl_interface_->ReportLoadError(pp_instance(), error_info.error_code(), error_info.message().c_str(), - error_info.console_message().c_str(), - PP_FromBool(is_installed_)); + error_info.console_message().c_str()); } @@ -1290,7 +1294,7 @@ void Plugin::ReportLoadAbort() { EnqueueProgressEvent(PP_NACL_EVENT_LOADEND); // UMA - HistogramEnumerateLoadStatus(PP_NACL_ERROR_LOAD_ABORTED, is_installed_); + HistogramEnumerateLoadStatus(PP_NACL_ERROR_LOAD_ABORTED); } void Plugin::UpdateDownloadProgress( @@ -1348,8 +1352,7 @@ const FileDownloader* Plugin::FindFileDownloader( } void Plugin::ReportSelLdrLoadStatus(int status) { - HistogramEnumerateSelLdrLoadStatus(static_cast<NaClErrorCode>(status), - is_installed_); + HistogramEnumerateSelLdrLoadStatus(static_cast<NaClErrorCode>(status)); } void Plugin::EnqueueProgressEvent(PP_NaClEventType event_type) { diff --git a/ppapi/native_client/src/trusted/plugin/plugin.h b/ppapi/native_client/src/trusted/plugin/plugin.h index 6ddd322..d7a5962 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.h +++ b/ppapi/native_client/src/trusted/plugin/plugin.h @@ -245,10 +245,8 @@ class Plugin : public pp::Instance { int maximum, int out_of_range_replacement); void HistogramEnumerateOsArch(const std::string& sandbox_isa); - void HistogramEnumerateLoadStatus(PP_NaClError error_code, - bool is_installed); - void HistogramEnumerateSelLdrLoadStatus(NaClErrorCode error_code, - bool is_installed); + void HistogramEnumerateLoadStatus(PP_NaClError error_code); + void HistogramEnumerateSelLdrLoadStatus(NaClErrorCode error_code); void HistogramEnumerateManifestIsDataURI(bool is_data_uri); void HistogramHTTPStatusCode(const std::string& name, int status); diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c index 65a4729..1c1fd05 100644 --- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c +++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c @@ -3161,9 +3161,9 @@ static void Pnacl_M25_PPB_NaCl_Private_SetReadOnlyProperty(PP_Instance instance, iface->SetReadOnlyProperty(instance, *key, *value); } -static void Pnacl_M25_PPB_NaCl_Private_ReportLoadError(PP_Instance instance, PP_NaClError error, const char* error_message, const char* console_message, PP_Bool is_installed) { +static void Pnacl_M25_PPB_NaCl_Private_ReportLoadError(PP_Instance instance, PP_NaClError error, const char* error_message, const char* console_message) { const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; - iface->ReportLoadError(instance, error, error_message, console_message, is_installed); + iface->ReportLoadError(instance, error, error_message, console_message); } static void Pnacl_M25_PPB_NaCl_Private_InstanceCreated(PP_Instance instance) { @@ -3216,6 +3216,16 @@ static void Pnacl_M25_PPB_NaCl_Private_SetNaClReadyState(PP_Instance instance, P iface->SetNaClReadyState(instance, ready_state); } +static PP_Bool Pnacl_M25_PPB_NaCl_Private_GetIsInstalled(PP_Instance instance) { + const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; + return iface->GetIsInstalled(instance); +} + +static void Pnacl_M25_PPB_NaCl_Private_SetIsInstalled(PP_Instance instance, PP_Bool is_installed) { + const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; + iface->SetIsInstalled(instance, is_installed); +} + /* End wrapper methods for PPB_NaCl_Private_1_0 */ /* Begin wrapper methods for PPB_NetAddress_Private_0_1 */ @@ -5108,7 +5118,7 @@ static const struct PPB_NaCl_Private_1_0 Pnacl_Wrappers_PPB_NaCl_Private_1_0 = { .OpenNaClExecutable = (PP_FileHandle (*)(PP_Instance instance, const char* file_url, uint64_t* file_token_lo, uint64_t* file_token_hi))&Pnacl_M25_PPB_NaCl_Private_OpenNaClExecutable, .DispatchEvent = (void (*)(PP_Instance instance, PP_NaClEventType event_type, const char* resource_url, PP_Bool length_is_computable, uint64_t loaded_bytes, uint64_t total_bytes))&Pnacl_M25_PPB_NaCl_Private_DispatchEvent, .SetReadOnlyProperty = (void (*)(PP_Instance instance, struct PP_Var key, struct PP_Var value))&Pnacl_M25_PPB_NaCl_Private_SetReadOnlyProperty, - .ReportLoadError = (void (*)(PP_Instance instance, PP_NaClError error, const char* error_message, const char* console_message, PP_Bool is_installed))&Pnacl_M25_PPB_NaCl_Private_ReportLoadError, + .ReportLoadError = (void (*)(PP_Instance instance, PP_NaClError error, const char* error_message, const char* console_message))&Pnacl_M25_PPB_NaCl_Private_ReportLoadError, .InstanceCreated = (void (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_InstanceCreated, .InstanceDestroyed = (void (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_InstanceDestroyed, .NaClDebugStubEnabled = (PP_Bool (*)(void))&Pnacl_M25_PPB_NaCl_Private_NaClDebugStubEnabled, @@ -5118,7 +5128,9 @@ static const struct PPB_NaCl_Private_1_0 Pnacl_Wrappers_PPB_NaCl_Private_1_0 = { .GetNexeErrorReported = (PP_Bool (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_GetNexeErrorReported, .SetNexeErrorReported = (void (*)(PP_Instance instance, PP_Bool error_reported))&Pnacl_M25_PPB_NaCl_Private_SetNexeErrorReported, .GetNaClReadyState = (PP_NaClReadyState (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_GetNaClReadyState, - .SetNaClReadyState = (void (*)(PP_Instance instance, PP_NaClReadyState ready_state))&Pnacl_M25_PPB_NaCl_Private_SetNaClReadyState + .SetNaClReadyState = (void (*)(PP_Instance instance, PP_NaClReadyState ready_state))&Pnacl_M25_PPB_NaCl_Private_SetNaClReadyState, + .GetIsInstalled = (PP_Bool (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_GetIsInstalled, + .SetIsInstalled = (void (*)(PP_Instance instance, PP_Bool is_installed))&Pnacl_M25_PPB_NaCl_Private_SetIsInstalled }; static const struct PPB_NetAddress_Private_0_1 Pnacl_Wrappers_PPB_NetAddress_Private_0_1 = { |