41 void *aClientCallbackInfo,
43 const char *
const aEventPaths[],
44 const FSEventStreamEventFlags aEventFlags[],
45 const FSEventStreamEventId aEventIds[])
47 TRACE(
"%s: %i events", __FUNCTION__, aNumEvents);
55 for (
unsigned int i = 0;
i < aNumEvents;
i++) {
57 curPath.AppendLiteral(aEventPaths[
i]);
58 paths.AppendElement(curPath);
73 if (Gestalt(gestaltSystemVersion, &macVersion) == noErr) {
74 if (macVersion >= 0x1050) {
86 const nsAString & aRootPath,
89 TRACE(
"%s: path=%s", __FUNCTION__, NS_ConvertUTF16toUTF8(aRootPath).
get());
91 return NS_ERROR_NOT_IMPLEMENTED;
101 TRACE(
"%s: session %s", __FUNCTION__, aSessionGuid.BeginReading());
103 return NS_ERROR_NOT_IMPLEMENTED;
106 return sbBaseFileSystemWatcher::InitWithSession(aSessionGuid, aListener);
112 TRACE(
"%s: save %i", __FUNCTION__, aShouldSaveSession);
114 return NS_ERROR_NOT_IMPLEMENTED;
125 FSEventStreamStop(mStream);
126 FSEventStreamInvalidate(mStream);
127 FSEventStreamRelease(mStream);
131 return sbBaseFileSystemWatcher::StopWatching(aShouldSaveSession);
137 PRUint32 length = aEventPaths.Length();
138 for (PRUint32
i = 0;
i < length;
i++) {
139 mTree->Update(aEventPaths[
i]);
150 TRACE(
"%s: tree at %s ready", __FUNCTION__,
151 NS_ConvertUTF16toUTF8(aTreeRootPath).
get());
160 CFStringCreateWithCString(NULL,
162 kCFStringEncodingUTF8);
163 CFArrayRef paths = CFArrayCreate(NULL, (
const void **)&path, 1, NULL);
166 mContext = (FSEventStreamContext *) malloc(
sizeof(FSEventStreamContext));
167 mContext->info = (
void *)
this;
168 mContext->version = 0;
169 mContext->retain = NULL;
170 mContext->release = NULL;
171 mContext->copyDescription = NULL;
173 mStream = FSEventStreamCreate(NULL,
177 kFSEventStreamEventIdSinceNow,
179 kFSEventStreamCreateFlagNone);
181 FSEventStreamScheduleWithRunLoop(mStream,
182 CFRunLoopGetCurrent(),
183 kCFRunLoopDefaultMode);
188 nsresult rv =
mListener->OnWatcherStarted();
189 NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr< sbIFileSystemListener > mListener
#define SB_PRLOG_SETUP(x)
static void FSEventCallback(ConstFSEventStreamRef aStreamRef, void *aClientCallbackInfo, size_t aNumEvents, const char *const aEventPaths[], const FSEventStreamEventFlags aEventFlags[], const FSEventStreamEventId aEventIds[])
nsTArray< nsString > sbStringArray
virtual ~sbMacFileSystemWatcher()
NS_IMETHOD StopWatching(PRBool aShouldSaveSession)
NS_IMETHOD InitWithSession(const nsACString &aSessionGuid, sbIFileSystemListener *aListener)
nsRefPtr< sbFileSystemTree > mTree
void OnFileSystemEvents(const sbStringArray &aEventPaths)
NS_IMETHOD OnTreeReady(const nsAString &aTreeRootPath, sbStringArray &aDirPathArray)
_getSelectedPageStyle s i
NS_IMETHOD Init(sbIFileSystemListener *aListener, const nsAString &aRootPath, PRBool aIsRecursive)