mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 759416 - XPCOM FileWatcherService. Interface and stub impl. r=dougt
This commit is contained in:
parent
1ef4c0de5b
commit
618630d18a
@ -16,6 +16,7 @@
|
||||
[ptr] native FILE(FILE);
|
||||
|
||||
interface nsISimpleEnumerator;
|
||||
interface nsIFileUpdateListener;
|
||||
|
||||
/**
|
||||
* This is the only correct cross-platform way to specify a file.
|
||||
@ -30,7 +31,7 @@ interface nsISimpleEnumerator;
|
||||
* be safely passed to javascript via xpconnect. Therefore, the "native
|
||||
* methods" are not scriptable.
|
||||
*/
|
||||
[scriptable, uuid(272a5020-64f5-485c-a8c4-44b2882ae0a2), builtinclass]
|
||||
[scriptable, uuid(9117c043-c01b-487a-a7ad-32cb350b0971), builtinclass]
|
||||
interface nsIFile : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -447,6 +448,62 @@ interface nsIFile : nsISupports
|
||||
* the relative descriptor obtained from getRelativeDescriptor
|
||||
*/
|
||||
void setRelativeDescriptor(in nsIFile fromFile, in ACString relativeDesc);
|
||||
|
||||
/**
|
||||
* watch
|
||||
*
|
||||
* Watches this file for changes, or if this nsIFile is a
|
||||
* directory, watch for changes in its children recursively, not
|
||||
* dereferencing symlinks. Multiple listeners can be installed
|
||||
* at once, and all will be called when any appropriate changes
|
||||
* are made. If a child directory is created, that directory
|
||||
* will automatically be watched. If the file is a symlink to a
|
||||
* directory or another file, the target will be watched for
|
||||
* changes, not the link.
|
||||
*
|
||||
* @param listener
|
||||
* The listener to call out to when the file updates.
|
||||
* Updated will be recieved on the main thread.
|
||||
*
|
||||
* @return NS_ERROR_FILE_TARGET_DOES_NOT_EXIST if the file
|
||||
* doesn't exist, NS_NOT_AVAILABLE if there is an
|
||||
* out-of-memory or other resource failure, NS_OK
|
||||
* otherwise.
|
||||
*/
|
||||
void watch(in nsIFileUpdateListener listener);
|
||||
|
||||
/**
|
||||
*
|
||||
* unwatch
|
||||
*
|
||||
* Removes the watch using the given listener from the file.
|
||||
* After this function terminates, no more requests will call the
|
||||
* given listener.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to stop calling out to
|
||||
*
|
||||
* @return NS_ERROR_ILLEGAL_VALUE if the file is not being
|
||||
* watched with the given listener, NS_OK otherwise.
|
||||
*/
|
||||
void unwatch(in nsIFileUpdateListener listener);
|
||||
};
|
||||
|
||||
[scriptable, uuid(8968aaba-0f95-436c-8baf-7092ccaa814c), function]
|
||||
interface nsIFileUpdateListener : nsISupports
|
||||
{
|
||||
/**
|
||||
* update
|
||||
*
|
||||
* This function will be called whenever there is an update to be
|
||||
* processed.
|
||||
*
|
||||
* @param type
|
||||
* The type of update that occured (one of "created" "deleted" "modified" or "unknown").
|
||||
* @param file
|
||||
* The file which has updated
|
||||
*/
|
||||
void update(in string type, in nsIFile file);
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
@ -13,12 +13,12 @@
|
||||
#include "nsCRT.h"
|
||||
#include "nsNativeCharsetUtils.h"
|
||||
#include "nsUTF8Utils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
|
||||
void NS_StartupLocalFile()
|
||||
{
|
||||
nsLocalFile::GlobalInit();
|
||||
@ -288,3 +288,17 @@ nsLocalFile::SetRelativeDescriptor(nsIFile *fromFile, const nsACString& relative
|
||||
|
||||
return InitWithFile(targetFile);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::Watch(nsIFileUpdateListener *listener)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Watch must be called from main thread!");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::Unwatch(nsIFileUpdateListener *listener)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Unwatch must be called from main thread!");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user