Remove the undocumented PDFJS.enableStats
option
In order to simplify things, the undocumented `enableStats` option was removed and `pdfBug` is now instead used to enabled general debugging *and* page request/rendering stats. Considering that in the default viewer the `stats` was only used when debugging was also enabled, this simplification (code wise) definitely seem worthwhile to me.
This commit is contained in:
parent
6bc3e1fb93
commit
e95c11a7f0
@ -745,7 +745,7 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
|
||||
this.pageIndex = pageIndex;
|
||||
this.pageInfo = pageInfo;
|
||||
this.transport = transport;
|
||||
this._stats = (getDefaultSetting('enableStats') ?
|
||||
this._stats = (getDefaultSetting('pdfBug') ?
|
||||
new StatTimer() : DummyStatTimer);
|
||||
this.commonObjs = transport.commonObjs;
|
||||
this.objs = new PDFObjects();
|
||||
|
@ -359,8 +359,6 @@ function getDefaultSetting(id) {
|
||||
return globalSettings ? globalSettings.maxImageSize : -1;
|
||||
case 'isEvalSupported':
|
||||
return globalSettings ? globalSettings.isEvalSupported : true;
|
||||
case 'enableStats':
|
||||
return !!(globalSettings && globalSettings.enableStats);
|
||||
default:
|
||||
throw new Error('Unknown default setting: ' + id);
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ var Driver = (function DriverClosure() { // eslint-disable-line no-unused-vars
|
||||
PDFJS.workerSrc = '../build/generic/build/pdf.worker.js';
|
||||
PDFJS.cMapPacked = true;
|
||||
PDFJS.cMapUrl = '../external/bcmaps/';
|
||||
PDFJS.enableStats = true;
|
||||
PDFJS.pdfBug = true;
|
||||
|
||||
// Set the passed options
|
||||
this.inflight = options.inflight;
|
||||
|
@ -333,8 +333,7 @@ let PDFViewerApplication = {
|
||||
}
|
||||
if ('pdfbug' in hashParams) {
|
||||
PDFJS.pdfBug = true;
|
||||
let pdfBug = hashParams['pdfbug'];
|
||||
let enabled = pdfBug.split(',');
|
||||
let enabled = hashParams['pdfbug'].split(',');
|
||||
waitOn.push(loadAndEnablePDFBug(enabled));
|
||||
}
|
||||
// Locale can be changed only when special debugging flags is present in
|
||||
@ -1558,7 +1557,6 @@ function loadAndEnablePDFBug(enabledTabs) {
|
||||
script.onload = function () {
|
||||
PDFBug.enable(enabledTabs);
|
||||
PDFBug.init({
|
||||
PDFJS,
|
||||
OPS,
|
||||
}, appConfig.mainContainer);
|
||||
resolve();
|
||||
@ -1723,8 +1721,7 @@ function webViewerPageRendered(evt) {
|
||||
thumbnailView.setImage(pageView);
|
||||
}
|
||||
|
||||
if (PDFJS.pdfBug && typeof Stats !== 'undefined' && Stats.enabled &&
|
||||
pageView.stats) {
|
||||
if (typeof Stats !== 'undefined' && Stats.enabled && pageView.stats) {
|
||||
Stats.add(pageNumber, pageView.stats);
|
||||
}
|
||||
|
||||
@ -2013,7 +2010,7 @@ function webViewerPageChanging(evt) {
|
||||
}
|
||||
|
||||
// we need to update stats
|
||||
if (PDFJS.pdfBug && typeof Stats !== 'undefined' && Stats.enabled) {
|
||||
if (typeof Stats !== 'undefined' && Stats.enabled) {
|
||||
let pageView = PDFViewerApplication.pdfViewer.getPageView(page - 1);
|
||||
if (pageView && pageView.stats) {
|
||||
Stats.add(page, pageView.stats);
|
||||
|
@ -462,7 +462,6 @@ var Stats = (function Stats() {
|
||||
manager: null,
|
||||
init(pdfjsLib) {
|
||||
this.panel.setAttribute('style', 'padding: 5px;');
|
||||
pdfjsLib.PDFJS.enableStats = true;
|
||||
},
|
||||
enabled: false,
|
||||
active: false,
|
||||
|
Loading…
x
Reference in New Issue
Block a user