Bug 1501404 - Part 7: Remove the XPCOM registration for nsSyncStreamListener r=valentin

Depends on D9575

Differential Revision: https://phabricator.services.mozilla.com/D9576

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ehsan Akhgari 2018-10-23 20:07:29 +00:00
Родитель f6b7bc0052
Коммит d0ee7e43f9
5 изменённых файлов: 23 добавлений и 27 удалений

Просмотреть файл

@ -60,7 +60,7 @@
#include "nsIIncrementalStreamLoader.h"
#include "nsIStreamTransportService.h"
#include "nsStringStream.h"
#include "nsISyncStreamListener.h"
#include "nsSyncStreamListener.h"
#include "nsITransport.h"
#include "nsIURIWithSpecialOrigin.h"
#include "nsIURLParser.h"
@ -1186,16 +1186,15 @@ nsresult
NS_NewSyncStreamListener(nsIStreamListener **result,
nsIInputStream **stream)
{
nsresult rv;
nsCOMPtr<nsISyncStreamListener> listener =
do_CreateInstance(NS_SYNCSTREAMLISTENER_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv)) {
rv = listener->GetInputStream(stream);
nsCOMPtr<nsISyncStreamListener> listener = nsSyncStreamListener::Create();
if (listener) {
nsresult rv = listener->GetInputStream(stream);
if (NS_SUCCEEDED(rv)) {
listener.forget(result);
}
return rv;
}
return rv;
return NS_ERROR_FAILURE;
}
nsresult

Просмотреть файл

@ -21,6 +21,19 @@ nsSyncStreamListener::Init()
false);
}
// static
already_AddRefed<nsISyncStreamListener>
nsSyncStreamListener::Create()
{
MOZ_ASSERT(NS_IsMainThread());
RefPtr<nsSyncStreamListener> inst = new nsSyncStreamListener();
nsresult rv = inst->Init();
NS_ENSURE_SUCCESS(rv, nullptr);
return inst.forget();
}
nsresult
nsSyncStreamListener::WaitForData()
{

Просмотреть файл

@ -23,16 +23,17 @@ public:
NS_DECL_NSISYNCSTREAMLISTENER
NS_DECL_NSIINPUTSTREAM
static already_AddRefed<nsISyncStreamListener> Create();
private:
nsSyncStreamListener()
: mStatus(NS_OK)
, mKeepWaiting(false)
, mDone(false) {}
~nsSyncStreamListener() = default;
nsresult Init();
private:
~nsSyncStreamListener() = default;
nsresult WaitForData();
nsCOMPtr<nsIInputStream> mPipeIn;

Просмотреть файл

@ -294,17 +294,6 @@
{0xbb, 0xae, 0xcc, 0x0d, 0xe5, 0x39, 0xf6, 0x1a} \
}
// component implementing nsISyncStreamListener.
#define NS_SYNCSTREAMLISTENER_CONTRACTID \
"@mozilla.org/network/sync-stream-listener;1"
#define NS_SYNCSTREAMLISTENER_CID \
{ /* 439400d3-6f23-43db-8b06-8aafe1869bd8 */ \
0x439400d3, \
0x6f23, \
0x43db, \
{0x8b, 0x06, 0x8a, 0xaf, 0xe1, 0x86, 0x9b, 0xd8} \
}
// component implementing nsIIncrementalDownload.
#define NS_INCREMENTALDOWNLOAD_CONTRACTID \
"@mozilla.org/network/incremental-download;1"

Просмотреть файл

@ -107,9 +107,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(BackgroundFileSaverStreamListener, Init)
} // namespace net
} // namespace mozilla
#include "nsSyncStreamListener.h"
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSyncStreamListener, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAtomicFileOutputStream)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSafeFileOutputStream)
@ -657,7 +654,6 @@ NS_DEFINE_NAMED_CID(NS_INCREMENTALSTREAMLOADER_CID);
NS_DEFINE_NAMED_CID(NS_DOWNLOADER_CID);
NS_DEFINE_NAMED_CID(NS_BACKGROUNDFILESAVEROUTPUTSTREAM_CID);
NS_DEFINE_NAMED_CID(NS_BACKGROUNDFILESAVERSTREAMLISTENER_CID);
NS_DEFINE_NAMED_CID(NS_SYNCSTREAMLISTENER_CID);
NS_DEFINE_NAMED_CID(NS_SIMPLESTREAMLISTENER_CID);
NS_DEFINE_NAMED_CID(NS_STREAMLISTENERTEE_CID);
NS_DEFINE_NAMED_CID(NS_LOADGROUP_CID);
@ -767,7 +763,6 @@ static const mozilla::Module::CIDEntry kNeckoCIDs[] = {
mozilla::net::BackgroundFileSaverOutputStreamConstructor },
{ &kNS_BACKGROUNDFILESAVERSTREAMLISTENER_CID, false, nullptr,
mozilla::net::BackgroundFileSaverStreamListenerConstructor },
{ &kNS_SYNCSTREAMLISTENER_CID, false, nullptr, nsSyncStreamListenerConstructor },
{ &kNS_SIMPLESTREAMLISTENER_CID, false, nullptr, nsSimpleStreamListenerConstructor },
{ &kNS_STREAMLISTENERTEE_CID, false, nullptr, nsStreamListenerTeeConstructor },
{ &kNS_LOADGROUP_CID, false, nullptr, nsLoadGroupConstructor },
@ -878,7 +873,6 @@ static const mozilla::Module::ContractIDEntry kNeckoContracts[] = {
{ NS_DOWNLOADER_CONTRACTID, &kNS_DOWNLOADER_CID },
{ NS_BACKGROUNDFILESAVEROUTPUTSTREAM_CONTRACTID, &kNS_BACKGROUNDFILESAVEROUTPUTSTREAM_CID },
{ NS_BACKGROUNDFILESAVERSTREAMLISTENER_CONTRACTID, &kNS_BACKGROUNDFILESAVERSTREAMLISTENER_CID },
{ NS_SYNCSTREAMLISTENER_CONTRACTID, &kNS_SYNCSTREAMLISTENER_CID },
{ NS_SIMPLESTREAMLISTENER_CONTRACTID, &kNS_SIMPLESTREAMLISTENER_CID },
{ NS_STREAMLISTENERTEE_CONTRACTID, &kNS_STREAMLISTENERTEE_CID },
{ NS_LOADGROUP_CONTRACTID, &kNS_LOADGROUP_CID },