summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
inline | side by side (from parent 1:
67c40cf)
JavaScript is single-threaded, so there is no need for protection
against re-entrancy via inProgress variable.
In particular calls to setInterval handler are stacked if handler
doesn't finish before new interrupt (before new interval). The same
happens with events - they are (hopefully) stacked if even handler
didn't finish work.
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
-var inProgress = false; // are we processing response
-
*
* @param {XMLHttpRequest} xhr: XMLHttpRequest object
*
*
* @param {XMLHttpRequest} xhr: XMLHttpRequest object
*
- * @globals pollTimer, commits, inProgress
+ * @globals pollTimer, commits
*/
function handleError(xhr) {
errorInfo('Server error: ' +
*/
function handleError(xhr) {
errorInfo('Server error: ' +
clearInterval(pollTimer);
commits = {}; // free memory
clearInterval(pollTimer);
commits = {}; // free memory
*
* @param {XMLHttpRequest} xhr: XMLHttpRequest object (unused)
*
*
* @param {XMLHttpRequest} xhr: XMLHttpRequest object (unused)
*
- * @globals pollTimer, commits, inProgress
+ * @globals pollTimer, commits
*/
function responseLoaded(xhr) {
clearInterval(pollTimer);
*/
function responseLoaded(xhr) {
clearInterval(pollTimer);
fixColorsAndGroups();
writeTimeInterval();
commits = {}; // free memory
fixColorsAndGroups();
writeTimeInterval();
commits = {}; // free memory
}
/**
* handler for XMLHttpRequest onreadystatechange event
* @see startBlame
*
}
/**
* handler for XMLHttpRequest onreadystatechange event
* @see startBlame
*
- * @globals xhr, inProgress
*/
function handleResponse() {
*/
function handleResponse() {
- // in case we were called before finished processing
- if (inProgress) {
- return;
- } else {
- inProgress = true;
- }
-
// extract new whole (complete) lines, and process them
while (xhr.prevDataLength !== xhr.responseText.length) {
if (xhr.readyState === 4 &&
// extract new whole (complete) lines, and process them
while (xhr.prevDataLength !== xhr.responseText.length) {
if (xhr.readyState === 4 &&
xhr.prevDataLength === xhr.responseText.length) {
responseLoaded(xhr);
}
xhr.prevDataLength === xhr.responseText.length) {
responseLoaded(xhr);
}
}
// ============================================================
}
// ============================================================