mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 14:55:47 +00:00
7f73aa6ef7
This patch contains two parts below: 1. mNeckoTarget Since almost all child channels in necko need mNeckoTarget to dispatch runnables to main thread, it seems worth to have a holder class of mNeckoTarget and ask child channels to inherit it. 2. ChannelEvent A lot of classes in FTPChannelChild and HttpChannelChild inheriting ChannelEvent and override GetEventTarget. It should be worth to extract the same code and put it in the same space.
29 lines
693 B
C++
29 lines
693 B
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set sw=2 ts=8 et tw=80 : */
|
|
|
|
/* 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 "NeckoTargetHolder.h"
|
|
|
|
#include "nsContentUtils.h"
|
|
#include "nsILoadInfo.h"
|
|
|
|
namespace mozilla {
|
|
namespace net {
|
|
|
|
already_AddRefed<nsIEventTarget>
|
|
NeckoTargetHolder::GetNeckoTarget()
|
|
{
|
|
nsCOMPtr<nsIEventTarget> target = mNeckoTarget;
|
|
|
|
if (!target) {
|
|
target = do_GetMainThread();
|
|
}
|
|
return target.forget();
|
|
}
|
|
|
|
} // namespace net
|
|
} // namespace mozilla
|