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

Side by Side Diff: base/files/file_path_watcher_linux.cc

Issue 7583053: Add MessageLoopProxy::current (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: No need for MessageLoopProxy destruction observer. Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/files/file_path_watcher_browsertest.cc ('k') | base/files/file_path_watcher_mac.cc » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/files/file_path_watcher.h" 5 #include "base/files/file_path_watcher.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <string.h> 8 #include <string.h>
9 #include <sys/inotify.h> 9 #include <sys/inotify.h>
10 #include <sys/ioctl.h> 10 #include <sys/ioctl.h>
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 (change_on_target_path && file_util::PathExists(target_))) { 363 (change_on_target_path && file_util::PathExists(target_))) {
364 delegate_->OnFilePathChanged(target_); 364 delegate_->OnFilePathChanged(target_);
365 } 365 }
366 } 366 }
367 367
368 bool FilePathWatcherImpl::Watch(const FilePath& path, 368 bool FilePathWatcherImpl::Watch(const FilePath& path,
369 FilePathWatcher::Delegate* delegate) { 369 FilePathWatcher::Delegate* delegate) {
370 DCHECK(target_.empty()); 370 DCHECK(target_.empty());
371 DCHECK(MessageLoopForIO::current()); 371 DCHECK(MessageLoopForIO::current());
372 372
373 set_message_loop(base::MessageLoopProxy::CreateForCurrentThread()); 373 set_message_loop(base::MessageLoopProxy::current());
374 delegate_ = delegate; 374 delegate_ = delegate;
375 target_ = path; 375 target_ = path;
376 MessageLoop::current()->AddDestructionObserver(this); 376 MessageLoop::current()->AddDestructionObserver(this);
377 377
378 std::vector<FilePath::StringType> comps; 378 std::vector<FilePath::StringType> comps;
379 target_.GetComponents(&comps); 379 target_.GetComponents(&comps);
380 DCHECK(!comps.empty()); 380 DCHECK(!comps.empty());
381 for (std::vector<FilePath::StringType>::const_iterator comp(++comps.begin()); 381 for (std::vector<FilePath::StringType>::const_iterator comp(++comps.begin());
382 comp != comps.end(); ++comp) { 382 comp != comps.end(); ++comp) {
383 watches_.push_back(WatchEntry(InotifyReader::kInvalidWatch, *comp)); 383 watches_.push_back(WatchEntry(InotifyReader::kInvalidWatch, *comp));
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 } 453 }
454 454
455 } // namespace 455 } // namespace
456 456
457 FilePathWatcher::FilePathWatcher() { 457 FilePathWatcher::FilePathWatcher() {
458 impl_ = new FilePathWatcherImpl(); 458 impl_ = new FilePathWatcherImpl();
459 } 459 }
460 460
461 } // namespace files 461 } // namespace files
462 } // namespace base 462 } // namespace base
OLDNEW
« no previous file with comments | « base/files/file_path_watcher_browsertest.cc ('k') | base/files/file_path_watcher_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698