Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1900)

Issue 312743002: Use 'Directory.watch' on Windows in pkg/watcher, instead of pooling. (Closed)

Created:
6 years, 6 months ago by Anders Johnsen
Modified:
6 years, 6 months ago
CC:
reviews_dartlang.org, Bob Nystrom
Visibility:
Public.

Description

Use 'Directory.watch' on Windows in pkg/watcher, instead of pooling. This is a close copy of MacOS, except for the special handling on mac, and the extra watcher on Windows for detecting if the watched folder is deleted. BUG=https://code.google.com/p/dart/issues/detail?id=14428,https://code.google.com/p/dart/issues/detail?id=18108,http://code.google.com/p/dart/issues/detail?id=19189 R=kasperl@google.com, sgjesse@google.com Committed: https://code.google.com/p/dart/source/detail?r=36988

Patch Set 1 #

Patch Set 2 : Fix test. #

Patch Set 3 : #

Total comments: 24

Patch Set 4 : Review updates #

Total comments: 10

Patch Set 5 : Cleanup #

Total comments: 16

Patch Set 6 : Fixes #

Total comments: 34
Unified diffs Side-by-side diffs Delta from patch set Stats (+497 lines, -507 lines) Patch
M pkg/analysis_server/test/physical_resource_provider_test.dart View 1 2 3 4 5 1 chunk +2 lines, -4 lines 2 comments Download
M pkg/pkg.status View 1 chunk +3 lines, -0 lines 0 comments Download
M pkg/watcher/lib/src/directory_watcher.dart View 2 chunks +2 lines, -0 lines 0 comments Download
A + pkg/watcher/lib/src/directory_watcher/windows.dart View 1 2 3 4 5 1 chunk +419 lines, -497 lines 26 comments Download
A pkg/watcher/test/directory_watcher/windows_test.dart View 1 2 3 4 5 1 chunk +41 lines, -0 lines 4 comments Download
M pkg/watcher/test/utils.dart View 1 2 3 1 chunk +5 lines, -0 lines 0 comments Download
M runtime/bin/eventhandler_win.h View 1 2 3 4 5 5 chunks +6 lines, -4 lines 0 comments Download
M runtime/bin/eventhandler_win.cc View 1 2 3 4 5 1 chunk +15 lines, -0 lines 2 comments Download
M runtime/bin/file_patch.dart View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M runtime/bin/file_system_watcher_win.cc View 1 2 3 4 5 1 chunk +3 lines, -1 line 0 comments Download

Messages

