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

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

Issue 8677015: base::Bind: Convert FilePathWatcher. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Style fix. Created 9 years, 1 month 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_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 <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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 void FilePathWatcherImpl::Cancel() { 405 void FilePathWatcherImpl::Cancel() {
406 if (!delegate_) { 406 if (!delegate_) {
407 // Watch was never called, or the |message_loop_| thread is already gone. 407 // Watch was never called, or the |message_loop_| thread is already gone.
408 set_cancelled(); 408 set_cancelled();
409 return; 409 return;
410 } 410 }
411 411
412 // Switch to the message_loop_ if necessary so we can access |watches_|. 412 // Switch to the message_loop_ if necessary so we can access |watches_|.
413 if (!message_loop()->BelongsToCurrentThread()) { 413 if (!message_loop()->BelongsToCurrentThread()) {
414 message_loop()->PostTask(FROM_HERE, 414 message_loop()->PostTask(FROM_HERE,
415 new FilePathWatcher::CancelTask(this)); 415 base::Bind(&FilePathWatcher::CancelWatch,
416 make_scoped_refptr(this)));
416 } else { 417 } else {
417 CancelOnMessageLoopThread(); 418 CancelOnMessageLoopThread();
418 } 419 }
419 } 420 }
420 421
421 void FilePathWatcherImpl::CancelOnMessageLoopThread() { 422 void FilePathWatcherImpl::CancelOnMessageLoopThread() {
422 if (!is_cancelled()) 423 if (!is_cancelled())
423 set_cancelled(); 424 set_cancelled();
424 425
425 if (delegate_) { 426 if (delegate_) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 } 493 }
493 494
494 } // namespace 495 } // namespace
495 496
496 FilePathWatcher::FilePathWatcher() { 497 FilePathWatcher::FilePathWatcher() {
497 impl_ = new FilePathWatcherImpl(); 498 impl_ = new FilePathWatcherImpl();
498 } 499 }
499 500
500 } // namespace files 501 } // namespace files
501 } // namespace base 502 } // namespace base
OLDNEW
« no previous file with comments | « base/files/file_path_watcher_browsertest.cc ('k') | base/files/file_path_watcher_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698