Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 99af515

Browse files
author
Wilmer Paulino
committed
Bug 1237668 - Remove nsSimpleUnicharStreamFactory r=froydnj
1 parent b748ff7 commit 99af515

6 files changed

Lines changed: 8 additions & 85 deletions

File tree

extensions/spellcheck/src/mozPersonalDictionary.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,7 @@ void mozPersonalDictionary::SyncLoadInternal()
304304
NS_NewLocalFileInputStream(getter_AddRefs(inStream), mFile);
305305

306306
nsCOMPtr<nsIUnicharInputStream> convStream;
307-
rv = nsSimpleUnicharStreamFactory::GetInstance()->
308-
CreateInstanceFromUTF8Stream(inStream, getter_AddRefs(convStream));
307+
rv = NS_NewUnicharInputStream(inStream, getter_AddRefs(convStream));
309308
if (NS_FAILED(rv)) {
310309
return;
311310
}

parser/htmlparser/nsExpatDriver.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,8 +710,7 @@ nsExpatDriver::HandleExternalEntityRef(const char16_t *openEntityNames,
710710
}
711711

712712
nsCOMPtr<nsIUnicharInputStream> uniIn;
713-
rv = nsSimpleUnicharStreamFactory::GetInstance()->
714-
CreateInstanceFromUTF8Stream(in, getter_AddRefs(uniIn));
713+
rv = NS_NewUnicharInputStream(in, getter_AddRefs(uniIn));
715714
NS_ENSURE_SUCCESS(rv, 1);
716715

717716
int result = 1;

xpcom/build/XPCOMInit.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,6 @@ char16_t* gGREBinPath = nullptr;
278278

279279
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
280280
static NS_DEFINE_CID(kINIParserFactoryCID, NS_INIPARSERFACTORY_CID);
281-
static NS_DEFINE_CID(kSimpleUnicharStreamFactoryCID,
282-
NS_SIMPLE_UNICHAR_STREAM_FACTORY_CID);
283281

284282
NS_DEFINE_NAMED_CID(NS_CHROMEREGISTRY_CID);
285283
NS_DEFINE_NAMED_CID(NS_CHROMEPROTOCOLHANDLER_CID);
@@ -300,14 +298,6 @@ CreateINIParserFactory(const mozilla::Module& aModule,
300298
return f.forget();
301299
}
302300

