browser/extensions/pdfjs/content/PdfJsTelemetry.jsm

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/extensions/pdfjs/content/PdfJsTelemetry.jsm	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,59 @@
     1.4 +/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
     1.6 +/* Copyright 2013 Mozilla Foundation
     1.7 + *
     1.8 + * Licensed under the Apache License, Version 2.0 (the "License");
     1.9 + * you may not use this file except in compliance with the License.
    1.10 + * You may obtain a copy of the License at
    1.11 + *
    1.12 + *     http://www.apache.org/licenses/LICENSE-2.0
    1.13 + *
    1.14 + * Unless required by applicable law or agreed to in writing, software
    1.15 + * distributed under the License is distributed on an "AS IS" BASIS,
    1.16 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    1.17 + * See the License for the specific language governing permissions and
    1.18 + * limitations under the License.
    1.19 + */
    1.20 +/* jshint esnext:true */
    1.21 +
    1.22 +'use strict';
    1.23 +
    1.24 +this.EXPORTED_SYMBOLS = ['PdfJsTelemetry'];
    1.25 +
    1.26 +const Cu = Components.utils;
    1.27 +Cu.import('resource://gre/modules/Services.jsm');
    1.28 +
    1.29 +this.PdfJsTelemetry = {
    1.30 +  onViewerIsUsed: function () {
    1.31 +    let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_USED");
    1.32 +    histogram.add(true);
    1.33 +  },
    1.34 +  onFallback: function () {
    1.35 +    let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_FALLBACK_SHOWN");
    1.36 +    histogram.add(true);
    1.37 +  },
    1.38 +  onDocumentSize: function (size) {
    1.39 +    let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_DOCUMENT_SIZE_KB");
    1.40 +    histogram.add(size / 1024);
    1.41 +  },
    1.42 +  onDocumentVersion: function (versionId) {
    1.43 +    let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_DOCUMENT_VERSION");
    1.44 +    histogram.add(versionId);
    1.45 +  },
    1.46 +  onDocumentGenerator: function (generatorId) {
    1.47 +    let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_DOCUMENT_GENERATOR");
    1.48 +    histogram.add(generatorId);
    1.49 +  },
    1.50 +  onForm: function (isAcroform) {
    1.51 +    let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_FORM");
    1.52 +    histogram.add(isAcroform);
    1.53 +  },
    1.54 +  onStreamType: function (streamTypeId) {
    1.55 +    let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_STREAM_TYPES");
    1.56 +    histogram.add(streamTypeId);
    1.57 +  },
    1.58 +  onTimeToView: function (ms) {
    1.59 +    let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_TIME_TO_VIEW_MS");
    1.60 +    histogram.add(ms);
    1.61 +  }
    1.62 +};

mercurial