Allow async recursion for syntax on zeroth diff section
The logic inside the syntax layer that decides whether the next step of the processing is done synchronously or after a timeout would not choose to use a timeout if it is processing the zeroth section of the diff. For diffs with very large initial shared chunks (for example a chunk of more than 20,000 lines as linked in the bug) this results in the syntax layer processing the entire chunk using synchronous recursion. As a result, the (1) UI would lock up while processing the syntax for this chunk, and (2) when rendering all diffs on the change, the call stack would be exceeded. With this change, the syntax layer allows asynchrony when processing the zeroth chunk of the diff. Bug: Issue 5654 Change-Id: I0e60479b2c59c9c626199e7a6b8d63ccb55ebaa7
This commit is contained in:
		@@ -210,7 +210,7 @@
 | 
			
		||||
              return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (state.sectionIndex !== 0 && state.lineIndex % 100 === 0) {
 | 
			
		||||
            if (state.lineIndex % 100 === 0) {
 | 
			
		||||
              this._notify(state);
 | 
			
		||||
              this._processHandle = this.async(nextStep, ASYNC_DELAY);
 | 
			
		||||
            } else {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user