Chromium Code Reviews
DescriptionDiscard previous overlay content on _sourceChanged() notification.
This fixes the following scenario:
1. Edit a file.
Server adds overlay.
2. Save a file.
Editor save the file buffer to disk.
Editor asks to remove the overlay.
Server remove the overlay.
Engine checks that the previous overlay content is the same as the file content and remembers this content in the LRU cache.
3. Server receives a file system modification event.
Engine starts processing the change and ignores it in _sourceChanged() because the previous overlay content is the save.
But it keeps this content in the cache!
4. User switches to another branche, so the file is change.
Server receives a file system modification event.
Engine sees that the content of the file is not the same as the content in the previous overlay and performs full analysis.
5. User switches back to the original branch.
Server receives a file system modification event.
Engine in _sourceChanged() ignore the change, because it is the same as it was before!
So, we need to clear the previous overlay cache once we use it.
Therefore we can just put it into the SourceEntry itself.
This also simplifies the cache management - we don't need another way to remove elements on change, or a file removal.
The only situation when we might keep content longer than required is in the following scenario:
1. User makes a change, adds an overlay.
2. User makes a change that restores initial content.
3. Editor asks the server to remove the overlay.
Practially however Editor keep the file dirty in this case.
So, user will save the file eventully and we will remove the cached previous content from the entry.
R=brianwilkerson@google.com
BUG=
Committed: https://code.google.com/p/dart/source/detail?r=44116
Patch Set 1 #
Messages
Total messages: 3 (0 generated)
|
|||||||||||||||||||