Skip to content

Commit

Permalink
style: fix formatting, remove extra semicolons
Browse files Browse the repository at this point in the history
  • Loading branch information
jbms committed May 21, 2017
1 parent ef9a45e commit da2fdec
Show file tree
Hide file tree
Showing 146 changed files with 1,381 additions and 763 deletions.
2 changes: 1 addition & 1 deletion config/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ module.exports = function(config) {
webpack: webpackConfig,
webpackServer: {noInfo: true},
browserStack: {
// This empty object is required to work around a bug in karma-browserstack-launcher.
// This empty object is required to work around a bug in karma-browserstack-launcher.
},
browsers: [
'Chrome',
Expand Down
17 changes: 8 additions & 9 deletions config/ts_loader_patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,23 @@
const tsLoaderConfigModule = require('ts-loader/dist/config.js');
const tsLoaderUtilsModule = require('ts-loader/dist/utils.js');

tsLoaderConfigModule.getConfigFile = function getConfigFile(compiler, loader, loaderOptions, compilerCompatible, log, compilerDetailsLogMessage) {
tsLoaderConfigModule.getConfigFile = function getConfigFile(
compiler, loader, loaderOptions, compilerCompatible, log, compilerDetailsLogMessage) {
let configFilePath = loaderOptions.configFileName;
var configFileError;
log.logInfo(("ts-loader: Using config file at " + configFilePath).green);
log.logInfo(('ts-loader: Using config file at ' + configFilePath).green);
let configFile = compiler.readConfigFile(configFilePath, compiler.sys.readFile);
if (configFile.error) {
configFileError = tsLoaderUtilsModule.formatErrors([configFile.error], loaderOptions, compiler, { file: configFilePath })[0];
configFileError = tsLoaderUtilsModule.formatErrors(
[configFile.error], loaderOptions, compiler, {file: configFilePath})[0];
}
if (!configFileError) {
configFile.config.compilerOptions = Object.assign({}, configFile.config.compilerOptions, loaderOptions.compilerOptions);
configFile.config.compilerOptions =
Object.assign({}, configFile.config.compilerOptions, loaderOptions.compilerOptions);
// do any necessary config massaging
if (loaderOptions.transpileOnly) {
configFile.config.compilerOptions.isolatedModules = true;
}
}
return {
configFilePath: configFilePath,
configFile: configFile,
configFileError: configFileError
};
return {configFilePath: configFilePath, configFile: configFile, configFileError: configFileError};
};
13 changes: 7 additions & 6 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ const tslint = require('gulp-tslint');
'src/**/*.ts',
];
gulp.task(
'tslint', () => gulp.src(sourcesToLint, {base: '.', nodir: true})
.pipe(tslint({
tslint: require('tslint'),
formatter: "verbose",
}))
.pipe(tslint.report()));
'tslint',
() => gulp.src(sourcesToLint, {base: '.', nodir: true})
.pipe(tslint({
tslint: require('tslint'),
formatter: 'verbose',
}))
.pipe(tslint.report()));
}
36 changes: 27 additions & 9 deletions src/neuroglancer/annotation/frontend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ export class AnnotationPointListLayer extends RefCounted {
this.selectedIndex.value = null;
this.redrawNeeded.dispatch();
}));
this.registerDisposer(selectedIndex.changed.add(() => { this.redrawNeeded.dispatch(); }));
this.registerDisposer(selectedIndex.changed.add(() => {
this.redrawNeeded.dispatch();
}));
}

get gl() { return this.chunkManager.gl; }
get gl() {
return this.chunkManager.gl;
}

