Skip to content

Commit

Permalink
Merge pull request #6345 from afshin/clean-coreutils
Browse files Browse the repository at this point in the history
Clean coreutils package, add rate limiting utilities.
  • Loading branch information
blink1073 committed May 23, 2019
2 parents ce4c47a + b58d381 commit 2834c11
Show file tree
Hide file tree
Showing 21 changed files with 783 additions and 837 deletions.
6 changes: 5 additions & 1 deletion examples/chrome-example-test.js
Expand Up @@ -10,7 +10,11 @@ const URL = process.argv[2];
async function main() {
console.info('Starting Chrome Headless');

const browser = await puppeteer.launch({ args: ['--no-sandbox'] });
// Disable shm usage to save resources and prevent random memory
// errors seen on CI
const browser = await puppeteer.launch({
args: ['--no-sandbox', '--disable-dev-shm-usage']
});
const page = await browser.newPage();

console.info('Navigating to page:', URL);
Expand Down
2 changes: 1 addition & 1 deletion examples/filebrowser/webpack.config.js
Expand Up @@ -5,7 +5,7 @@ module.exports = {
filename: 'bundle.js'
},
bail: true,
devtool: 'cheap-source-map',
devtool: 'source-map',
mode: 'production',
module: {
rules: [
Expand Down
28 changes: 17 additions & 11 deletions packages/application/src/shell.ts
@@ -1,6 +1,8 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

import { Debouncer } from '@jupyterlab/coreutils';

import { DocumentRegistry } from '@jupyterlab/docregistry';

import { ArrayExt, find, IIterator, iter, toArray } from '@phosphor/algorithm';
Expand Down Expand Up @@ -539,6 +541,17 @@ export class LabShell extends Widget implements JupyterFrontEnd.IShell {
this._onLayoutModified();
}

/**
* Dispose the shell.
*/
dispose(): void {
if (this.isDisposed) {
return;
}
this._layoutDebouncer.dispose();
super.dispose();
}

/**
* Expand the left area.
*
Expand Down Expand Up @@ -923,16 +936,7 @@ export class LabShell extends Widget implements JupyterFrontEnd.IShell {
* Handle a change to the layout.
*/
private _onLayoutModified(): void {
// The dock can emit layout modified signals while in transient
// states (for instance, when switching from single-document to
// multiple-document mode). In those states, it can be unreliable
// for the signal consumers to query layout properties.
// We fix this by debouncing the layout modified signal so that it
// is only emitted after rearranging is done.
window.clearTimeout(this._debouncer);
this._debouncer = window.setTimeout(() => {
this._layoutModified.emit(undefined);
}, 0);
void this._layoutDebouncer.invoke();
}

/**
Expand Down Expand Up @@ -963,14 +967,16 @@ export class LabShell extends Widget implements JupyterFrontEnd.IShell {
private _dockPanel: DockPanel;
private _isRestored = false;
private _layoutModified = new Signal<this, void>(this);
private _layoutDebouncer = new Debouncer(() => {
this._layoutModified.emit(undefined);
}, 0);
private _leftHandler: Private.SideBarHandler;
private _restored = new PromiseDelegate<ILabShell.ILayout>();
private _rightHandler: Private.SideBarHandler;
private _tracker = new FocusTracker<Widget>();
private _headerPanel: Panel;
private _topPanel: Panel;
private _bottomPanel: Panel;
private _debouncer = 0;
private _mainOptionsCache = new Map<Widget, DocumentRegistry.IOpenOptions>();
private _sideOptionsCache = new Map<Widget, DocumentRegistry.IOpenOptions>();
}
Expand Down

0 comments on commit 2834c11

Please sign in to comment.