VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/xpcom/io/nsIFastLoadService.idl@ 6542

Last change on this file since 6542 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.8 KB
Line 
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
42interface nsIFastLoadReadControl;
43interface nsIFile;
44interface nsIInputStream;
45interface nsIOutputStream;
46interface nsIObjectInputStream;
47interface nsIObjectOutputStream;
48
49[scriptable, uuid(715577db-d9c5-464a-a32e-0a40c29b22d4)]
50interface nsIFastLoadFileIO : nsISupports
51{
52 readonly attribute nsIInputStream inputStream;
53 readonly attribute nsIOutputStream outputStream;
54};
55
56[scriptable, uuid(759e475e-0c23-4dbf-b1b8-78c9369e3072)]
57interface nsIFastLoadService : nsISupports
58{
59 nsIFile newFastLoadFile(in string aBaseName);
60
61 nsIObjectInputStream newInputStream(in nsIInputStream aSrcStream);
62 nsIObjectOutputStream newOutputStream(in nsIOutputStream aDestStream);
63
64 // Flag values for the direction attribute and the aDirectionFlags
65 // parameter to startMuxedDocument.
66 const PRInt32 NS_FASTLOAD_READ = 1;
67 const PRInt32 NS_FASTLOAD_WRITE = 2;
68
69 attribute nsIObjectInputStream inputStream;
70 attribute nsIObjectOutputStream outputStream;
71 attribute nsIFastLoadFileIO fileIO;
72 readonly attribute PRInt32 direction;
73
74 /**
75 * These methods associate a URI object with its spec, for faster select
76 * using the object pointer as a key, rather than the spec string. The
77 * selectMuxedDocument method returns the previously selected URI object,
78 * in case a caller needs to reselect the previous after muxing data for
79 * a given URI synchronously. For the non-blocking or "asynchronous" i/o
80 * case, the caller must select the source URI from the FastLoad multiplex
81 * before writing a new burst of data parsed from the slow-loaded source.
82 *
83 * Clients of inputStream and outputStream should try to demultiplex data
84 * from the input stream only if fastLoadService->StartMuxedDocument(uri,
85 * urispec, NS_FASTLOAD_READ) succeeds. If StartMuxedDocument fails with
86 * NS_ERROR_NOT_AVAILABLE, callers should slow-load the documents, muxing
87 * their data to the current output stream.
88 */
89 void startMuxedDocument(in nsISupports aURI,
90 in string aURISpec,
91 in PRInt32 aDirectionFlags);
92 nsISupports selectMuxedDocument(in nsISupports aURI);
93 void endMuxedDocument(in nsISupports aURI);
94
95 void addDependency(in nsIFile aFile);
96
97 PRUint32 computeChecksum(in nsIFile aFile,
98 in nsIFastLoadReadControl aControl);
99 void cacheChecksum(in nsIFile aFile,
100 in nsIObjectOutputStream aStream);
101
102 [noscript] void getFastLoadReferent(inout nsISupports aPtr);
103
104 [noscript] void readFastLoadPtr(in nsIObjectInputStream aInputStream,
105 inout nsISupports aPtr);
106
107 [noscript] void writeFastLoadPtr(in nsIObjectOutputStream aOutputStream,
108 in nsISupports aPtr);
109
110 /**
111 * Return true if aURISpec identifies a muxed document in the FastLoad
112 * file, false otherwise.
113 */
114 boolean hasMuxedDocument(in string aURISpec);
115};
116
117%{C++
118#define NS_FASTLOADSERVICE_CLASSNAME "Mozilla FastLoad Service"
119
120#define NS_FASTLOADSERVICE_CID \
121 {0xc943093c,0xac94,0x4bee,{0x84,0x0b,0x8b,0x5a,0x6e,0x31,0x4f,0xa7}}
122
123#define NS_FASTLOADSERVICE_CONTRACTID \
124 "@mozilla.org/fast-load-service;1"
125
126#ifndef nsCOMPtr_h___
127# include "nsCOMPtr.h"
128#endif
129#ifndef __gen_nsIFile_h__
130# include "nsIFile.h"
131#endif
132#ifndef nsIServiceManager_h___
133# include "nsIServiceManager.h"
134#endif
135
136inline const nsGetServiceByCID
137do_GetFastLoadService(nsresult *aResultCode = 0)
138{
139 static NS_DEFINE_CID(kFastLoadServiceCID, NS_FASTLOADSERVICE_CID);
140 return nsGetServiceByCID(kFastLoadServiceCID, nsnull, aResultCode);
141}
142
143inline nsresult
144NS_AddFastLoadDependency(nsIFile* aFile)
145{
146 nsCOMPtr<nsIFastLoadService> fastLoadService(do_GetFastLoadService());
147 if (fastLoadService) {
148 nsresult rv = fastLoadService->AddDependency(aFile);
149 if (NS_FAILED(rv) && rv != NS_ERROR_NOT_AVAILABLE)
150 return rv;
151 }
152 return NS_OK;
153}
154
155%}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette