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

Side by Side Diff: runtime/bin/file_system_watcher_macos.cc

Issue 39773002: Fix issue where we would double unwatch the path. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | « runtime/bin/file_patch.dart ('k') | no next file » | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_MACOS) 6 #if defined(TARGET_OS_MACOS)
7 7
8 #include "bin/file_system_watcher.h" 8 #include "bin/file_system_watcher.h"
9 9
10 #include <errno.h> // NOLINT 10 #include <errno.h> // NOLINT
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 private: 194 private:
195 static void Callback(ConstFSEventStreamRef ref, 195 static void Callback(ConstFSEventStreamRef ref,
196 void* client, 196 void* client,
197 size_t num_events, 197 size_t num_events,
198 void* event_paths, 198 void* event_paths,
199 const FSEventStreamEventFlags event_flags[], 199 const FSEventStreamEventFlags event_flags[],
200 const FSEventStreamEventId event_ids[]) { 200 const FSEventStreamEventId event_ids[]) {
201 Node* node = reinterpret_cast<Node*>(client); 201 Node* node = reinterpret_cast<Node*>(client);
202 for (size_t i = 0; i < num_events; i++) { 202 for (size_t i = 0; i < num_events; i++) {
203 char *path = reinterpret_cast<char**>(event_paths)[i]; 203 char *path = reinterpret_cast<char**>(event_paths)[i];
204 path += node->base_path_length() + 1; 204 path += node->base_path_length();
205 // If path is longer the base, skip next character ('/').
206 if (path[0] != '\0') path += 1;
205 if (!node->recursive() && strstr(path, "/") != NULL) continue; 207 if (!node->recursive() && strstr(path, "/") != NULL) continue;
206 FSEvent event; 208 FSEvent event;
207 event.data.flags = event_flags[i]; 209 event.data.flags = event_flags[i];
208 memmove(event.data.path, path, strlen(path) + 1); 210 memmove(event.data.path, path, strlen(path) + 1);
209 write(node->write_fd(), event.bytes, sizeof(event)); 211 write(node->write_fd(), event.bytes, sizeof(event));
210 } 212 }
211 } 213 }
212 214
213 CFRunLoopRef run_loop_; 215 CFRunLoopRef run_loop_;
214 int users_; 216 int users_;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 } 287 }
286 return events; 288 return events;
287 } 289 }
288 290
289 } // namespace bin 291 } // namespace bin
290 } // namespace dart 292 } // namespace dart
291 293
292 #endif // defined(TARGET_OS_MACOS) 294 #endif // defined(TARGET_OS_MACOS)
293 295
294 296
OLDNEW
« no previous file with comments | « runtime/bin/file_patch.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698