browser/extensions/pdfjs/content/PdfJsTelemetry.jsm

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:35071ac6e740
1 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
3 /* Copyright 2013 Mozilla Foundation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 /* jshint esnext:true */
18
19 'use strict';
20
21 this.EXPORTED_SYMBOLS = ['PdfJsTelemetry'];
22
23 const Cu = Components.utils;
24 Cu.import('resource://gre/modules/Services.jsm');
25
26 this.PdfJsTelemetry = {
27 onViewerIsUsed: function () {
28 let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_USED");
29 histogram.add(true);
30 },
31 onFallback: function () {
32 let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_FALLBACK_SHOWN");
33 histogram.add(true);
34 },
35 onDocumentSize: function (size) {
36 let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_DOCUMENT_SIZE_KB");
37 histogram.add(size / 1024);
38 },
39 onDocumentVersion: function (versionId) {
40 let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_DOCUMENT_VERSION");
41 histogram.add(versionId);
42 },
43 onDocumentGenerator: function (generatorId) {
44 let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_DOCUMENT_GENERATOR");
45 histogram.add(generatorId);
46 },
47 onForm: function (isAcroform) {
48 let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_FORM");
49 histogram.add(isAcroform);
50 },
51 onStreamType: function (streamTypeId) {
52 let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_STREAM_TYPES");
53 histogram.add(streamTypeId);
54 },
55 onTimeToView: function (ms) {
56 let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_TIME_TO_VIEW_MS");
57 histogram.add(ms);
58 }
59 };

mercurial