updateBuffer() {
let {pointList} = this;
Expand All @@ -76,7 +80,9 @@ export class RenderHelper extends RefCounted {
private squareCornersBuffer = getSquareCornersBuffer(this.gl);
private countingBuffer = this.registerDisposer(getCountingBuffer(this.gl));

constructor(public gl: GL) { super(); }
constructor(public gl: GL) {
super();
}

defineShader(builder: ShaderBuilder) {
// Position of point in camera coordinates.
Expand Down Expand Up @@ -197,11 +203,15 @@ export class PerspectiveViewAnnotationPointListLayer extends PerspectiveViewRend
constructor(public base: AnnotationPointListLayer) {
super();
this.registerDisposer(base);
this.registerDisposer(base.redrawNeeded.add(() => { this.redrawNeeded.dispatch(); }));
this.registerDisposer(base.redrawNeeded.add(() => {
this.redrawNeeded.dispatch();
}));
this.setReady(true);
}

get gl() { return this.base.chunkManager.gl; }
get gl() {
return this.base.chunkManager.gl;
}

draw(renderContext: PerspectiveViewRenderContext) {
this.renderHelper.draw(this, this.base, renderContext);
Expand All @@ -211,7 +221,9 @@ export class PerspectiveViewAnnotationPointListLayer extends PerspectiveViewRend
this.base.updateMouseState(mouseState, pickedOffset);
}

transformPickedValue(_pickedValue: Uint64, pickedOffset: number) { return pickedOffset; }
transformPickedValue(_pickedValue: Uint64, pickedOffset: number) {
return pickedOffset;
}
}

class SliceViewRenderHelper extends RenderHelper {
Expand All @@ -232,11 +244,15 @@ export class SliceViewAnnotationPointListLayer extends SliceViewPanelRenderLayer
constructor(public base: AnnotationPointListLayer) {
super();
this.registerDisposer(base);
this.registerDisposer(base.redrawNeeded.add(() => { this.redrawNeeded.dispatch(); }));
this.registerDisposer(base.redrawNeeded.add(() => {
this.redrawNeeded.dispatch();
}));
this.setReady(true);
}

get gl() { return this.base.chunkManager.gl; }
get gl() {
return this.base.chunkManager.gl;
}

draw(renderContext: SliceViewPanelRenderContext) {
this.renderHelper.draw(this, this.base, renderContext);
Expand All @@ -246,5 +262,7 @@ export class SliceViewAnnotationPointListLayer extends SliceViewPanelRenderLayer
this.base.updateMouseState(mouseState, pickedOffset);
}

transformPickedValue(_pickedValue: Uint64, pickedOffset: number) { return pickedOffset; }
transformPickedValue(_pickedValue: Uint64, pickedOffset: number) {
return pickedOffset;
}
}
6 changes: 4 additions & 2 deletions src/neuroglancer/annotation/point_list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ export class AnnotationPointList {
changed = new NullarySignal();
generation = 0;

get length() { return this.points.length / 3; }
get length() {
return this.points.length / 3;
}

delete (index: number) {
delete(index: number) {
this.points.eraseRange(index * 3, index * 3 + 3);
++this.generation;
this.changed.dispatch();
Expand Down
9 changes: 6 additions & 3 deletions src/neuroglancer/annotation/user_layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ export class AnnotationPointListUserLayer extends UserLayer {
constructor(public manager: LayerListSpecification, x: any) {
super([]);
this.layer.pointList.restoreState(x['points']);
this.registerDisposer(
this.layer.pointList.changed.add(() => { this.specificationChanged.dispatch(); }));
this.registerDisposer(this.layer.pointList.changed.add(() => {
this.specificationChanged.dispatch();
}));
this.addRenderLayer(new PerspectiveViewAnnotationPointListLayer(this.layer));
this.addRenderLayer(new SliceViewAnnotationPointListLayer(this.layer));
const {layerSelectedValues} = manager;
Expand Down Expand Up @@ -65,7 +66,9 @@ export class AnnotationPointListUserLayer extends UserLayer {
}
}

makeDropdown(element: HTMLDivElement) { return new Dropdown(element, this); }
makeDropdown(element: HTMLDivElement) {
return new Dropdown(element, this);
}
}

class Dropdown extends UserLayerDropdown {
Expand Down
2 changes: 1 addition & 1 deletion src/neuroglancer/axes_lines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ export class AxesLineHelper extends RefCounted {
gl.disableVertexAttribArray(aVertexPosition);
gl.disableVertexAttribArray(aColor);
}
};
}
51 changes: 34 additions & 17 deletions src/neuroglancer/chunk_manager/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

import {AvailableCapacity, CHUNK_MANAGER_RPC_ID, CHUNK_QUEUE_MANAGER_RPC_ID, ChunkPriorityTier, ChunkSourceParametersConstructor, ChunkState} from 'neuroglancer/chunk_manager/base';
import {CancellationToken, CancellationTokenSource} from 'neuroglancer/util/cancellation';
import {Disposable} from 'neuroglancer/util/disposable';
import {LinkedListOperations} from 'neuroglancer/util/linked_list';
import LinkedList0 from 'neuroglancer/util/linked_list.0';
Expand All @@ -23,7 +24,6 @@ import {StringMemoize} from 'neuroglancer/util/memoize';
import {ComparisonFunction, PairingHeapOperations} from 'neuroglancer/util/pairing_heap';
import PairingHeap0 from 'neuroglancer/util/pairing_heap.0';
import PairingHeap1 from 'neuroglancer/util/pairing_heap.1';
import {CancellationTokenSource, CancellationToken} from 'neuroglancer/util/cancellation';
import {NullarySignal} from 'neuroglancer/util/signal';
import {initializeSharedObjectCounterpart, registerSharedObject, RPC, SharedObject, SharedObjectCounterpart} from 'neuroglancer/worker_rpc';

Expand Down Expand Up @@ -102,16 +102,22 @@ export class Chunk implements Disposable {
this.error = null;
}

get chunkManager() { return (<ChunkSource>this.source).chunkManager; }
get chunkManager() {
return (<ChunkSource>this.source).chunkManager;
}

get queueManager() { return (<ChunkSource>this.source).chunkManager.queueManager; }
get queueManager() {
return (<ChunkSource>this.source).chunkManager.queueManager;
}

downloadFailed(error: any) {
this.error = error;
this.queueManager.updateChunkState(this, ChunkState.FAILED);
}

downloadSucceeded() { this.queueManager.updateChunkState(this, ChunkState.SYSTEM_MEMORY_WORKER); }
downloadSucceeded() {
this.queueManager.updateChunkState(this, ChunkState.SYSTEM_MEMORY_WORKER);
}

freeSystemMemory() {}

Expand All @@ -121,15 +127,21 @@ export class Chunk implements Disposable {
msg['new'] = true;
}

toString() { return this.key; }
toString() {
return this.key;
}

static priorityLess(a: Chunk, b: Chunk) { return a.priority < b.priority; };
static priorityLess(a: Chunk, b: Chunk) {
return a.priority < b.priority;
}

static priorityGreater(a: Chunk, b: Chunk) { return a.priority > b.priority; }
};
static priorityGreater(a: Chunk, b: Chunk) {
return a.priority > b.priority;
}
}

interface ChunkConstructor<T extends Chunk> {
new (): T;
new(): T;
}

/**
Expand All @@ -141,7 +153,9 @@ export abstract class ChunkSourceBase extends SharedObject {
chunks: Map<string, Chunk> = new Map<string, Chunk>();
freeChunks: Chunk[] = new Array<Chunk>();

constructor(public chunkManager: ChunkManager) { super(); }
constructor(public chunkManager: ChunkManager) {
super();
}

getNewChunk_<T extends Chunk>(chunkType: ChunkConstructor<T>): T {
let freeChunks = this.freeChunks;
Expand Down Expand Up @@ -312,7 +326,7 @@ class ChunkPriorityQueue {
* Deletes a chunk from this priority queue.
* @param chunk The chunk to delete from the priority queue.
*/
delete (chunk: Chunk) {
delete(chunk: Chunk) {
let priorityTier = chunk.priorityTier;
if (priorityTier === ChunkPriorityTier.RECENT) {
this.linkedListOperations.pop(chunk);
Expand All @@ -321,7 +335,7 @@ class ChunkPriorityQueue {
heapRoots[priorityTier] = this.heapOperations.remove(<Chunk>heapRoots[priorityTier], chunk);
}
}
};
}

function makeChunkPriorityQueue0(compare: ComparisonFunction<Chunk>) {
return new ChunkPriorityQueue(new PairingHeap0(compare), LinkedList0);
Expand Down Expand Up @@ -488,7 +502,8 @@ export class ChunkQueueManager extends SharedObjectCounterpart {
}
if (DEBUG_CHUNK_UPDATES) {
console.log(
`${chunk}: changed priority ${chunk.priorityTier}:${chunk.priority} -> ${chunk.newPriorityTier}:${chunk.newPriority}`);
`${chunk}: changed priority ${chunk.priorityTier}:` +
`${chunk.priority} -> ${chunk.newPriorityTier}:${chunk.newPriority}`);
}
this.removeChunkFromQueues_(chunk);
chunk.updatePriorityProperties();
Expand Down Expand Up @@ -635,10 +650,12 @@ export class ChunkQueueManager extends SharedObjectCounterpart {
logStatistics() {
if (DEBUG_CHUNK_UPDATES) {
console.log(
`[Chunk status] QUEUED: ${this.numQueued}, FAILED: ${this.numFailed}, DOWNLOAD: ${this.downloadCapacity}, MEM: ${this.systemMemoryCapacity}, GPU: ${this.gpuMemoryCapacity}`);
`[Chunk status] QUEUED: ${this.numQueued}, FAILED: ` +
`${this.numFailed}, DOWNLOAD: ${this.downloadCapacity}, ` +
`MEM: ${this.systemMemoryCapacity}, GPU: ${this.gpuMemoryCapacity}`);
}
}
};
}

