зеркало из https://github.com/mozilla/gecko-dev.git
Some future design work. Not part of any build
This commit is contained in:
Родитель
de8bff8f6c
Коммит
bcff55487e
|
@ -0,0 +1,39 @@
|
|||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = necko
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsISimpleFailure.idl \
|
||||
nsICompletionEventListener.idl \
|
||||
nsIInputStream2.idl \
|
||||
nsIOutputStream2.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
MODULE = necko
|
||||
|
||||
DEPTH = ..\..\..
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
|
||||
XPIDLSRCS = \
|
||||
.\nsISimpleFailure.idl \
|
||||
.\nsICompletionEventListener.idl\
|
||||
.\nsIInputStream2.idl \
|
||||
.\nsIOutputStream2.idl \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)/config/rules.mak>
|
||||
|
||||
$(DEPTH)\netwerk\dist\include:
|
||||
-mkdir $(DEPTH)\netwerk\dist
|
||||
-mkdir $(DEPTH)\netwerk\dist\include
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
/**
|
||||
* Goals:
|
||||
*
|
||||
* (1) Model streams after NSPR I/O, thus making implementation easy and transparent
|
||||
* (2) Allow both - blocking and non-blocking operations within the same API framework
|
||||
* and in doing so streamlining the way application is developed
|
||||
* (3) All stream implenetations become uniformed in both - blocking and non0blocking
|
||||
* modes, thus taking partially the functionality of nsIOChannel's and allow simple
|
||||
* transparent chaining of streams without encouraging excessive buffering
|
||||
*
|
||||
* This model will not support NT-style overlapped I/O; there's no good expression for it
|
||||
* within NSPR either - do we need it?
|
||||
*
|
||||
* Changes:
|
||||
* gagan: streams will not inherit from nsI*Stream to not confuse them with existing
|
||||
* streams as behavior is a bit different
|
||||
* ruslan: streams will not have a common base class and Close () operation - this will
|
||||
* have to be done in the destructor
|
||||
* ruslan: output stream will not have Flush () operation - this will need to be moved
|
||||
* into some new BufferedWriter interface
|
||||
*/
|
||||
|
||||
/**
|
||||
* this event object is always assumed to be called via proxy on the originating thread's
|
||||
* event queue
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(717fa26d-8ce4-40a9-9e7c-71958bf86ddd)]
|
||||
interface nsICompletionEventListener : nsISupports
|
||||
{
|
||||
/**
|
||||
* we don't want any parameters in this method on purpose to avoid dealing with
|
||||
* their lifecycles; it is listener's responisbility to maintain a reference to
|
||||
* a stream and then check for errors if needed
|
||||
*/
|
||||
void OnComplete ();
|
||||
};
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
/**
|
||||
* Goals:
|
||||
*
|
||||
* (1) Model streams after NSPR I/O, thus making implementation easy and transparent
|
||||
* (2) Allow both - blocking and non-blocking operations within the same API framework
|
||||
* and in doing so streamlining the way application is developed
|
||||
* (3) All stream implenetations become uniformed in both - blocking and non0blocking
|
||||
* modes, thus taking partially the functionality of nsIOChannel's and allow simple
|
||||
* transparent chaining of streams without encouraging excessive buffering
|
||||
*
|
||||
* This model will not support NT-style overlapped I/O; there's no good expression for it
|
||||
* within NSPR either - do we need it?
|
||||
*
|
||||
* Changes:
|
||||
* gagan: streams will not inherit from nsI*Stream to not confuse them with existing
|
||||
* streams as behavior is a bit different
|
||||
* ruslan: streams will not have a common base class and Close () operation - this will
|
||||
* have to be done in the destructor
|
||||
* ruslan: output stream will not have Flush () operation - this will need to be moved
|
||||
* into some new BufferedWriter interface
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsISimpleFailure.idl"
|
||||
#include "nsICompletionEventListener.idl"
|
||||
|
||||
/**
|
||||
* Quesion? Should we inherit from nsIInputStream and nsIOutputStream or these should be complete
|
||||
* replacements since the semantic of Read/Write/Etc. is a bit different?
|
||||
*/
|
||||
[scriptable, uuid(aedae738-3041-4418-b808-40db58a9e7b9)]
|
||||
interface nsIInputStream2 : nsISupports
|
||||
{
|
||||
/**
|
||||
* Read data from the stream.
|
||||
* @param aBuf the buffer into which the data is read
|
||||
* @param aCount the maximum number of bytes to read
|
||||
* @return aReadCount out parameter to hold the number of
|
||||
* bytes read, eof if 0. if an error occurs, the
|
||||
* read count will be undefined
|
||||
* @comment in case of non-blocking call Read may return WOULD_BLOCK
|
||||
* error code and the appropriate listener will be called upon
|
||||
* completion. The consumer then still will have to call Read
|
||||
* again to retreive the actual data
|
||||
*/
|
||||
|
||||
[noscript] unsigned long Read (in charPtr buf, in unsigned long count);
|
||||
|
||||
/**
|
||||
* Optional attribute which defines expected data length of the input
|
||||
* stream. It's purpose in life is to aid i/o layers whith the length
|
||||
* of the stream externally prescribed
|
||||
*/
|
||||
attribute long Length;
|
||||
|
||||
/**
|
||||
* a number of bytes read from the stream
|
||||
*/
|
||||
readonly attribute unsigned long Count;
|
||||
|
||||
/**
|
||||
* This attribute determines whether Read would block or not. In case of
|
||||
* a non-blocking stream - completion listener will be called only when
|
||||
* Read returns WOULD_BLOCK. Stream implementations are expected to be
|
||||
* able to switch between blocking and non-blocking modes on the fly
|
||||
*/
|
||||
attribute boolean Blocking;
|
||||
|
||||
/**
|
||||
* Optional completion listener: the listener will only be used when Read
|
||||
* returns WOULD_BLOCK. There is no guarantee that the number of Reads will
|
||||
* match the number of times the listener is invoked.
|
||||
* In all cases the subsequent Read call must be made to retrieve the actuall
|
||||
* data or an error code. The listener will always be called via Proxy object
|
||||
*/
|
||||
attribute nsICompletionEventListener Listener;
|
||||
|
||||
readonly attribute nsISimpleFailure StreamError;
|
||||
};
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
/**
|
||||
* Goals:
|
||||
*
|
||||
* (1) Model streams after NSPR I/O, thus making implementation easy and transparent
|
||||
* (2) Allow both - blocking and non-blocking operations within the same API framework
|
||||
* and in doing so streamlining the way application is developed
|
||||
* (3) All stream implenetations become uniformed in both - blocking and non0blocking
|
||||
* modes, thus taking partially the functionality of nsIOChannel's and allow simple
|
||||
* transparent chaining of streams without encouraging excessive buffering
|
||||
*
|
||||
* This model will not support NT-style overlapped I/O; there's no good expression for it
|
||||
* within NSPR either - do we need it?
|
||||
*
|
||||
* Changes:
|
||||
* gagan: streams will not inherit from nsI*Stream to not confuse them with existing
|
||||
* streams as behavior is a bit different
|
||||
* ruslan: streams will not have a common base class and Close () operation - this will
|
||||
* have to be done in the destructor
|
||||
* ruslan: output stream will not have Flush () operation - this will need to be moved
|
||||
* into some new BufferedWriter interface
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsISimpleFailure.idl"
|
||||
#include "nsICompletionEventListener.idl"
|
||||
|
||||
[scriptable, uuid(295c8dfa-7031-4615-a6c9-ddb692901035)]
|
||||
interface nsIOutputStream2 : nsISupports
|
||||
{
|
||||
/** Write data into the stream.
|
||||
* @param aBuf the buffer from which the data is read
|
||||
* @param aCount the maximum number of bytes to write
|
||||
* @return aWriteCount out parameter to hold the number of
|
||||
* bytes written. if an error occurs, the writecount
|
||||
* is undefined
|
||||
*/
|
||||
unsigned long Write(in string buf, in unsigned long count);
|
||||
|
||||
/**
|
||||
* Optional attribute which defines expected data length of the output
|
||||
* stream. It's purpose in life is to aid i/o layers whith the length
|
||||
* of the stream externally prescribed
|
||||
*/
|
||||
attribute long Length;
|
||||
|
||||
/**
|
||||
* a number of bytes written into the stream
|
||||
*/
|
||||
readonly attribute unsigned long Count;
|
||||
|
||||
/**
|
||||
* This attribute determines whether Read would block or not. In case of
|
||||
* a non-blocking stream - completion listener will be called only when
|
||||
* Write returns WOULD_BLOCK. Stream implementations are expected to be
|
||||
* able to switch between blocking and non-blocking modes on the fly
|
||||
*/
|
||||
attribute boolean Blocking;
|
||||
|
||||
/**
|
||||
* Optional completion listener: the listener will only be used when Write
|
||||
* or Flush returns WOULD_BLOCK.
|
||||
*/
|
||||
attribute nsICompletionEventListener Listener;
|
||||
|
||||
readonly attribute nsISimpleFailure StreamError;
|
||||
};
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* Goals:
|
||||
*
|
||||
* (1) Model streams after NSPR I/O, thus making implementation easy and transparent
|
||||
* (2) Allow both - blocking and non-blocking operations within the same API framework
|
||||
* and in doing so streamlining the way application is developed
|
||||
* (3) All stream implenetations become uniformed in both - blocking and non0blocking
|
||||
* modes, thus taking partially the functionality of nsIOChannel's and allow simple
|
||||
* transparent chaining of streams without encouraging excessive buffering
|
||||
*
|
||||
* This model will not support NT-style overlapped I/O; there's no good expression for it
|
||||
* within NSPR either - do we need it?
|
||||
*
|
||||
* Changes:
|
||||
* gagan: streams will not inherit from nsI*Stream to not confuse them with existing
|
||||
* streams as behavior is a bit different
|
||||
* ruslan: streams will not have a common base class and Close () operation - this will
|
||||
* have to be done in the destructor
|
||||
* ruslan: output stream will not have Flush () operation - this will need to be moved
|
||||
* into some new BufferedWriter interface
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
/**
|
||||
* Since we don't support exceptions - this is essentially an exception object to report
|
||||
* extended I/O errors up stream; it can have furher dependency on a common error-reporting
|
||||
* structure, such as GenericFailure for example
|
||||
*/
|
||||
[scriptable, uuid(2a5dd631-494f-4693-a2e1-15bbcc80846e)]
|
||||
interface nsISimpleFailure : nsISupports
|
||||
{
|
||||
readonly attribute unsigned long osErrorCode;
|
||||
readonly attribute unsigned long errorCode;
|
||||
readonly attribute string message;
|
||||
};
|
Загрузка…
Ссылка в новой задаче