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

Side by Side Diff: base/files/file_path_watcher_mac.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_linux.cc ('k') | base/files/file_path_watcher_win.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 <fcntl.h> 7 #include <fcntl.h>
8 #include <sys/event.h> 8 #include <sys/event.h>
9 #include <sys/param.h> 9 #include <sys/param.h>
10 10
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 FilePathWatcher::Delegate* delegate) { 420 FilePathWatcher::Delegate* delegate) {
421 DCHECK(MessageLoopForIO::current()); 421 DCHECK(MessageLoopForIO::current());
422 DCHECK(target_.value().empty()); // Can only watch one path. 422 DCHECK(target_.value().empty()); // Can only watch one path.
423 DCHECK(delegate); 423 DCHECK(delegate);
424 DCHECK_EQ(kqueue_, -1); 424 DCHECK_EQ(kqueue_, -1);
425 425
426 delegate_ = delegate; 426 delegate_ = delegate;
427 target_ = path; 427 target_ = path;
428 428
429 MessageLoop::current()->AddDestructionObserver(this); 429 MessageLoop::current()->AddDestructionObserver(this);
430 io_message_loop_ = base::MessageLoopProxy::CreateForCurrentThread(); 430 io_message_loop_ = base::MessageLoopProxy::current();
431 431
432 kqueue_ = kqueue(); 432 kqueue_ = kqueue();
433 if (kqueue_ == -1) { 433 if (kqueue_ == -1) {
434 PLOG(ERROR) << "kqueue"; 434 PLOG(ERROR) << "kqueue";
435 return false; 435 return false;
436 } 436 }
437 437
438 int last_entry = EventsForPath(target_, &events_); 438 int last_entry = EventsForPath(target_, &events_);
439 CHECK_NE(last_entry, 0); 439 CHECK_NE(last_entry, 0);
440 440
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 } 484 }
485 485
486 } // namespace 486 } // namespace
487 487
488 FilePathWatcher::FilePathWatcher() { 488 FilePathWatcher::FilePathWatcher() {
489 impl_ = new FilePathWatcherImpl(); 489 impl_ = new FilePathWatcherImpl();
490 } 490 }
491 491
492 } // namespace files 492 } // namespace files
493 } // namespace base 493 } // namespace base
OLDNEW
« no previous file with comments | « base/files/file_path_watcher_linux.cc ('k') | base/files/file_path_watcher_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698