nsICachePurgeLock.idl (1319B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 #include "nsISupports.idl" 6 interface nsIFile; 7 8 /** 9 * This object is a wrapper of MultiInstanceLock. 10 * It's intended to be used to ensure exclusive access to folders being 11 * deleted by the purgeHTTPCache background task. 12 */ 13 [scriptable,uuid(8abb21e3-c6a0-4b4d-9333-cc0d72f2c23b)] 14 interface nsICachePurgeLock : nsISupports { 15 /** 16 * Initializes the lock using the profile name and the current process's 17 * path. 18 * Will throw if a lock was already acquired successfully. 19 */ 20 void lock(in AUTF8String profileName); 21 22 /** 23 * Returns true if another instance also holds the lock. 24 * Throws if called before lock was called, or after unlock was called. 25 */ 26 boolean isOtherInstanceRunning(); 27 28 /** 29 * Releases the lock. 30 * This object may be locked again, potentially using a different path 31 * after unlocking. 32 */ 33 void unlock(); 34 35 /** 36 * Returns the file used to guarantee single access to a resource. 37 * This method is used to remove the lock file when no longer necessary. 38 */ 39 nsIFile getLockFile(in AUTF8String profileName); 40 };