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