/*
* Priority to use for handlers add to recomputeChunkPriorities that should execute last, because
Expand Down Expand Up @@ -696,7 +713,7 @@ export class ChunkManager extends SharedObjectCounterpart {
this.recomputeChunkPriorities.dispatch();
this.recomputeChunkPrioritiesLate.dispatch();
this.updateQueueState([ChunkPriorityTier.VISIBLE]);
};
}

/**
* @param chunk
Expand Down Expand Up @@ -740,7 +757,7 @@ export class ChunkManager extends SharedObjectCounterpart {
newTierChunks.length = 0;
this.queueManager.scheduleUpdate();
}
};
}

/**
* Decorates final subclasses of ChunkSource.
Expand Down
15 changes: 10 additions & 5 deletions src/neuroglancer/chunk_manager/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,26 @@ export class AvailableCapacity {
}

toString() {
return `${this.availableItems}/${this.itemCapacity} items, ${this.availableSize}/${this.sizeCapacity} size`;
return `${this.availableItems}/${this.itemCapacity} items, ` +
`${this.availableSize}/${this.sizeCapacity} size`;
}

toObject() { return {'itemCapacity': this.itemCapacity, 'sizeCapacity': this.sizeCapacity}; }
toObject() {
return {'itemCapacity': this.itemCapacity, 'sizeCapacity': this.sizeCapacity};
}

static fromObject(x: any) { return new AvailableCapacity(x['itemCapacity'], x['sizeCapacity']); }
static fromObject(x: any) {
return new AvailableCapacity(x['itemCapacity'], x['sizeCapacity']);
}

static INFINITE = new AvailableCapacity(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY);
};
}

export const CHUNK_QUEUE_MANAGER_RPC_ID = 'ChunkQueueManager';
export const CHUNK_MANAGER_RPC_ID = 'ChunkManager';

export interface ChunkSourceParametersConstructor<T> {
new (): T;
new(): T;
RPC_ID: string;
stringify: (parameters: T) => string;
}
Loading

0 comments on commit da2fdec

Please sign in to comment.