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

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

Issue 105293002: Move more file_util functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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/file_util_win.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) 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 439
440 // Walk the list of watches and update them as we go. 440 // Walk the list of watches and update them as we go.
441 FilePath path(FILE_PATH_LITERAL("/")); 441 FilePath path(FILE_PATH_LITERAL("/"));
442 bool path_valid = true; 442 bool path_valid = true;
443 for (WatchVector::iterator watch_entry(watches_.begin()); 443 for (WatchVector::iterator watch_entry(watches_.begin());
444 watch_entry != watches_.end(); ++watch_entry) { 444 watch_entry != watches_.end(); ++watch_entry) {
445 InotifyReader::Watch old_watch = watch_entry->watch_; 445 InotifyReader::Watch old_watch = watch_entry->watch_;
446 if (path_valid) { 446 if (path_valid) {
447 watch_entry->watch_ = g_inotify_reader.Get().AddWatch(path, this); 447 watch_entry->watch_ = g_inotify_reader.Get().AddWatch(path, this);
448 if ((watch_entry->watch_ == InotifyReader::kInvalidWatch) && 448 if ((watch_entry->watch_ == InotifyReader::kInvalidWatch) &&
449 file_util::IsLink(path)) { 449 base::IsLink(path)) {
450 FilePath link; 450 FilePath link;
451 if (ReadSymbolicLink(path, &link)) { 451 if (ReadSymbolicLink(path, &link)) {
452 if (!link.IsAbsolute()) 452 if (!link.IsAbsolute())
453 link = path.DirName().Append(link); 453 link = path.DirName().Append(link);
454 // Try watching symlink target directory. If the link target is "/", 454 // Try watching symlink target directory. If the link target is "/",
455 // then we shouldn't get here in normal situations and if we do, we'd 455 // then we shouldn't get here in normal situations and if we do, we'd
456 // watch "/" for changes to a component "/" which is harmless so no 456 // watch "/" for changes to a component "/" which is harmless so no
457 // special treatment of this case is required. 457 // special treatment of this case is required.
458 watch_entry->watch_ = 458 watch_entry->watch_ =
459 g_inotify_reader.Get().AddWatch(link.DirName(), this); 459 g_inotify_reader.Get().AddWatch(link.DirName(), this);
(...skipping 24 matching lines...) Expand all
484 return true; 484 return true;
485 } 485 }
486 486
487 } // namespace 487 } // namespace
488 488
489 FilePathWatcher::FilePathWatcher() { 489 FilePathWatcher::FilePathWatcher() {
490 impl_ = new FilePathWatcherImpl(); 490 impl_ = new FilePathWatcherImpl();
491 } 491 }
492 492
493 } // namespace base 493 } // namespace base
OLDNEW
« no previous file with comments | « base/file_util_win.cc ('k') | base/files/file_path_watcher_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698