зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1408333 Get rid of nsIIPCBackgroundChildCreateCallback - part 18 - Layout, r=asuth
This commit is contained in:
Родитель
be83c65dce
Коммит
bf6ccd477f
|
@ -61,7 +61,6 @@
|
||||||
#include "gfxPrefs.h"
|
#include "gfxPrefs.h"
|
||||||
#include "BackgroundChild.h"
|
#include "BackgroundChild.h"
|
||||||
#include "mozilla/ipc/PBackgroundChild.h"
|
#include "mozilla/ipc/PBackgroundChild.h"
|
||||||
#include "nsIIPCBackgroundChildCreateCallback.h"
|
|
||||||
#include "mozilla/layout/VsyncChild.h"
|
#include "mozilla/layout/VsyncChild.h"
|
||||||
#include "VsyncSource.h"
|
#include "VsyncSource.h"
|
||||||
#include "mozilla/VsyncDispatcher.h"
|
#include "mozilla/VsyncDispatcher.h"
|
||||||
|
@ -973,47 +972,6 @@ protected:
|
||||||
uint32_t mNextDriverIndex;
|
uint32_t mNextDriverIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
// The PBackground protocol connection callback. It will be called when
|
|
||||||
// PBackground is ready. Then we create the PVsync sub-protocol for our
|
|
||||||
// vsync-base RefreshTimer.
|
|
||||||
class VsyncChildCreateCallback final : public nsIIPCBackgroundChildCreateCallback
|
|
||||||
{
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
|
|
||||||
public:
|
|
||||||
VsyncChildCreateCallback()
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
|
||||||
}
|
|
||||||
|
|
||||||
static void CreateVsyncActor(PBackgroundChild* aPBackgroundChild)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
|
||||||
MOZ_ASSERT(aPBackgroundChild);
|
|
||||||
|
|
||||||
layout::PVsyncChild* actor = aPBackgroundChild->SendPVsyncConstructor();
|
|
||||||
layout::VsyncChild* child = static_cast<layout::VsyncChild*>(actor);
|
|
||||||
nsRefreshDriver::PVsyncActorCreated(child);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
virtual ~VsyncChildCreateCallback() = default;
|
|
||||||
|
|
||||||
void ActorCreated(PBackgroundChild* aPBackgroundChild) override
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
|
||||||
MOZ_ASSERT(aPBackgroundChild);
|
|
||||||
CreateVsyncActor(aPBackgroundChild);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActorFailed() override
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
|
||||||
MOZ_CRASH("Failed To Create VsyncChild Actor");
|
|
||||||
}
|
|
||||||
}; // VsyncChildCreateCallback
|
|
||||||
NS_IMPL_ISUPPORTS(VsyncChildCreateCallback, nsIIPCBackgroundChildCreateCallback)
|
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
static RefreshDriverTimer* sRegularRateTimer;
|
static RefreshDriverTimer* sRegularRateTimer;
|
||||||
|
@ -1026,24 +984,22 @@ CreateContentVsyncRefreshTimer(void*)
|
||||||
MOZ_ASSERT(!XRE_IsParentProcess());
|
MOZ_ASSERT(!XRE_IsParentProcess());
|
||||||
|
|
||||||
// Create the PVsync actor child for vsync-base refresh timer.
|
// Create the PVsync actor child for vsync-base refresh timer.
|
||||||
// PBackgroundChild is created asynchronously. If PBackgroundChild is still
|
// PBackgroundChild is created synchronously. We will still use software
|
||||||
// unavailable, setup VsyncChildCreateCallback callback to handle the async
|
// timer before PVsync ready, and change to use hw timer when the connection
|
||||||
// connect. We will still use software timer before PVsync ready, and change
|
// is done. Please check nsRefreshDriver::PVsyncActorCreated().
|
||||||
// to use hw timer when the connection is done. Please check
|
|
||||||
// VsyncChildCreateCallback::CreateVsyncActor() and
|
PBackgroundChild* actorChild = BackgroundChild::GetOrCreateForCurrentThread();
|
||||||
// nsRefreshDriver::PVsyncActorCreated().
|
if (NS_WARN_IF(!actorChild)) {
|
||||||
PBackgroundChild* backgroundChild = BackgroundChild::GetForCurrentThread();
|
|
||||||
if (backgroundChild) {
|
|
||||||
// If we already have PBackgroundChild, create the
|
|
||||||
// child VsyncRefreshDriverTimer here.
|
|
||||||
VsyncChildCreateCallback::CreateVsyncActor(backgroundChild);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Setup VsyncChildCreateCallback callback
|
|
||||||
RefPtr<nsIIPCBackgroundChildCreateCallback> callback = new VsyncChildCreateCallback();
|
|
||||||
if (NS_WARN_IF(!BackgroundChild::GetOrCreateForCurrentThread(callback))) {
|
|
||||||
MOZ_CRASH("PVsync actor create failed!");
|
MOZ_CRASH("PVsync actor create failed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
layout::PVsyncChild* actor = actorChild->SendPVsyncConstructor();
|
||||||
|
if (NS_WARN_IF(!actor)) {
|
||||||
|
MOZ_CRASH("PVsyncChild actor create failed!");
|
||||||
|
}
|
||||||
|
|
||||||
|
layout::VsyncChild* child = static_cast<layout::VsyncChild*>(actor);
|
||||||
|
nsRefreshDriver::PVsyncActorCreated(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Загрузка…
Ссылка в новой задаче