Total messages: 18 (0 generated)
Anders Johnsen
6 years, 6 months ago (2014-06-03 11:06:49 UTC) #1
kasperl
LGTM, but it would be great if you could get Søren to review it too. ...
6 years, 6 months ago (2014-06-03 11:28:09 UTC) #2
Anders Johnsen
Comments addressed. Waiting for sgjesse@'s comments. https://codereview.chromium.org/312743002/diff/40001/pkg/watcher/lib/src/directory_watcher/windows.dart File pkg/watcher/lib/src/directory_watcher/windows.dart (right): https://codereview.chromium.org/312743002/diff/40001/pkg/watcher/lib/src/directory_watcher/windows.dart#newcode85 pkg/watcher/lib/src/directory_watcher/windows.dart:85: Chain.track(new Directory(parent).watch(recursive: false)) ...
6 years, 6 months ago (2014-06-03 11:44:14 UTC) #3
kasperl
Still LGTM. https://codereview.chromium.org/312743002/diff/60001/pkg/watcher/lib/src/directory_watcher/windows.dart File pkg/watcher/lib/src/directory_watcher/windows.dart (right): https://codereview.chromium.org/312743002/diff/60001/pkg/watcher/lib/src/directory_watcher/windows.dart#newcode80 pkg/watcher/lib/src/directory_watcher/windows.dart:80: void _startParentWatcher() { Add a comment that ...
6 years, 6 months ago (2014-06-03 13:08:10 UTC) #4
Anders Johnsen
https://codereview.chromium.org/312743002/diff/60001/pkg/watcher/lib/src/directory_watcher/windows.dart File pkg/watcher/lib/src/directory_watcher/windows.dart (right): https://codereview.chromium.org/312743002/diff/60001/pkg/watcher/lib/src/directory_watcher/windows.dart#newcode80 pkg/watcher/lib/src/directory_watcher/windows.dart:80: void _startParentWatcher() { On 2014/06/03 13:08:10, kasperl wrote: > ...
6 years, 6 months ago (2014-06-03 13:41:56 UTC) #5
Søren Gjesse
https://codereview.chromium.org/312743002/diff/40001/pkg/analysis_server/test/physical_resource_provider_test.dart File pkg/analysis_server/test/physical_resource_provider_test.dart (right): https://codereview.chromium.org/312743002/diff/40001/pkg/analysis_server/test/physical_resource_provider_test.dart#newcode35 pkg/analysis_server/test/physical_resource_provider_test.dart:35: return new Future.delayed(new Duration(milliseconds: 100), computation); Long line. https://codereview.chromium.org/312743002/diff/40001/pkg/watcher/lib/src/directory_watcher.dart ...
6 years, 6 months ago (2014-06-03 14:14:53 UTC) #6
Søren Gjesse
And lgtm
6 years, 6 months ago (2014-06-03 14:15:56 UTC) #7
Bob Nystrom
Some feedback, but I'm super excited about this. Thank you! https://codereview.chromium.org/312743002/diff/80001/pkg/watcher/lib/src/directory_watcher/windows.dart File pkg/watcher/lib/src/directory_watcher/windows.dart (right): https://codereview.chromium.org/312743002/diff/80001/pkg/watcher/lib/src/directory_watcher/windows.dart#newcode3 ...
6 years, 6 months ago (2014-06-03 17:37:00 UTC) #8
Anders Johnsen
PTAL all, after doing a lot of stress-testing, I was able to fix a lot ...
6 years, 6 months ago (2014-06-04 08:46:47 UTC) #9
Søren Gjesse
lgtm https://codereview.chromium.org/312743002/diff/100001/pkg/watcher/test/directory_watcher/windows_test.dart File pkg/watcher/test/directory_watcher/windows_test.dart (right): https://codereview.chromium.org/312743002/diff/100001/pkg/watcher/test/directory_watcher/windows_test.dart#newcode33 pkg/watcher/test/directory_watcher/windows_test.dart:33: renameDir("dir", "moved_dir"); I assume that the sandbox takes ...
6 years, 6 months ago (2014-06-04 10:04:52 UTC) #10
kasperl
Still LGTM.
6 years, 6 months ago (2014-06-04 10:10:33 UTC) #11
Anders Johnsen
https://codereview.chromium.org/312743002/diff/100001/pkg/watcher/test/directory_watcher/windows_test.dart File pkg/watcher/test/directory_watcher/windows_test.dart (right): https://codereview.chromium.org/312743002/diff/100001/pkg/watcher/test/directory_watcher/windows_test.dart#newcode33 pkg/watcher/test/directory_watcher/windows_test.dart:33: renameDir("dir", "moved_dir"); On 2014/06/04 10:04:52, Søren Gjesse wrote: > ...
6 years, 6 months ago (2014-06-04 10:15:53 UTC) #12
Anders Johnsen
Committed patchset #6 manually as r36988 (presubmit successful).
6 years, 6 months ago (2014-06-04 10:24:11 UTC) #13
Bob Nystrom
https://codereview.chromium.org/312743002/diff/100001/pkg/analysis_server/test/physical_resource_provider_test.dart File pkg/analysis_server/test/physical_resource_provider_test.dart (right): https://codereview.chromium.org/312743002/diff/100001/pkg/analysis_server/test/physical_resource_provider_test.dart#newcode34 pkg/analysis_server/test/physical_resource_provider_test.dart:34: Future delayed(computation()) { Is this delay still needed? If ...
6 years, 6 months ago (2014-06-04 15:48:29 UTC) #14
nweiz
Please wait until you get an LGTM from either Bob or myself before you commit ...
6 years, 6 months ago (2014-06-04 18:14:01 UTC) #15
kasperl
On 2014/06/04 18:14:01, nweiz wrote: > Please wait until you get an LGTM from either ...
6 years, 6 months ago (2014-06-04 18:24:17 UTC) #16
nweiz
On 2014/06/04 18:24:17, kasperl wrote: > On 2014/06/04 18:14:01, nweiz wrote: > > Please wait ...
6 years, 6 months ago (2014-06-04 18:26:24 UTC) #17
Anders Johnsen
6 years, 6 months ago (2014-06-10 06:47:15 UTC) #18
Message was sent while issue was closed.
Addressed in followup.

https://codereview.chromium.org/312743002/diff/100001/pkg/analysis_server/tes...
File pkg/analysis_server/test/physical_resource_provider_test.dart (right):

https://codereview.chromium.org/312743002/diff/100001/pkg/analysis_server/tes...
pkg/analysis_server/test/physical_resource_provider_test.dart:34: Future
delayed(computation()) {
On 2014/06/04 15:48:29, Bob Nystrom wrote:
> Is this delay still needed? If so, leave a brief comment explaining why.

Done.

https://codereview.chromium.org/312743002/diff/100001/pkg/watcher/lib/src/dir...
File pkg/watcher/lib/src/directory_watcher/windows.dart (right):

https://codereview.chromium.org/312743002/diff/100001/pkg/watcher/lib/src/dir...
pkg/watcher/lib/src/directory_watcher/windows.dart:40: }
On 2014/06/04 15:48:29, Bob Nystrom wrote:
> Let's combine these two methods. You never want to add an event without
> starting/resetting the timer.

