Index: content/common/file_path_watcher/file_path_watcher.cc |
diff --git a/content/common/file_path_watcher/file_path_watcher.cc b/content/common/file_path_watcher/file_path_watcher.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..19cee5fdea6995a65983945e6bdfbf3c85ca96d3 |
--- /dev/null |
+++ b/content/common/file_path_watcher/file_path_watcher.cc |
@@ -0,0 +1,39 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+// Cross platform methods for FilePathWatcher. See the various platform |
+// specific implementation files, too. |
+ |
+#include "content/common/file_path_watcher/file_path_watcher.h" |
+ |
+#include "base/logging.h" |
+#include "base/message_loop.h" |
+ |
+FilePathWatcher::~FilePathWatcher() { |
+ impl_->Cancel(); |
+} |
+ |
+bool FilePathWatcher::Watch(const FilePath& path, |
+ Delegate* delegate, |
+ base::MessageLoopProxy* loop) { |
+ DCHECK(path.IsAbsolute()); |
+ return impl_->Watch(path, delegate, loop); |
+} |
+ |
+FilePathWatcher::PlatformDelegate::PlatformDelegate() { |
+} |
+ |
+FilePathWatcher::PlatformDelegate::~PlatformDelegate() { |
+} |
+ |
+void FilePathWatcher::DeletePlatformDelegate::Destruct( |
+ const PlatformDelegate* delegate) { |
+ scoped_refptr<base::MessageLoopProxy> loop = delegate->message_loop(); |
+ if (loop.get() == NULL || loop->BelongsToCurrentThread()) { |
+ delete delegate; |
+ } else { |
+ loop->PostNonNestableTask(FROM_HERE, |
+ new DeleteTask<PlatformDelegate>(delegate)); |
+ } |
+} |