OLD | NEW |
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 <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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 std::vector<FilePath::StringType> components; | 164 std::vector<FilePath::StringType> components; |
165 path.GetComponents(&components); | 165 path.GetComponents(&components); |
166 | 166 |
167 if (components.size() < 1) { | 167 if (components.size() < 1) { |
168 return -1; | 168 return -1; |
169 } | 169 } |
170 | 170 |
171 int last_existing_entry = 0; | 171 int last_existing_entry = 0; |
172 FilePath built_path; | 172 FilePath built_path; |
173 bool path_still_exists = true; | 173 bool path_still_exists = true; |
174 for(std::vector<FilePath::StringType>::iterator i = components.begin(); | 174 for (std::vector<FilePath::StringType>::iterator i = components.begin(); |
175 i != components.end(); ++i) { | 175 i != components.end(); ++i) { |
176 if (i == components.begin()) { | 176 if (i == components.begin()) { |
177 built_path = FilePath(*i); | 177 built_path = FilePath(*i); |
178 } else { | 178 } else { |
179 built_path = built_path.Append(*i); | 179 built_path = built_path.Append(*i); |
180 } | 180 } |
181 uintptr_t fd = kNoFileDescriptor; | 181 uintptr_t fd = kNoFileDescriptor; |
182 if (path_still_exists) { | 182 if (path_still_exists) { |
183 fd = FileDescriptorForPath(built_path); | 183 fd = FileDescriptorForPath(built_path); |
184 if (fd == kNoFileDescriptor) { | 184 if (fd == kNoFileDescriptor) { |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 } | 509 } |
510 } | 510 } |
511 | 511 |
512 } // namespace | 512 } // namespace |
513 | 513 |
514 FilePathWatcher::FilePathWatcher() { | 514 FilePathWatcher::FilePathWatcher() { |
515 impl_ = new FilePathWatcherImpl(); | 515 impl_ = new FilePathWatcherImpl(); |
516 } | 516 } |
517 | 517 |
518 } // namespace base | 518 } // namespace base |
OLD | NEW |