32 #ifndef __METADATA_CHANNEL_H__
33 #define __METADATA_CHANNEL_H__
37 #include <nsStringGlue.h>
39 #include <nsIChannelEventSink.h>
40 #include <nsIInterfaceRequestor.h>
42 #include "sbIMetadataChannel.h"
46 #define SONGBIRD_METADATACHANNEL_CONTRACTID \
47 "@songbirdnest.com/Songbird/MetadataChannel;1"
48 #define SONGBIRD_METADATACHANNEL_CLASSNAME \
49 "Songbird Metadata Channel Helper"
50 #define SONGBIRD_METADATACHANNEL_CID \
55 {0x89, 0xa1, 0x37, 0x67, 0x49, 0xa4, 0xb2, 0x85} \
63 NS_DECL_SBIMETADATACHANNEL
64 NS_DECL_NSISTREAMLISTENER
65 NS_DECL_NSIREQUESTOBSERVER
68 virtual ~sbMetadataChannel();
70 NS_IMETHODIMP SetRedirectedChannel(
nsIChannel* aChannel);
73 enum sbBufferConstants
76 BLOCK_SIZE = ( 1 << SIZE_SHIFT ),
77 BLOCK_MASK = BLOCK_SIZE - 1
81 inline PRUint64 IDX( PRUint64
i ) {
return ( i >> SIZE_SHIFT ); }
82 inline PRUint64 POS( PRUint64 i ) {
return ( i & (PRUint64)BLOCK_MASK ); }
83 inline char * BUF( PRUint64 i ) {
return m_Blocks[ IDX(i) ].buf + POS(i); }
86 struct sbBufferBlock {
88 sbBufferBlock() {
buf = (
char *)nsMemory::Alloc( BLOCK_SIZE ); }
89 sbBufferBlock(
const sbBufferBlock &T ) {
buf = T.buf;
const_cast<sbBufferBlock &
>(T).
buf = nsnull; }
90 ~sbBufferBlock() {
if (
buf ) nsMemory::Free(
buf ); }
92 class blockmap_t :
public std::map<PRUint64, sbBufferBlock> {};
94 nsCOMPtr<nsIChannel> m_Channel;
95 nsCOMPtr<sbIMetadataHandler> m_Handler;
98 PRUint64 m_BufDeadZoneStart;
99 PRUint64 m_BufDeadZoneEnd;
109 NS_DECL_NSICHANNELEVENTSINK
110 NS_DECL_NSIINTERFACEREQUESTOR
115 ~sbMetadataChannelEventSink();
117 sbMetadataChannel* mMetadataChannel;
121 #define NS_ERROR_SONGBIRD_METADATA_CHANNEL_RESTART NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_GENERAL, 1 )
123 #endif // __METADATA_CHANNEL_H__
const nsIInterfaceRequestor
_getSelectedPageStyle s i