diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /parser/html/nsHtml5StreamListener.cpp | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'parser/html/nsHtml5StreamListener.cpp')
-rw-r--r-- | parser/html/nsHtml5StreamListener.cpp | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/parser/html/nsHtml5StreamListener.cpp b/parser/html/nsHtml5StreamListener.cpp new file mode 100644 index 000000000..a585ce8de --- /dev/null +++ b/parser/html/nsHtml5StreamListener.cpp @@ -0,0 +1,82 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsHtml5StreamListener.h" + +NS_IMPL_ADDREF(nsHtml5StreamListener) +NS_IMPL_RELEASE(nsHtml5StreamListener) + +NS_INTERFACE_MAP_BEGIN(nsHtml5StreamListener) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIRequestObserver) + NS_INTERFACE_MAP_ENTRY(nsIRequestObserver) + NS_INTERFACE_MAP_ENTRY(nsIStreamListener) + NS_INTERFACE_MAP_ENTRY(nsIThreadRetargetableStreamListener) +NS_INTERFACE_MAP_END_THREADSAFE + +nsHtml5StreamListener::nsHtml5StreamListener(nsHtml5StreamParser* aDelegate) + : mDelegate(aDelegate) +{ +} + +nsHtml5StreamListener::~nsHtml5StreamListener() +{ +} + +void +nsHtml5StreamListener::DropDelegate() +{ + MOZ_ASSERT(NS_IsMainThread(), + "Must not call DropDelegate from non-main threads."); + mDelegate = nullptr; +} + +NS_IMETHODIMP +nsHtml5StreamListener::CheckListenerChain() +{ + if (MOZ_UNLIKELY(!mDelegate)) { + return NS_ERROR_NOT_AVAILABLE; + } + return mDelegate->CheckListenerChain(); +} + +NS_IMETHODIMP +nsHtml5StreamListener::OnStartRequest(nsIRequest* aRequest, + nsISupports* aContext) +{ + if (MOZ_UNLIKELY(!mDelegate)) { + return NS_ERROR_NOT_AVAILABLE; + } + return mDelegate->OnStartRequest(aRequest, aContext); +} + +NS_IMETHODIMP +nsHtml5StreamListener::OnStopRequest(nsIRequest* aRequest, + nsISupports* aContext, + nsresult aStatus) +{ + if (MOZ_UNLIKELY(!mDelegate)) { + return NS_ERROR_NOT_AVAILABLE; + } + return mDelegate->OnStopRequest(aRequest, + aContext, + aStatus); +} + +NS_IMETHODIMP +nsHtml5StreamListener::OnDataAvailable(nsIRequest* aRequest, + nsISupports* aContext, + nsIInputStream* aInStream, + uint64_t aSourceOffset, + uint32_t aLength) +{ + if (MOZ_UNLIKELY(!mDelegate)) { + return NS_ERROR_NOT_AVAILABLE; + } + return mDelegate->OnDataAvailable(aRequest, + aContext, + aInStream, + aSourceOffset, + aLength); +} + |