Skip to content

Commit 0538edb

Browse files
committed
Merge pull request mozilla#732 from kkujala/master
Name anonymous functions in core.js.
2 parents eed0773 + ce3f9ae commit 0538edb

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

src/core.js

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ var Page = (function pagePage() {
153153
return shadow(this, 'rotate', rotate);
154154
},
155155

156-
startRenderingFromIRQueue: function startRenderingFromIRQueue(
156+
startRenderingFromIRQueue: function pageStartRenderingFromIRQueue(
157157
IRQueue, fonts) {
158158
var self = this;
159159
this.IRQueue = IRQueue;
@@ -173,12 +173,13 @@ var Page = (function pagePage() {
173173
});
174174
};
175175

176-
this.ensureFonts(fonts, function() {
176+
this.ensureFonts(fonts,
177+
function pageStartRenderingFromIRQueueEnsureFonts() {
177178
displayContinuation();
178179
});
179180
},
180181

181-
getIRQueue: function(handler, dependency) {
182+
getIRQueue: function pageGetIRQueue(handler, dependency) {
182183
if (this.IRQueue) {
183184
// content was compiled
184185
return this.IRQueue;
@@ -202,7 +203,7 @@ var Page = (function pagePage() {
202203
content, resources, IRQueue, dependency);
203204
},
204205

205-
ensureFonts: function(fonts, callback) {
206+
ensureFonts: function pageEnsureFonts(fonts, callback) {
206207
// Convert the font names to the corresponding font obj.
207208
for (var i = 0; i < fonts.length; i++) {
208209
fonts[i] = this.objs.objs[fonts[i]].data;
@@ -211,7 +212,7 @@ var Page = (function pagePage() {
211212
// Load all the fonts
212213
var fontObjs = FontLoader.bind(
213214
fonts,
214-
function(fontObjs) {
215+
function pageEnsureFontsFontObjs(fontObjs) {
215216
this.stats.fonts = Date.now();
216217

217218
callback.call(this);
@@ -220,7 +221,7 @@ var Page = (function pagePage() {
220221
);
221222
},
222223

223-
display: function(gfx, callback) {
224+
display: function pageDisplay(gfx, callback) {
224225
var xref = this.xref;
225226
var resources = xref.fetchIfRef(this.resources);
226227
var mediaBox = xref.fetchIfRef(this.mediaBox);
@@ -305,7 +306,7 @@ var Page = (function pagePage() {
305306
}
306307
return links;
307308
},
308-
startRendering: function(ctx, callback) {
309+
startRendering: function pageStartRendering(ctx, callback) {
309310
this.ctx = ctx;
310311
this.callback = callback;
311312

@@ -446,7 +447,7 @@ var PDFDocModel = (function pdfDoc() {
446447
return constructor;
447448
})();
448449

449-
var PDFDoc = (function() {
450+
var PDFDoc = (function pdfDoc() {
450451
function constructor(arg, callback) {
451452
var stream = null;
452453
var data = null;
@@ -475,10 +476,10 @@ var PDFDoc = (function() {
475476
} else {
476477
// If we don't use a worker, just post/sendMessage to the main thread.
477478
var worker = {
478-
postMessage: function(obj) {
479+
postMessage: function pdfDocPostMessage(obj) {
479480
worker.onmessage({data: obj});
480481
},
481-
terminate: function() {}
482+
terminate: function pdfDocTerminate() {}
482483
};
483484
}
484485
this.worker = worker;
@@ -488,15 +489,15 @@ var PDFDoc = (function() {
488489
var processorHandler = this.processorHandler =
489490
new MessageHandler('main', worker);
490491

491-
processorHandler.on('page', function(data) {
492+
processorHandler.on('page', function pdfDocPage(data) {
492493
var pageNum = data.pageNum;
493494
var page = this.pageCache[pageNum];
494495
var depFonts = data.depFonts;
495496

496497
page.startRenderingFromIRQueue(data.IRQueue, depFonts);
497498
}, this);
498499

499-
processorHandler.on('obj', function(data) {
500+
processorHandler.on('obj', function pdfDocObj(data) {
500501
var id = data[0];
501502
var type = data[1];
502503

@@ -540,7 +541,7 @@ var PDFDoc = (function() {
540541
}
541542
}, this);
542543

543-
processorHandler.on('font_ready', function(data) {
544+
processorHandler.on('font_ready', function pdfDocFontReady(data) {
544545
var id = data[0];
545546
var font = new FontShape(data[1]);
546547

@@ -559,7 +560,7 @@ var PDFDoc = (function() {
559560
}
560561

561562
this.workerReadyPromise = new Promise('workerReady');
562-
setTimeout(function() {
563+
setTimeout(function pdfDocFontReadySetTimeout() {
563564
processorHandler.send('doc', this.data);
564565
this.workerReadyPromise.resolve(true);
565566
}.bind(this));
@@ -570,14 +571,14 @@ var PDFDoc = (function() {
570571
return this.pdf.numPages;
571572
},
572573

573-
startRendering: function(page) {
574+
startRendering: function pdfDocStartRendering(page) {
574575
// The worker might not be ready to receive the page request yet.
575-
this.workerReadyPromise.then(function() {
576+
this.workerReadyPromise.then(function pdfDocStartRenderingThen() {
576577
this.processorHandler.send('page_request', page.pageNumber + 1);
577578
}.bind(this));
578579
},
579580

580-
getPage: function(n) {
581+
getPage: function pdfDocGetPage(n) {
581582
if (this.pageCache[n])
582583
return this.pageCache[n];
583584

@@ -589,7 +590,7 @@ var PDFDoc = (function() {
589590
return this.pageCache[n] = page;
590591
},
591592

592-
destroy: function() {
593+
destroy: function pdfDocDestroy() {
593594
if (this.worker)
594595
this.worker.terminate();
595596

0 commit comments

Comments
 (0)