Switch away from sending metrics through PPAPI.
In chrome_pdf::OutOfProcessInstance, we should stop sending metrics through PPAPI, which is being deprecated. Bug: 1098489 Change-Id: I5ad6601233561e28b07e52019a097fff99888b33 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2267597 Reviewed-by: Daniel Hosseinian <dhoss@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Daniel Hosseinian <dhoss@chromium.org> Cr-Commit-Position: refs/heads/master@{#784066}
This commit is contained in:

committed by
Commit Bot

parent
e4caa6160d
commit
2505efd03f
@ -444,8 +444,7 @@ OutOfProcessInstance::OutOfProcessInstance(PP_Instance instance)
|
||||
: pp::Instance(instance),
|
||||
pp::Find_Private(this),
|
||||
pp::Printing_Dev(this),
|
||||
paint_manager_(this, this, true),
|
||||
uma_(this) {
|
||||
paint_manager_(this, this, true) {
|
||||
callback_factory_.Initialize(this);
|
||||
pp::Module::Get()->AddPluginInterface(kPPPPdfInterface, &ppp_private);
|
||||
AddPerInstanceObject(kPPPPdfInterface, this);
|
||||
@ -1482,15 +1481,16 @@ void OutOfProcessInstance::DocumentLoadComplete(
|
||||
}
|
||||
|
||||
pp::PDF::SetContentRestriction(this, content_restrictions);
|
||||
HistogramCustomCountsDeprecated("PDF.PageCount", document_features.page_count,
|
||||
1, 1000000, 50);
|
||||
HistogramEnumerationDeprecated("PDF.HasAttachment",
|
||||
document_features.has_attachments ? 1 : 0, 2);
|
||||
HistogramEnumerationDeprecated("PDF.IsTagged",
|
||||
document_features.is_tagged ? 1 : 0, 2);
|
||||
HistogramEnumerationDeprecated(
|
||||
"PDF.FormType", static_cast<int32_t>(document_features.form_type),
|
||||
static_cast<int32_t>(PDFEngine::FormType::kCount));
|
||||
HistogramCustomCounts("PDF.PageCount", document_features.page_count, 1,
|
||||
1000000, 50);
|
||||
HistogramEnumeration("PDF.HasAttachment", document_features.has_attachments
|
||||
? PdfHasAttachment::kYes
|
||||
: PdfHasAttachment::kNo);
|
||||
HistogramEnumeration("PDF.IsTagged", document_features.is_tagged
|
||||
? PdfIsTagged::kYes
|
||||
: PdfIsTagged::kNo);
|
||||
HistogramEnumeration("PDF.FormType", document_features.form_type,
|
||||
PDFEngine::FormType::kCount);
|
||||
HistogramEnumeration("PDF.Version", engine_->GetDocumentMetadata().version);
|
||||
}
|
||||
|
||||
@ -2130,25 +2130,23 @@ void OutOfProcessInstance::HistogramEnumeration(const char* name, T sample) {
|
||||
base::UmaHistogramEnumeration(name, sample);
|
||||
}
|
||||
|
||||
void OutOfProcessInstance::HistogramCustomCountsDeprecated(
|
||||
const std::string& name,
|
||||
int32_t sample,
|
||||
int32_t min,
|
||||
int32_t max,
|
||||
uint32_t bucket_count) {
|
||||
template <typename T>
|
||||
void OutOfProcessInstance::HistogramEnumeration(const char* name,
|
||||
T sample,
|
||||
T enum_size) {
|
||||
if (IsPrintPreview())
|
||||
return;
|
||||
|
||||
uma_.HistogramCustomCounts(name, sample, min, max, bucket_count);
|
||||
base::UmaHistogramEnumeration(name, sample, enum_size);
|
||||
}
|
||||
|
||||
void OutOfProcessInstance::HistogramEnumerationDeprecated(
|
||||
const std::string& name,
|
||||
int32_t sample,
|
||||
int32_t boundary_value) {
|
||||
void OutOfProcessInstance::HistogramCustomCounts(const char* name,
|
||||
int32_t sample,
|
||||
int32_t min,
|
||||
int32_t max,
|
||||
uint32_t bucket_count) {
|
||||
if (IsPrintPreview())
|
||||
return;
|
||||
uma_.HistogramEnumeration(name, sample, boundary_value);
|
||||
base::UmaHistogramCustomCounts(name, sample, min, max, bucket_count);
|
||||
}
|
||||
|
||||
void OutOfProcessInstance::OnPrint(int32_t /*unused_but_required*/) {
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "ppapi/cpp/image_data.h"
|
||||
#include "ppapi/cpp/instance.h"
|
||||
#include "ppapi/cpp/private/find_private.h"
|
||||
#include "ppapi/cpp/private/uma_private.h"
|
||||
#include "ppapi/cpp/url_loader.h"
|
||||
#include "ppapi/utility/completion_callback_factory.h"
|
||||
|
||||
@ -263,20 +262,38 @@ class OutOfProcessInstance : public pp::Instance,
|
||||
pp::FloatPoint BoundScrollOffsetToDocument(
|
||||
const pp::FloatPoint& scroll_offset);
|
||||
|
||||
// These values are persisted to logs. Entries should not be renumbered and
|
||||
// numeric values should never be reused.
|
||||
enum class PdfHasAttachment {
|
||||
kNo = 0,
|
||||
kYes = 1,
|
||||
kMaxValue = kYes,
|
||||
};
|
||||
|
||||
// These values are persisted to logs. Entries should not be renumbered and
|
||||
// numeric values should never be reused.
|
||||
enum class PdfIsTagged {
|
||||
kNo = 0,
|
||||
kYes = 1,
|
||||
kMaxValue = kYes,
|
||||
};
|
||||
|
||||
// Add a sample to an enumerated histogram and filter out print preview usage.
|
||||
template <typename T>
|
||||
void HistogramEnumeration(const char* name, T sample);
|
||||
|
||||
// Wrappers for |uma_| so histogram reporting only occurs when the PDF Viewer
|
||||
// is not being used for print preview.
|
||||
void HistogramCustomCountsDeprecated(const std::string& name,
|
||||
int32_t sample,
|
||||
int32_t min,
|
||||
int32_t max,
|
||||
uint32_t bucket_count);
|
||||
void HistogramEnumerationDeprecated(const std::string& name,
|
||||
int32_t sample,
|
||||
int32_t boundary_value);
|
||||
// Add a sample to an enumerated legacy histogram and filter out print preview
|
||||
// usage.
|
||||
template <typename T>
|
||||
void HistogramEnumeration(const char* name, T sample, T enum_size);
|
||||
|
||||
// Add a sample to a custom counts histogram and filter out print preview
|
||||
// usage.
|
||||
void HistogramCustomCounts(const char* name,
|
||||
int32_t sample,
|
||||
int32_t min,
|
||||
int32_t max,
|
||||
uint32_t bucket_count);
|
||||
|
||||
// Callback to print without re-entrancy issues.
|
||||
void OnPrint(int32_t /*unused_but_required*/);
|
||||
@ -394,9 +411,6 @@ class OutOfProcessInstance : public pp::Instance,
|
||||
DocumentLoadState document_load_state_ = LOAD_STATE_LOADING;
|
||||
DocumentLoadState preview_document_load_state_ = LOAD_STATE_COMPLETE;
|
||||
|
||||
// A UMA resource for histogram reporting.
|
||||
pp::UMAPrivate uma_;
|
||||
|
||||
// Used so that we only tell the browser once about an unsupported feature, to
|
||||
// avoid the infobar going up more than once.
|
||||
bool told_browser_about_unsupported_feature_ = false;
|
||||
|
Reference in New Issue
Block a user