Bug 1690340 - Part 1: Hide all the panel tools in the developer tools menu. r=jdescottes
[gecko.git] / parser / html / nsHtml5StreamListener.cpp
blob93a7c4657a584c46970a91e9872f4c4ad4574067
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "nsHtml5StreamListener.h"
7 NS_IMPL_ADDREF(nsHtml5StreamListener)
8 NS_IMPL_RELEASE(nsHtml5StreamListener)
10 NS_INTERFACE_MAP_BEGIN(nsHtml5StreamListener)
11 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIRequestObserver)
12 NS_INTERFACE_MAP_ENTRY(nsIRequestObserver)
13 NS_INTERFACE_MAP_ENTRY(nsIStreamListener)
14 NS_INTERFACE_MAP_ENTRY(nsIThreadRetargetableStreamListener)
15 NS_INTERFACE_MAP_END
17 nsHtml5StreamListener::nsHtml5StreamListener(nsHtml5StreamParser* aDelegate)
18 : mDelegate(aDelegate) {}
20 nsHtml5StreamListener::~nsHtml5StreamListener() {}
22 void nsHtml5StreamListener::DropDelegate() {
23 MOZ_ASSERT(NS_IsMainThread(),
24 "Must not call DropDelegate from non-main threads.");
25 mDelegate = nullptr;
28 NS_IMETHODIMP
29 nsHtml5StreamListener::CheckListenerChain() {
30 if (MOZ_UNLIKELY(!mDelegate)) {
31 return NS_ERROR_NOT_AVAILABLE;
33 return mDelegate->CheckListenerChain();
36 NS_IMETHODIMP
37 nsHtml5StreamListener::OnStartRequest(nsIRequest* aRequest) {
38 if (MOZ_UNLIKELY(!mDelegate)) {
39 return NS_ERROR_NOT_AVAILABLE;
41 return mDelegate->OnStartRequest(aRequest);
44 NS_IMETHODIMP
45 nsHtml5StreamListener::OnStopRequest(nsIRequest* aRequest, nsresult aStatus) {
46 if (MOZ_UNLIKELY(!mDelegate)) {
47 return NS_ERROR_NOT_AVAILABLE;
49 return mDelegate->OnStopRequest(aRequest, aStatus);
52 NS_IMETHODIMP
53 nsHtml5StreamListener::OnDataAvailable(nsIRequest* aRequest,
54 nsIInputStream* aInStream,
55 uint64_t aSourceOffset,
56 uint32_t aLength) {
57 if (MOZ_UNLIKELY(!mDelegate)) {
58 return NS_ERROR_NOT_AVAILABLE;
60 return mDelegate->OnDataAvailable(aRequest, aInStream, aSourceOffset,
61 aLength);