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

Unified Diff: chrome/browser/file_watcher_inotify.cc

Issue 864001: Move FileWatcher from src/base/ to src/chrome/browser/ and switch (Closed)
Patch Set: fix tests on mac Created 10 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/file_watcher.h ('k') | chrome/browser/file_watcher_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/file_watcher_inotify.cc
diff --git a/base/file_watcher_inotify.cc b/chrome/browser/file_watcher_inotify.cc
similarity index 96%
rename from base/file_watcher_inotify.cc
rename to chrome/browser/file_watcher_inotify.cc
index 9bc4626e40cb9d93e41ad5ded19ebfb825871dcd..402696461f48fb36b36319ffa518f4cf562f0114 100644
--- a/base/file_watcher_inotify.cc
+++ b/chrome/browser/file_watcher_inotify.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/file_watcher.h"
+#include "chrome/browser/file_watcher.h"
#include <errno.h>
#include <string.h>
@@ -34,6 +34,8 @@ namespace {
class FileWatcherImpl;
// Singleton to manage all inotify watches.
+// TODO(tony): It would be nice if this wasn't a singleton.
+// http://crbug.com/38174
class InotifyReader {
public:
typedef int Watch; // Watch descriptor used by AddWatch and RemoveWatch.
@@ -88,8 +90,7 @@ class FileWatcherImpl : public FileWatcher::PlatformDelegate {
// Start watching |path| for changes and notify |delegate| on each change.
// Returns true if watch for |path| has been added successfully.
- virtual bool Watch(const FilePath& path, FileWatcher::Delegate* delegate,
- MessageLoop* backend_loop);
+ virtual bool Watch(const FilePath& path, FileWatcher::Delegate* delegate);
private:
// Delegate to notify upon changes.
@@ -101,9 +102,6 @@ class FileWatcherImpl : public FileWatcher::PlatformDelegate {
// The file we're watching.
FilePath path_;
- // Loop where we post file change notifications to.
- MessageLoop* loop_;
-
DISALLOW_COPY_AND_ASSIGN(FileWatcherImpl);
};
@@ -294,13 +292,12 @@ void FileWatcherImpl::OnInotifyEvent(const inotify_event* event) {
if (path_ != path_.DirName().Append(event->name))
return;
- loop_->PostTask(FROM_HERE,
+ ChromeThread::PostTask(ChromeThread::FILE, FROM_HERE,
new FileWatcherImplNotifyTask(delegate_, path_));
}
bool FileWatcherImpl::Watch(const FilePath& path,
- FileWatcher::Delegate* delegate,
- MessageLoop* backend_loop) {
+ FileWatcher::Delegate* delegate) {
// Each FileWatcherImpl can only watch one file.
DCHECK(watch_ == InotifyReader::kInvalidWatch);
@@ -311,7 +308,6 @@ bool FileWatcherImpl::Watch(const FilePath& path,
delegate_ = delegate;
path_ = path;
- loop_ = MessageLoop::current();
watch_ = Singleton<InotifyReader>::get()->AddWatch(path.DirName(), this);
return watch_ != InotifyReader::kInvalidWatch;
}
« no previous file with comments | « chrome/browser/file_watcher.h ('k') | chrome/browser/file_watcher_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698