Done.

https://codereview.chromium.org/312743002/diff/100001/pkg/watcher/lib/src/dir...
pkg/watcher/lib/src/directory_watcher/windows.dart:81: /// The subscriptions to
the [Directory.list] call for listing the contents of
On 2014/06/04 15:48:29, Bob Nystrom wrote:
> "call" -> "calls".

Done.

https://codereview.chromium.org/312743002/diff/100001/pkg/watcher/lib/src/dir...
pkg/watcher/lib/src/directory_watcher/windows.dart:82: /// subdirectories that
was moved into the watched directory.
On 2014/06/04 15:48:29, Bob Nystrom wrote:
> "was" -> "were".

Done.

https://codereview.chromium.org/312743002/diff/100001/pkg/watcher/lib/src/dir...
pkg/watcher/lib/src/directory_watcher/windows.dart:113: /// On Windows, if
[directory] is deleted, we will not receive any event.
On 2014/06/04 15:48:29, Bob Nystrom wrote:
> Blank "///" line after this.

Done.

https://codereview.chromium.org/312743002/diff/100001/pkg/watcher/lib/src/dir...
pkg/watcher/lib/src/directory_watcher/windows.dart:116: /// This also includes
events such as moves.
On 2014/06/04 15:48:29, Bob Nystrom wrote:
> This can be part of the previous paragraph.

Done.

https://codereview.chromium.org/312743002/diff/100001/pkg/watcher/lib/src/dir...
pkg/watcher/lib/src/directory_watcher/windows.dart:120: // Check if we
[directory] is already the root directory.
On 2014/06/04 15:48:29, Bob Nystrom wrote:
> Remove "we".

Done.

https://codereview.chromium.org/312743002/diff/100001/pkg/watcher/lib/src/dir...
pkg/watcher/lib/src/directory_watcher/windows.dart:136: for (var path in
_files.toSet()) {
On 2014/06/04 15:48:29, Bob Nystrom wrote:
> The .toSet() call here could be expensive. Is it needed?

This is needed for some reason.

https://codereview.chromium.org/312743002/diff/100001/pkg/watcher/lib/src/dir...
pkg/watcher/lib/src/directory_watcher/windows.dart:143: // Ignore errors, simply
close the stream.
On 2014/06/04 15:48:29, Bob Nystrom wrote:
> You answered in the code review, but can you leave a comment here explaining
why
> the error can be ignored?

Done.

https://codereview.chromium.org/312743002/diff/100001/pkg/watcher/lib/src/dir...
pkg/watcher/lib/src/directory_watcher/windows.dart:151: // ignore those events
and re-list the directory.
On 2014/06/04 15:48:29, Bob Nystrom wrote:
> Why not just defer calling _startWatch() until after the listing is done?

Done.

https://codereview.chromium.org/312743002/diff/100001/pkg/watcher/lib/src/dir...
pkg/watcher/lib/src/directory_watcher/windows.dart:159: _EventBatcher batcher =
_eventBatchers.putIfAbsent(
On 2014/06/04 15:48:29, Bob Nystrom wrote:
> Use var here.

Done.

https://codereview.chromium.org/312743002/diff/100001/pkg/watcher/lib/src/dir...
pkg/watcher/lib/src/directory_watcher/windows.dart:249: FileSystemMoveEvent
moveEvent = event;
On 2014/06/04 15:48:29, Bob Nystrom wrote:
> Ditch this line.

Done.

https://codereview.chromium.org/312743002/diff/100001/pkg/watcher/lib/src/dir...
pkg/watcher/lib/src/directory_watcher/windows.dart:369: // Emit remove-events
for any remaining files.
On 2014/06/04 15:48:29, Bob Nystrom wrote:
> Remove the "-".

Done.

https://codereview.chromium.org/312743002/diff/100001/pkg/watcher/lib/src/dir...
pkg/watcher/lib/src/directory_watcher/windows.dart:379: // Batch the events
changes together so that we can dedup events.
On 2014/06/04 15:48:29, Bob Nystrom wrote:
> Remove "changes".

Done.

https://codereview.chromium.org/312743002/diff/100001/pkg/watcher/test/direct...
File pkg/watcher/test/directory_watcher/windows_test.dart (right):

https://codereview.chromium.org/312743002/diff/100001/pkg/watcher/test/direct...
pkg/watcher/test/directory_watcher/windows_test.dart:27: test('when the watched
directory is moved, removes all files', () {
On 2014/06/04 15:48:29, Bob Nystrom wrote:
> Huh, I'm surprised we aren't already testing this on all platforms. I see we
> have a delete test for this, but not move.
> 
> Move this to shared.dart.

Done.

Powered by Google App Engine
This is Rietveld 408576698