зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1275314 - Allow flushing in-progress checkerboard reports in the GPU process as well. r=dvander
MozReview-Commit-ID: CXLzkiloHW
This commit is contained in:
Родитель
76e61ea656
Коммит
e6f4f137d8
|
@ -123,6 +123,17 @@ GPUChild::RecvInitCrashReporter(Shmem&& aShmem)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
GPUChild::RecvNotifyUiObservers(const nsCString& aTopic)
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService();
|
||||
MOZ_ASSERT(obsSvc);
|
||||
if (obsSvc) {
|
||||
obsSvc->NotifyObservers(nullptr, aTopic.get(), nullptr);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
GPUChild::ActorDestroy(ActorDestroyReason aWhy)
|
||||
{
|
||||
|
|
|
@ -40,6 +40,7 @@ public:
|
|||
bool RecvInitCrashReporter(Shmem&& shmem) override;
|
||||
void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
bool RecvGraphicsError(const nsCString& aError) override;
|
||||
bool RecvNotifyUiObservers(const nsCString& aTopic) override;
|
||||
|
||||
static void Destroy(UniquePtr<GPUChild>&& aChild);
|
||||
|
||||
|
|
|
@ -305,6 +305,17 @@ GPUParent::RecvAddLayerTreeIdMapping(const uint64_t& aLayersId, const ProcessId&
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
GPUParent::RecvNotifyGpuObservers(const nsCString& aTopic)
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService();
|
||||
MOZ_ASSERT(obsSvc);
|
||||
if (obsSvc) {
|
||||
obsSvc->NotifyObservers(nullptr, aTopic.get(), nullptr);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
GPUParent::ActorDestroy(ActorDestroyReason aWhy)
|
||||
{
|
||||
|
|
|
@ -47,6 +47,7 @@ public:
|
|||
bool RecvDeallocateLayerTreeId(const uint64_t& aLayersId) override;
|
||||
bool RecvGetDeviceStatus(GPUDeviceData* aOutStatus) override;
|
||||
bool RecvAddLayerTreeIdMapping(const uint64_t& aLayersId, const ProcessId& aOwnerId) override;
|
||||
bool RecvNotifyGpuObservers(const nsCString& aTopic) override;
|
||||
|
||||
void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
|
||||
|
|
|
@ -740,5 +740,16 @@ GPUProcessManager::RemoveListener(GPUProcessListener* aListener)
|
|||
mListeners.RemoveElement(aListener);
|
||||
}
|
||||
|
||||
bool
|
||||
GPUProcessManager::NotifyGpuObservers(const char* aTopic)
|
||||
{
|
||||
if (!mGPUChild) {
|
||||
return false;
|
||||
}
|
||||
nsCString topic(aTopic);
|
||||
mGPUChild->SendNotifyGpuObservers(topic);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -128,6 +128,10 @@ public:
|
|||
void AddListener(GPUProcessListener* aListener);
|
||||
void RemoveListener(GPUProcessListener* aListener);
|
||||
|
||||
// Send a message to the GPU process observer service to broadcast. Returns
|
||||
// true if the message was sent, false if not.
|
||||
bool NotifyGpuObservers(const char* aTopic);
|
||||
|
||||
// Returns access to the PGPU protocol if a GPU process is present.
|
||||
GPUChild* GetGPUChild() {
|
||||
return mGPUChild;
|
||||
|
|
|
@ -68,6 +68,10 @@ parent:
|
|||
// one is available (i.e., Init has completed).
|
||||
sync GetDeviceStatus() returns (GPUDeviceData status);
|
||||
|
||||
// Have a message be broadcasted to the GPU process by the GPU process
|
||||
// observer service.
|
||||
async NotifyGpuObservers(nsCString aTopic);
|
||||
|
||||
child:
|
||||
// Sent when the GPU process has initialized devices. This occurs once, after
|
||||
// Init().
|
||||
|
@ -80,6 +84,10 @@ child:
|
|||
async GraphicsError(nsCString aError);
|
||||
|
||||
async InitCrashReporter(Shmem shmem);
|
||||
|
||||
// Have a message be broadcasted to the UI process by the UI process
|
||||
// observer service.
|
||||
async NotifyUiObservers(nsCString aTopic);
|
||||
};
|
||||
|
||||
} // namespace gfx
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "InputData.h" // for InputData, etc
|
||||
#include "Layers.h" // for Layer, etc
|
||||
#include "mozilla/dom/Touch.h" // for Touch
|
||||
#include "mozilla/gfx/GPUParent.h" // for GPUParent
|
||||
#include "mozilla/gfx/Logging.h" // for gfx::TreeLog
|
||||
#include "mozilla/gfx/Point.h" // for Point
|
||||
#include "mozilla/layers/APZThreadUtils.h" // for AssertOnCompositorThread, etc
|
||||
|
@ -138,10 +139,17 @@ APZCTreeManager::CheckerboardFlushObserver::Observe(nsISupports* aSubject,
|
|||
}
|
||||
});
|
||||
}
|
||||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService();
|
||||
if (obsSvc) {
|
||||
obsSvc->NotifyObservers(nullptr, "APZ:FlushActiveCheckerboard:Done", nullptr);
|
||||
if (XRE_IsGPUProcess()) {
|
||||
if (gfx::GPUParent* gpu = gfx::GPUParent::GetSingleton()) {
|
||||
nsCString topic("APZ:FlushActiveCheckerboard:Done");
|
||||
Unused << gpu->SendNotifyUiObservers(topic);
|
||||
}
|
||||
} else {
|
||||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService();
|
||||
if (obsSvc) {
|
||||
obsSvc->NotifyObservers(nullptr, "APZ:FlushActiveCheckerboard:Done", nullptr);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/dom/CheckerboardReportServiceBinding.h" // for dom::CheckerboardReports
|
||||
#include "mozilla/gfx/GPUParent.h"
|
||||
#include "mozilla/gfx/GPUProcessManager.h"
|
||||
#include "nsContentUtils.h" // for nsContentUtils
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
|
@ -211,6 +212,10 @@ void
|
|||
CheckerboardReportService::FlushActiveReports()
|
||||
{
|
||||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
gfx::GPUProcessManager* gpu = gfx::GPUProcessManager::Get();
|
||||
if (gpu && gpu->NotifyGpuObservers("APZ:FlushActiveCheckerboard")) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService();
|
||||
MOZ_ASSERT(obsSvc);
|
||||
|
|
Загрузка…
Ссылка в новой задаче