Skip to content

Commit

Permalink
Bug 1603121 - Remove imgRequestProxy::IsOnEventTarget; r=tnikkel
Browse files Browse the repository at this point in the history
and some dead code in imgRequestProxy.

Differential Revision: https://phabricator.services.mozilla.com/D82157
  • Loading branch information
EdgarChen committed Jul 3, 2020
1 parent 2e3d4f1 commit 5d7821d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 37 deletions.
35 changes: 0 additions & 35 deletions image/imgRequestProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,6 @@ void imgRequestProxy::ClearValidating() {
}
}

bool imgRequestProxy::IsOnEventTarget() const { return true; }

already_AddRefed<nsIEventTarget> imgRequestProxy::GetEventTarget() const {
nsCOMPtr<nsIEventTarget> target(mEventTarget);
return target.forget();
Expand All @@ -274,17 +272,6 @@ nsresult imgRequestProxy::DispatchWithTargetIfAvailable(
return NS_DispatchToMainThread(CreateMediumHighRunnable(std::move(aEvent)));
}

void imgRequestProxy::DispatchWithTarget(already_AddRefed<nsIRunnable> aEvent) {
LOG_FUNC(gImgLog, "imgRequestProxy::DispatchWithTarget");

MOZ_ASSERT(mListener);
MOZ_ASSERT(mEventTarget);

mHadDispatch = true;
mEventTarget->Dispatch(CreateMediumHighRunnable(std::move(aEvent)),
NS_DISPATCH_NORMAL);
}

void imgRequestProxy::AddToOwner(Document* aLoadingDocument) {
// An imgRequestProxy can be initialized with neither a listener nor a
// document. The caller could follow up later by cloning the canonical
Expand Down Expand Up @@ -987,21 +974,6 @@ void imgRequestProxy::Notify(int32_t aType,
return;
}

if (!IsOnEventTarget()) {
RefPtr<imgRequestProxy> self(this);
if (aRect) {
const mozilla::gfx::IntRect rect = *aRect;
DispatchWithTarget(NS_NewRunnableFunction(
"imgRequestProxy::Notify",
[self, rect, aType]() -> void { self->Notify(aType, &rect); }));
} else {
DispatchWithTarget(NS_NewRunnableFunction(
"imgRequestProxy::Notify",
[self, aType]() -> void { self->Notify(aType, nullptr); }));
}
return;
}

// Make sure the listener stays alive while we notify.
nsCOMPtr<imgINotificationObserver> listener(mListener);

Expand All @@ -1016,13 +988,6 @@ void imgRequestProxy::OnLoadComplete(bool aLastPart) {
// listener, etc). Don't let them do it.
RefPtr<imgRequestProxy> self(this);

if (!IsOnEventTarget()) {
DispatchWithTarget(NS_NewRunnableFunction(
"imgRequestProxy::OnLoadComplete",
[self, aLastPart]() -> void { self->OnLoadComplete(aLastPart); }));
return;
}

if (mListener && !mCanceled) {
// Hold a ref to the listener while we call it, just in case.
nsCOMPtr<imgINotificationObserver> listener(mListener);
Expand Down
2 changes: 0 additions & 2 deletions image/imgRequestProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ class imgRequestProxy : public mozilla::PreloaderBase,
void MarkValidating();
void ClearValidating();

bool IsOnEventTarget() const;
already_AddRefed<nsIEventTarget> GetEventTarget() const override;

// Removes all animation consumers that were created with
Expand Down Expand Up @@ -203,7 +202,6 @@ class imgRequestProxy : public mozilla::PreloaderBase,
void RemoveFromOwner(nsresult aStatus);

nsresult DispatchWithTargetIfAvailable(already_AddRefed<nsIRunnable> aEvent);
void DispatchWithTarget(already_AddRefed<nsIRunnable> aEvent);

// The URI of our request.
nsCOMPtr<nsIURI> mURI;
Expand Down

0 comments on commit 5d7821d

Please sign in to comment.