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

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

Issue 10874083: Enable file path watcher for Android (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: changes according to the comments Created 8 years, 3 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/base.gypi ('k') | build/android/gtest_filter/unit_tests_disabled » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 DCHECK(MessageLoopForIO::current()); 366 DCHECK(MessageLoopForIO::current());
367 367
368 set_message_loop(base::MessageLoopProxy::current()); 368 set_message_loop(base::MessageLoopProxy::current());
369 delegate_ = delegate; 369 delegate_ = delegate;
370 target_ = path; 370 target_ = path;
371 MessageLoop::current()->AddDestructionObserver(this); 371 MessageLoop::current()->AddDestructionObserver(this);
372 372
373 std::vector<FilePath::StringType> comps; 373 std::vector<FilePath::StringType> comps;
374 target_.GetComponents(&comps); 374 target_.GetComponents(&comps);
375 DCHECK(!comps.empty()); 375 DCHECK(!comps.empty());
376 for (std::vector<FilePath::StringType>::const_iterator comp(++comps.begin()); 376 std::vector<FilePath::StringType>::const_iterator comp = comps.begin();
jar (doing other things) 2012/08/30 02:47:25 I didn't especially like this pre-increment on the
yongsheng 2012/08/30 04:50:17 yes, see the compiler error on Android.
Mark Mentovai 2012/08/30 02:50:42 Why are you changing this?
yongsheng 2012/08/30 03:06:30 The fix for file_path_watcher_linux.cc is because
377 comp != comps.end(); ++comp) { 377 for (++comp; comp != comps.end(); ++comp)
378 watches_.push_back(WatchEntry(InotifyReader::kInvalidWatch, *comp)); 378 watches_.push_back(WatchEntry(InotifyReader::kInvalidWatch, *comp));
379 } 379
380 watches_.push_back(WatchEntry(InotifyReader::kInvalidWatch, 380 watches_.push_back(WatchEntry(InotifyReader::kInvalidWatch,
381 FilePath::StringType())); 381 FilePath::StringType()));
382 return UpdateWatches(); 382 return UpdateWatches();
383 } 383 }
384 384
385 void FilePathWatcherImpl::Cancel() { 385 void FilePathWatcherImpl::Cancel() {
386 if (!delegate_) { 386 if (!delegate_) {
387 // Watch was never called, or the |message_loop_| thread is already gone. 387 // Watch was never called, or the |message_loop_| thread is already gone.
388 set_cancelled(); 388 set_cancelled();
389 return; 389 return;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 } 474 }
475 475
476 } // namespace 476 } // namespace
477 477
478 FilePathWatcher::FilePathWatcher() { 478 FilePathWatcher::FilePathWatcher() {
479 impl_ = new FilePathWatcherImpl(); 479 impl_ = new FilePathWatcherImpl();
480 } 480 }
481 481
482 } // namespace files 482 } // namespace files
483 } // namespace base 483 } // namespace base
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | build/android/gtest_filter/unit_tests_disabled » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698