Necko Interfaces Overview 编辑
Warning: The content of this article may be out of date. It was last updated in 2001.
nsIIOService
- central necko service
- manages protocol handlers
- thin layer over protocol handlers
- provides interface for creating URI objects from URI strings
- maps URI scheme to appropriate nsIProtocolHandler impl
nsIURI (nsIURL, nsIFileURL, nsIStandardURL)
- represents an URI, with getters and setters for various URI parts (eg. scheme, host, path, ...)
- per protocol implementation
- necko provides URI impl's for common URI formats (see nsStandardURL, nsSimpleURI)
nsIChannel : nsIRequest
- represents a logical connection to the resource identified by a nsIURI
- per protocol implementation
- single use (ie. channel is used to download the resource once)
- download initiated via nsIChannel::AsyncOpen method
- can be canceled via nsIRequest::Cancel method at anytime after invocation of AsyncOpen method
nsIProtocolHandler
- a service that manages a protocol, identified by it's URI scheme (eg. http)
- maps URI string to nsIURI instance via NewURI method
- creates nsIChannel instance from nsIURI instance via NewChannel method
nsIStreamListener : nsIRequestObserver
- implemented by the consumer of a nsIChannel instance
- passed to nsIChannel::AsyncOpen method
- nsIRequestObserver::OnStartRequest - notifies start of async download
- nsIStreamListener::OnDataAvailable - notifies presence of downloaded data
- nsIRequestObserver::OnStopRequest - notifies completion of async download, possibly w/ error
nsILoadGroup : nsIRequest
- attribute of a nsIRequest
- channel impl adds itself to its load group during invocation of AsyncOpen
- channel impl removes itself from its load group when download completes
- load groups in gecko own all channels used to load a particular page (until the channels complete)
- all channels owned by a load group can be canceled at once via the load group's nsIRequest::Cancel method
Original Document Information
nsITransport
- represents a physical connection, such as a file descriptor or a socket
- used directly by protocol handler implementations (as well as by mailnews and chatzilla)
- synchronous I/O methods: OpenInputStream, OpenOutputStream
- asynchronous I/O methods: AsyncRead, AsyncWrite
- nsITransport::AsyncRead takes a nsIStreamListener parameter
- Author(s): Darin Fisher
- Last Updated Date: December 10, 2001
- Copyright Information: Portions of this content are © 1998–2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论