Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 30 matching lines...) Expand all Loading... | |
| 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 | 45 |
| 46 handle_ = FindFirstChangeNotification( | 46 handle_ = FindFirstChangeNotification( |
| 47 path.value().c_str(), | 47 path.value().c_str(), |
| 48 FALSE, // Don't watch subtree. | 48 FALSE, // Don't watch subtree. |
| 49 FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_SIZE | | 49 FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_SIZE | |
| 50 FILE_NOTIFY_CHANGE_LAST_WRITE); | 50 FILE_NOTIFY_CHANGE_LAST_WRITE); |
| 51 if (handle_ == INVALID_HANDLE_VALUE) { | 51 if (handle_ == INVALID_HANDLE_VALUE) { |
|
Evan Martin
2009/01/07 18:47:57
can remove the curlies now if you care
| |
| 52 NOTREACHED(); | |
| 53 return false; | 52 return false; |
| 54 } | 53 } |
| 55 | 54 |
| 56 path_ = path; | 55 path_ = path; |
| 57 watcher_.StartWatching(handle_, this); | 56 watcher_.StartWatching(handle_, this); |
| 58 | 57 |
| 59 return true; | 58 return true; |
| 60 } | 59 } |
| 61 | 60 |
| 62 void DirectoryWatcher::Impl::OnObjectSignaled(HANDLE object) { | 61 void DirectoryWatcher::Impl::OnObjectSignaled(HANDLE object) { |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 77 | 76 |
| 78 DirectoryWatcher::~DirectoryWatcher() { | 77 DirectoryWatcher::~DirectoryWatcher() { |
| 79 // Declared in .cc file for access to ~DirectoryWatcher::Impl. | 78 // Declared in .cc file for access to ~DirectoryWatcher::Impl. |
| 80 } | 79 } |
| 81 | 80 |
| 82 bool DirectoryWatcher::Watch(const FilePath& path, | 81 bool DirectoryWatcher::Watch(const FilePath& path, |
| 83 Delegate* delegate) { | 82 Delegate* delegate) { |
| 84 impl_ = new DirectoryWatcher::Impl(delegate); | 83 impl_ = new DirectoryWatcher::Impl(delegate); |
| 85 return impl_->Watch(path); | 84 return impl_->Watch(path); |
| 86 } | 85 } |
| OLD | NEW |