0

Measure % of PDFs with attachments and % of PDFs that are linearized.

Bug: chromium:768986
Change-Id: I255fb808efd17a48d9e3760f2d3ed3317196a2bc
Reviewed-on: https://chromium-review.googlesource.com/716306
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Robert Kaplow <rkaplow@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#509861}
This commit is contained in:
Henrique Nakashima
2017-10-18 20:43:13 +00:00
committed by Commit Bot
parent 6350c27427
commit fe4d6ac310
4 changed files with 32 additions and 2 deletions

@@ -1497,6 +1497,10 @@ void OutOfProcessInstance::DocumentLoadComplete(
pp::PDF::SetContentRestriction(this, content_restrictions);
HistogramCustomCounts("PDF.PageCount", document_features.page_count, 1,
1000000, 50);
HistogramEnumeration("PDF.HasAttachment",
document_features.has_attachments ? 1 : 0, 2);
HistogramEnumeration("PDF.IsLinearized",
document_features.is_linearized ? 1 : 0, 2);
}
void OutOfProcessInstance::RotateClockwise() {

@@ -61,6 +61,12 @@ class PDFEngine {
struct DocumentFeatures {
// Number of pages in document.
size_t page_count = 0;
// Whether any files are attached to document (see "File Attachment
// Annotations" on page 637 of PDF Reference 1.7).
bool has_attachments = false;
// Whether the document is linearized (see Appendix F "Linearized PDF" of
// PDF Reference 1.7).
bool is_linearized = false;
};
// The interface that's provided to the rendering engine.

@@ -51,6 +51,7 @@
#include "printing/pdf_transform.h"
#include "printing/units.h"
#include "third_party/pdfium/public/fpdf_annot.h"
#include "third_party/pdfium/public/fpdf_attachment.h"
#include "third_party/pdfium/public/fpdf_edit.h"
#include "third_party/pdfium/public/fpdf_ext.h"
#include "third_party/pdfium/public/fpdf_flatten.h"
@@ -1281,6 +1282,9 @@ void PDFiumEngine::FinishLoadingDocument() {
if (doc_) {
DocumentFeatures document_features;
document_features.page_count = pages_.size();
document_features.has_attachments = (FPDFDoc_GetAttachmentCount(doc_) > 0);
document_features.is_linearized =
(FPDFAvail_IsLinearized(fpdf_availability_) == PDF_LINEARIZED);
client_->DocumentLoadComplete(document_features);
}
}

@@ -58168,11 +58168,27 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
</summary>
</histogram>
<histogram name="PDF.HasAttachment" enum="Boolean">
<owner>hnakashima@chromium.org</owner>
<summary>
Measures if PDFs opened in the PDF viewer have attachments. This is logged
whenever a document is opened in the PDF viewer.
</summary>
</histogram>
<histogram name="PDF.IsFontSubstituted" enum="Boolean">
<owner>npm@chromium.org</owner>
<summary>
Tracks documents opened in the PDF viewer where substitute fonts need to be
used.
Measures if PDFs opened in the PDF viewer require fonts to be substituted.
This is logged whenever a document is opened in the PDF viewer.
</summary>
</histogram>
<histogram name="PDF.IsLinearized" enum="Boolean">
<owner>hnakashima@chromium.org</owner>
<summary>
Measures if PDFs opened in the PDF viewer are Linearized PDFs. This is
logged whenever a document is opened in the PDF viewer.
</summary>
</histogram>