Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perfomance: allow to set the onUpdateUI timeout using a hidden pref (… #2589

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions src/chrome/komodo/content/bindings/views-buffer.p.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,22 @@
<binding id="view-buffer-base"
extends="chrome://komodo/content/bindings/views.xml#view-base">
<implementation name="viewbufferbase" implements="koIScintillaView, ISciMozEvents, nsIObserver">


<field name="_onUpdateUI_timeout">null</field>

<field name="__prefs">null</field>

<property name="onUpdateUI_timeout">
<getter>
<![CDATA[
if (!this._onUpdateUI_timeout) {
this._onUpdateUI_timeout = this.__prefs.getLong('onUpdateUI_timeout', 200);
}
return this._onUpdateUI_timeout;
]]>
</getter>
</property>

<constructor>
<![CDATA[
// A list of registered handlers that can handle the onModified event.
Expand All @@ -96,6 +111,13 @@
Components.interfaces.ISciMoz.SC_MOD_INSERTTEXT |
Components.interfaces.ISciMoz.SC_MOD_DELETETEXT);
this.addModifiedHandler(this._onModifiedHandler, this, 1000, wantedflags);
this.__prefs = require('ko/prefs');
let observer = {
observe: (subject, topic, data) => {
this._onUpdateUI_timeout = this.__prefs.getLong(topic, 200);
}
}
this.__prefs.prefObserverService.addObserver(observer, 'onUpdateUI_timeout', false);
]]>
</constructor>

Expand All @@ -115,8 +137,6 @@
<!-- Whether the buffer/editor sends DOM events. -->
<field name="_dispatch_events">false</field>

<field name="__prefs">null</field>

<property name="prefs">
<getter><![CDATA[
// Buffers don't have their own file prefs - so they use global
Expand Down Expand Up @@ -1200,7 +1220,7 @@
clearTimeout(this._uiTimer);
}

this._uiTimer = setTimeout(this._onUpdateUI_debounced.bind(this, updated), 200);
this._uiTimer = setTimeout(this._onUpdateUI_debounced.bind(this, updated), this.onUpdateUI_timeout);
]]>
</body>
</method>
Expand Down