1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
---|
2 | /* ***** BEGIN LICENSE BLOCK *****
|
---|
3 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
---|
4 | *
|
---|
5 | * The contents of this file are subject to the Mozilla Public License Version
|
---|
6 | * 1.1 (the "License"); you may not use this file except in compliance with
|
---|
7 | * the License. You may obtain a copy of the License at
|
---|
8 | * http://www.mozilla.org/MPL/
|
---|
9 | *
|
---|
10 | * Software distributed under the License is distributed on an "AS IS" basis,
|
---|
11 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
---|
12 | * for the specific language governing rights and limitations under the
|
---|
13 | * License.
|
---|
14 | *
|
---|
15 | * The Original Code is Mozilla FastLoad code.
|
---|
16 | *
|
---|
17 | * The Initial Developer of the Original Code is
|
---|
18 | * Netscape Communications Corporation.
|
---|
19 | * Portions created by the Initial Developer are Copyright (C) 2001
|
---|
20 | * the Initial Developer. All Rights Reserved.
|
---|
21 | *
|
---|
22 | * Contributor(s):
|
---|
23 | * Brendan Eich <[email protected]> (original author)
|
---|
24 | *
|
---|
25 | * Alternatively, the contents of this file may be used under the terms of
|
---|
26 | * either of the GNU General Public License Version 2 or later (the "GPL"),
|
---|
27 | * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
---|
28 | * in which case the provisions of the GPL or the LGPL are applicable instead
|
---|
29 | * of those above. If you wish to allow use of your version of this file only
|
---|
30 | * under the terms of either the GPL or the LGPL, and not to allow others to
|
---|
31 | * use your version of this file under the terms of the MPL, indicate your
|
---|
32 | * decision by deleting the provisions above and replace them with the notice
|
---|
33 | * and other provisions required by the GPL or the LGPL. If you do not delete
|
---|
34 | * the provisions above, a recipient may use your version of this file under
|
---|
35 | * the terms of any one of the MPL, the GPL or the LGPL.
|
---|
36 | *
|
---|
37 | * ***** END LICENSE BLOCK ***** */
|
---|
38 |
|
---|
39 | #include "nsISupports.idl"
|
---|
40 | #include "nsrootidl.idl"
|
---|
41 |
|
---|
42 | interface nsIFile;
|
---|
43 | interface nsISimpleEnumerator;
|
---|
44 |
|
---|
45 | /**
|
---|
46 | * The nsIFastLoadFileControl interface and its subinterfaces are mix-ins for
|
---|
47 | * classes implementing nsIObjectInputStream and nsIObjectOutputStream, so that
|
---|
48 | * those stream types can be used with nsIFastLoadService to access and compute
|
---|
49 | * FastLoad file checksums, update and check FastLoad file dependencies, and
|
---|
50 | * multiplex documents loaded via non-blocking i/o.
|
---|
51 | *
|
---|
52 | * If an nsIObjectInputStream class doesn't support nsIFastLoadReadControl, or
|
---|
53 | * an nsIObjectOutputStream class doesn't support nsIFastLoadWriteControl, that
|
---|
54 | * implementation may still be useful for object serialization, but it can't be
|
---|
55 | * used to read or write a Mozilla FastLoad file.
|
---|
56 | */
|
---|
57 | [scriptable, uuid(8a1e2c63-af50-4147-af7e-26289dc180dd)]
|
---|
58 | interface nsIFastLoadFileControl : nsISupports
|
---|
59 | {
|
---|
60 | /**
|
---|
61 | * Get and set the recorded checksum value from the FastLoad file header.
|
---|
62 | */
|
---|
63 | attribute PRUint32 checksum;
|
---|
64 |
|
---|
65 | /**
|
---|
66 | * Multiplexed document control methods. A FastLoad file may contain
|
---|
67 | * multiple interleaved documents identified by a URI specifier string,
|
---|
68 | * and indexed for fast multiplexor select by an opaque URI object key.
|
---|
69 | * You StartMuxedDocument when initiating a document load, then Select
|
---|
70 | * before every batch of calls to (de)serialize document data, and End
|
---|
71 | * when the load completes.
|
---|
72 | *
|
---|
73 | * Document multiplexing is necessary to support incremental FastLoad
|
---|
74 | * development in a non-blocking i/o architecture such as Mozilla, where
|
---|
75 | * some (but not all, at first, or for a while during development) of the
|
---|
76 | * results of parsing and compiling various inputs can be multiplexed to
|
---|
77 | * or from a FastLoad file.
|
---|
78 | *
|
---|
79 | * Note: Select returns the previously selected URI object in case the
|
---|
80 | * caller is synchronously selecting and writing data to the FastLoad
|
---|
81 | * file, so the caller can reselect the previous URI and return to code
|
---|
82 | * the continues to write FastLoad data for the previous URI, unaware of
|
---|
83 | * the nested select/write/reselect.
|
---|
84 | */
|
---|
85 | void startMuxedDocument(in nsISupports aURI, in string aURISpec);
|
---|
86 | nsISupports selectMuxedDocument(in nsISupports aURI);
|
---|
87 | void endMuxedDocument(in nsISupports aURI);
|
---|
88 |
|
---|
89 | /**
|
---|
90 | * Return true if aURISpec identifies a muxed document in the FastLoad
|
---|
91 | * file, false otherwise.
|
---|
92 | */
|
---|
93 | boolean hasMuxedDocument(in string aURISpec);
|
---|
94 | };
|
---|
95 |
|
---|
96 | [scriptable, uuid(652ecec6-d40b-45b6-afef-641d6c63a35b)]
|
---|
97 | interface nsIFastLoadReadControl : nsIFastLoadFileControl
|
---|
98 | {
|
---|
99 | /**
|
---|
100 | * Computes the correct checksum of the FastLoad file, independent of the
|
---|
101 | * header's checksum value. The header checksum field is treated as zero
|
---|
102 | * when computing the checksum.
|
---|
103 | */
|
---|
104 | PRUint32 computeChecksum();
|
---|
105 |
|
---|
106 | /**
|
---|
107 | * Get the collection of dependency nsIFile instances recorded during the
|
---|
108 | * FastLoad file write or read/update process, and checked during the read
|
---|
109 | * process to invalidate the FastLoad file if any dependencies are newer.
|
---|
110 | */
|
---|
111 | readonly attribute nsISimpleEnumerator dependencies;
|
---|
112 | };
|
---|
113 |
|
---|
114 | [scriptable, uuid(2ad6e9e6-1379-4e45-a899-a54b27ff915c)]
|
---|
115 | interface nsIFastLoadWriteControl : nsIFastLoadFileControl
|
---|
116 | {
|
---|
117 | /**
|
---|
118 | * Add a file dependency of the FastLoad file (e.g., a .jar file) to the
|
---|
119 | * set of dependencies that trigger regeneration if any dependency has a
|
---|
120 | * last-modified-time greater than the FastLoad file's mtime.
|
---|
121 | */
|
---|
122 | void addDependency(in nsIFile aFile);
|
---|
123 | };
|
---|