303-
static already_AddRefed<nsIFactory>
304-
CreateUnicharStreamFactory(const mozilla::Module& aModule,
305-
const mozilla::Module::CIDEntry& aEntry)
306-
{
307-
return already_AddRefed<nsIFactory>(
308-
nsSimpleUnicharStreamFactory::GetInstance());
309-
}
310-
311301
#define COMPONENT(NAME, Ctor) static NS_DEFINE_CID(kNS_##NAME##_CID, NS_##NAME##_CID);
312302
#include "XPCOMModule.inc"
313303
#undef COMPONENT
@@ -316,7 +306,6 @@ CreateUnicharStreamFactory(const mozilla::Module& aModule,
316306
const mozilla::Module::CIDEntry kXPCOMCIDEntries[] = {
317307
{ &kComponentManagerCID, true, nullptr, nsComponentManagerImpl::Create },
318308
{ &kINIParserFactoryCID, false, CreateINIParserFactory },
319-
{ &kSimpleUnicharStreamFactoryCID, false, CreateUnicharStreamFactory },
320309
#include "XPCOMModule.inc"
321310
{ &kNS_CHROMEREGISTRY_CID, false, nullptr, nsChromeRegistryConstructor },
322311
{ &kNS_CHROMEPROTOCOLHANDLER_CID, false, nullptr, nsChromeProtocolHandlerConstructor },

xpcom/ds/nsPersistentProperties.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,7 @@ NS_IMPL_ISUPPORTS(nsPersistentProperties, nsIPersistentProperties, nsIProperties
486486
NS_IMETHODIMP
487487
nsPersistentProperties::Load(nsIInputStream* aIn)
488488
{
489-
nsresult rv = nsSimpleUnicharStreamFactory::GetInstance()->
490-
CreateInstanceFromUTF8Stream(aIn, getter_AddRefs(mIn));
489+
nsresult rv = NS_NewUnicharInputStream(aIn, getter_AddRefs(mIn));
491490

492491
if (rv != NS_OK) {
493492
NS_WARNING("Error creating UnicharInputStream");

xpcom/io/nsUnicharInputStream.cpp

Lines changed: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -380,48 +380,9 @@ UTF8InputStream::CountValidUTF8Bytes(const char* aBuffer, uint32_t aMaxBytes,
380380
aValidUTF16CodeUnits = utf16length;
381381
}
382382

383-
NS_IMPL_QUERY_INTERFACE(nsSimpleUnicharStreamFactory,
384-
nsIFactory,
385-
nsISimpleUnicharStreamFactory)
386-
387-
NS_IMETHODIMP_(MozExternalRefCountType)
388-
nsSimpleUnicharStreamFactory::AddRef()
389-
{
390-
return 2;
391-
}
392-
NS_IMETHODIMP_(MozExternalRefCountType)
393-
nsSimpleUnicharStreamFactory::Release()
394-
{
395-
return 1;
396-
}
397-
398-
NS_IMETHODIMP
399-
nsSimpleUnicharStreamFactory::CreateInstance(nsISupports* aOuter, REFNSIID aIID,
400-
void** aResult)
401-
{
402-
return NS_ERROR_NOT_IMPLEMENTED;
403-
}
404-
405-
NS_IMETHODIMP
406-
nsSimpleUnicharStreamFactory::LockFactory(bool aLock)
407-
{
408-
return NS_OK;
409-
}
410-
411-
NS_IMETHODIMP
412-
nsSimpleUnicharStreamFactory::CreateInstanceFromString(const nsAString& aString,
413-
nsIUnicharInputStream** aResult)
414-
{
415-
RefPtr<StringUnicharInputStream> it = new StringUnicharInputStream(aString);
416-
417-
it.forget(aResult);
418-
return NS_OK;
419-
}
420-
421-
NS_IMETHODIMP
422-
nsSimpleUnicharStreamFactory::CreateInstanceFromUTF8Stream(
423-
nsIInputStream* aStreamToWrap,
424-
nsIUnicharInputStream** aResult)
383+
nsresult
384+
NS_NewUnicharInputStream(nsIInputStream* aStreamToWrap,
385+
nsIUnicharInputStream** aResult)
425386
{
426387
*aResult = nullptr;
427388

@@ -435,10 +396,3 @@ nsSimpleUnicharStreamFactory::CreateInstanceFromUTF8Stream(
435396
it.forget(aResult);
436397
return NS_OK;
437398
}
438-
439-
nsSimpleUnicharStreamFactory*
440-
nsSimpleUnicharStreamFactory::GetInstance()
441-
{
442-
static const nsSimpleUnicharStreamFactory kInstance;
443-
return const_cast<nsSimpleUnicharStreamFactory*>(&kInstance);
444-
}

xpcom/io/nsUnicharInputStream.h

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,8 @@
99

1010
#include "nsISimpleUnicharStreamFactory.h"
1111
#include "nsIUnicharInputStream.h"
12-
#include "nsIFactory.h"
1312

14-
// {428DCA6F-1A0F-4cda-B516-0D5244745A6A}
15-
#define NS_SIMPLE_UNICHAR_STREAM_FACTORY_CID \
16-
{ 0x428dca6f, 0x1a0f, 0x4cda, { 0xb5, 0x16, 0xd, 0x52, 0x44, 0x74, 0x5a, 0x6a } }
17-
18-
class nsSimpleUnicharStreamFactory
19-
: public nsIFactory
20-
, private nsISimpleUnicharStreamFactory
21-
{
22-
public:
23-
nsSimpleUnicharStreamFactory()
24-
{
25-
}
26-
NS_DECL_ISUPPORTS_INHERITED
27-
NS_DECL_NSIFACTORY
28-
NS_DECL_NSISIMPLEUNICHARSTREAMFACTORY
29-
30-
static nsSimpleUnicharStreamFactory* GetInstance();
31-
};
13+
nsresult NS_NewUnicharInputStream(nsIInputStream* aStreamToWrap,
14+
nsIUnicharInputStream** aResult);
3215

3316
#endif // nsUnicharInputStream_h__

0 commit comments

Comments
 (0)