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

Side by Side Diff: base/directory_watcher_win.cc

Issue 13255: Properly fix DirWatcherTest.SubDir on Vista. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/directory_watcher_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/directory_watcher.h" 5 #include "base/directory_watcher.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/object_watcher.h" 8 #include "base/object_watcher.h"
9 9
10 // Private implementation class implementing the behavior of DirectoryWatcher. 10 // Private implementation class implementing the behavior of DirectoryWatcher.
(...skipping 24 matching lines...) Expand all
35 35
36 DirectoryWatcher::Impl::~Impl() { 36 DirectoryWatcher::Impl::~Impl() {
37 if (handle_ != INVALID_HANDLE_VALUE) { 37 if (handle_ != INVALID_HANDLE_VALUE) {
38 watcher_.StopWatching(); 38 watcher_.StopWatching();
39 FindCloseChangeNotification(handle_); 39 FindCloseChangeNotification(handle_);
40 } 40 }
41 } 41 }
42 42
43 bool DirectoryWatcher::Impl::Watch(const FilePath& path) { 43 bool DirectoryWatcher::Impl::Watch(const FilePath& path) {
44 DCHECK(path_.value().empty()); // Can only watch one path. 44 DCHECK(path_.value().empty()); // Can only watch one path.
45 DCHECK(path.IsAbsolute()); // FindFirstChangeNotification requires it.
45 46
46 handle_ = FindFirstChangeNotification( 47 handle_ = FindFirstChangeNotification(
47 path.value().c_str(), 48 path.value().c_str(),
48 FALSE, // Don't watch subtree. 49 FALSE, // Don't watch subtree.
49 FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_SIZE | 50 FILE_NOTIFY_CHANGE_FILE_NAME |
50 FILE_NOTIFY_CHANGE_LAST_WRITE); 51 FILE_NOTIFY_CHANGE_DIR_NAME |
52 FILE_NOTIFY_CHANGE_SIZE |
53 FILE_NOTIFY_CHANGE_LAST_WRITE);
51 if (handle_ == INVALID_HANDLE_VALUE) { 54 if (handle_ == INVALID_HANDLE_VALUE) {
52 NOTREACHED(); 55 NOTREACHED();
53 return false; 56 return false;
54 } 57 }
55 58
56 path_ = path; 59 path_ = path;
57 watcher_.StartWatching(handle_, this); 60 watcher_.StartWatching(handle_, this);
58 61
59 return true; 62 return true;
60 } 63 }
(...skipping 16 matching lines...) Expand all
77 80
78 DirectoryWatcher::~DirectoryWatcher() { 81 DirectoryWatcher::~DirectoryWatcher() {
79 // Declared in .cc file for access to ~DirectoryWatcher::Impl. 82 // Declared in .cc file for access to ~DirectoryWatcher::Impl.
80 } 83 }
81 84
82 bool DirectoryWatcher::Watch(const FilePath& path, 85 bool DirectoryWatcher::Watch(const FilePath& path,
83 Delegate* delegate) { 86 Delegate* delegate) {
84 impl_ = new DirectoryWatcher::Impl(delegate); 87 impl_ = new DirectoryWatcher::Impl(delegate);
85 return impl_->Watch(path); 88 return impl_->Watch(path);
86 } 89 }
OLDNEW
« no previous file with comments | « base/directory_watcher_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698