[Pkg-javascript-commits] [pdf.js] 294/414: Proxy global PDFJS.verbosity to properly configure shared/util.
David Prévot
taffit at moszumanska.debian.org
Tue Jun 28 17:12:32 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 2fa4dd6f4024b3ff25c74cd7008df3ffa9f68561
Author: Yury Delendik <ydelendik at mozilla.com>
Date: Thu Mar 3 10:13:37 2016 -0600
Proxy global PDFJS.verbosity to properly configure shared/util.
---
src/core/worker.js | 7 ++++---
src/display/api.js | 17 +++++------------
src/display/global.js | 7 +++++++
src/doc_helper.js | 10 ++++++++++
4 files changed, 26 insertions(+), 15 deletions(-)
diff --git a/src/core/worker.js b/src/core/worker.js
index 94e362b..7655651 100644
--- a/src/core/worker.js
+++ b/src/core/worker.js
@@ -462,6 +462,10 @@ var WorkerMessageHandler = {
});
});
+ handler.on('configure', function wphConfigure(data) {
+ setVerbosityLevel(data.verbosity);
+ });
+
handler.on('GetDocRequest', function wphSetupDoc(data) {
return WorkerMessageHandler.createDocumentHandler(data, port);
});
@@ -696,9 +700,6 @@ var WorkerMessageHandler = {
cMapOptions: cMapOptions
};
- // TODO move it to the worker options synchronization place (vs document).
- setVerbosityLevel(data.verbosity);
-
getPdfManager(data, evaluatorOptions).then(function (newPdfManager) {
if (terminated) {
// We were in a process of setting up the manager, but it got
diff --git a/src/display/api.js b/src/display/api.js
index 40872b3..37e731e 100644
--- a/src/display/api.js
+++ b/src/display/api.js
@@ -48,6 +48,7 @@ var createPromiseCapability = sharedUtil.createPromiseCapability;
var combineUrl = sharedUtil.combineUrl;
var error = sharedUtil.error;
var deprecated = sharedUtil.deprecated;
+var getVerbosityLevel = sharedUtil.getVerbosityLevel;
var info = sharedUtil.info;
var isArrayBuffer = sharedUtil.isArrayBuffer;
var isSameOrigin = sharedUtil.isSameOrigin;
@@ -201,17 +202,6 @@ PDFJS.useOnlyCssZoom = (PDFJS.useOnlyCssZoom === undefined ?
false : PDFJS.useOnlyCssZoom);
/**
- * Controls the logging level.
- * The constants from PDFJS.VERBOSITY_LEVELS should be used:
- * - errors
- * - warnings [default]
- * - infos
- * @var {number}
- */
-PDFJS.verbosity = (PDFJS.verbosity === undefined ?
- PDFJS.VERBOSITY_LEVELS.warnings : PDFJS.verbosity);
-
-/**
* The maximum supported canvas size in total pixels e.g. width * height.
* The default value is 4096 * 4096. Use -1 for no limit.
* @var {number}
@@ -456,7 +446,6 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
cMapPacked: PDFJS.cMapPacked,
disableFontFace: PDFJS.disableFontFace,
disableCreateObjectURL: PDFJS.disableCreateObjectURL,
- verbosity: PDFJS.verbosity,
postMessageTransfers: PDFJS.postMessageTransfers,
}).then(function (workerId) {
if (worker.destroyed) {
@@ -1327,6 +1316,10 @@ var PDFWorker = (function PDFWorkerClosure() {
PDFJS.postMessageTransfers = false;
}
this._readyCapability.resolve();
+ // Send global PDFJS setting, e.g. verbosity level.
+ messageHandler.send('configure', {
+ verbosity: getVerbosityLevel()
+ });
} else {
this._setupFakeWorker();
messageHandler.destroy();
diff --git a/src/display/global.js b/src/display/global.js
index 89ccde0..cfc6e55 100644
--- a/src/display/global.js
+++ b/src/display/global.js
@@ -50,6 +50,13 @@
if (PDFJS.verbosity !== undefined) {
sharedUtil.setVerbosityLevel(PDFJS.verbosity);
}
+ delete PDFJS.verbosity;
+ Object.defineProperty(PDFJS, 'verbosity', {
+ get: function () { return sharedUtil.getVerbosityLevel(); },
+ set: function (level) { sharedUtil.setVerbosityLevel(level); },
+ enumerable: true,
+ configurable: true
+ });
PDFJS.VERBOSITY_LEVELS = sharedUtil.VERBOSITY_LEVELS;
PDFJS.OPS = sharedUtil.OPS;
diff --git a/src/doc_helper.js b/src/doc_helper.js
index 00b7709..86632b4 100644
--- a/src/doc_helper.js
+++ b/src/doc_helper.js
@@ -28,6 +28,16 @@ function PDFJS() {
}
/**
+ * Controls the logging level.
+ * The constants from PDFJS.VERBOSITY_LEVELS should be used:
+ * - errors
+ * - warnings [default]
+ * - infos
+ * @var {number}
+ */
+PDFJS.verbosity = PDFJS.VERBOSITY_LEVELS.warnings;
+
+/**
* Represents the eventual result of an asynchronous operation.
* @external Promise
* @see {@link http://promisesaplus.com/ Promise/A+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list