зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1745444 - Merge TestTriggerGPUMetrics and TestTriggerRDDMetrics into a method taking a process type as parameter, r=chutten.
Differential Revision: https://phabricator.services.mozilla.com/D133508
This commit is contained in:
Родитель
90b4404217
Коммит
e665115136
|
@ -625,8 +625,10 @@ mozilla::ipc::IPCResult GPUParent::RecvFlushFOGData(
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult GPUParent::RecvTestTriggerMetrics() {
|
||||
mozilla::ipc::IPCResult GPUParent::RecvTestTriggerMetrics(
|
||||
TestTriggerMetricsResolver&& aResolve) {
|
||||
mozilla::glean::test_only_ipc::a_counter.Add(45326);
|
||||
aResolve(true);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,8 @@ class GPUParent final : public PGPUParent {
|
|||
|
||||
mozilla::ipc::IPCResult RecvFlushFOGData(FlushFOGDataResolver&& aResolver);
|
||||
|
||||
mozilla::ipc::IPCResult RecvTestTriggerMetrics();
|
||||
mozilla::ipc::IPCResult RecvTestTriggerMetrics(
|
||||
TestTriggerMetricsResolver&& aResolve);
|
||||
|
||||
mozilla::ipc::IPCResult RecvCrashProcess();
|
||||
|
||||
|
|
|
@ -1273,10 +1273,14 @@ RefPtr<MemoryReportingProcess> GPUProcessManager::GetProcessMemoryReporter() {
|
|||
return new GPUMemoryReporter();
|
||||
}
|
||||
|
||||
void GPUProcessManager::TestTriggerMetrics() {
|
||||
RefPtr<PGPUChild::TestTriggerMetricsPromise>
|
||||
GPUProcessManager::TestTriggerMetrics() {
|
||||
if (!NS_WARN_IF(!mGPUChild)) {
|
||||
mGPUChild->SendTestTriggerMetrics();
|
||||
return mGPUChild->SendTestTriggerMetrics();
|
||||
}
|
||||
|
||||
return PGPUChild::TestTriggerMetricsPromise::CreateAndReject(
|
||||
ipc::ResponseRejectReason::SendError, __func__);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/dom/ipc/IdType.h"
|
||||
#include "mozilla/gfx/GPUProcessHost.h"
|
||||
#include "mozilla/gfx/PGPUChild.h"
|
||||
#include "mozilla/gfx/Point.h"
|
||||
#include "mozilla/ipc/ProtocolUtils.h"
|
||||
#include "mozilla/ipc/TaskFactory.h"
|
||||
|
@ -200,7 +201,7 @@ class GPUProcessManager final : public GPUProcessHost::Listener {
|
|||
*
|
||||
* Trigger GPU-process test metric instrumentation.
|
||||
*/
|
||||
void TestTriggerMetrics();
|
||||
RefPtr<PGPUChild::TestTriggerMetricsPromise> TestTriggerMetrics();
|
||||
|
||||
private:
|
||||
// Called from our xpcom-shutdown observer.
|
||||
|
|
|
@ -120,7 +120,8 @@ parent:
|
|||
|
||||
// Test-only method.
|
||||
// Asks the gpu process to trigger test-only instrumentation.
|
||||
async TestTriggerMetrics();
|
||||
// The unused returned value is to have a promise we can await.
|
||||
async TestTriggerMetrics() returns (bool unused);
|
||||
|
||||
// Causes the GPU process to crash. Used for tests and diagnostics.
|
||||
async CrashProcess();
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "mozilla/RDDParent.h"
|
||||
#include "mozilla/RDDProcessManager.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "nsIXULRuntime.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
|
@ -202,15 +203,25 @@ RefPtr<GenericPromise> FlushAndUseFOGData() {
|
|||
return ret;
|
||||
}
|
||||
|
||||
void TestTriggerGPUMetrics() {
|
||||
gfx::GPUProcessManager::Get()->TestTriggerMetrics();
|
||||
}
|
||||
|
||||
void TestTriggerRDDMetrics(const RefPtr<dom::Promise>& promise) {
|
||||
RDDProcessManager::Get()->TestTriggerMetrics()->Then(
|
||||
GetCurrentSerialEventTarget(), __func__,
|
||||
[promise]() { promise->MaybeResolveWithUndefined(); },
|
||||
[promise]() { promise->MaybeRejectWithUndefined(); });
|
||||
void TestTriggerMetrics(uint32_t aProcessType,
|
||||
const RefPtr<dom::Promise>& promise) {
|
||||
switch (aProcessType) {
|
||||
case nsIXULRuntime::PROCESS_TYPE_GPU:
|
||||
gfx::GPUProcessManager::Get()->TestTriggerMetrics()->Then(
|
||||
GetCurrentSerialEventTarget(), __func__,
|
||||
[promise]() { promise->MaybeResolveWithUndefined(); },
|
||||
[promise]() { promise->MaybeRejectWithUndefined(); });
|
||||
break;
|
||||
case nsIXULRuntime::PROCESS_TYPE_RDD:
|
||||
RDDProcessManager::Get()->TestTriggerMetrics()->Then(
|
||||
GetCurrentSerialEventTarget(), __func__,
|
||||
[promise]() { promise->MaybeResolveWithUndefined(); },
|
||||
[promise]() { promise->MaybeRejectWithUndefined(); });
|
||||
break;
|
||||
default:
|
||||
promise->MaybeRejectWithUndefined();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace glean
|
||||
|
|
|
@ -62,19 +62,14 @@ RefPtr<GenericPromise> FlushAndUseFOGData();
|
|||
/**
|
||||
* ** Test-only Method **
|
||||
*
|
||||
* Trigger GPU-process test instrumentation.
|
||||
*/
|
||||
void TestTriggerGPUMetrics();
|
||||
|
||||
/**
|
||||
* ** Test-only Method **
|
||||
*
|
||||
* Trigger RDD-process test instrumentation.
|
||||
* Trigger GPU or RDD process test instrumentation.
|
||||
*
|
||||
* @param processType - one of the PROCESS_TYPE_* constant from nsIXULRuntime.
|
||||
* @param promise - a promise that will be resolved when the data has made it to
|
||||
* the RDD process.
|
||||
*/
|
||||
void TestTriggerRDDMetrics(const RefPtr<dom::Promise>& promise);
|
||||
void TestTriggerMetrics(uint32_t processType,
|
||||
const RefPtr<dom::Promise>& promise);
|
||||
|
||||
} // namespace glean
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -26,7 +26,7 @@ add_task(async () => {
|
|||
"Ensure we begin without value."
|
||||
);
|
||||
|
||||
Services.fog.testTriggerGPUMetrics();
|
||||
await Services.fog.testTriggerMetrics(Ci.nsIXULRuntime.PROCESS_TYPE_GPU);
|
||||
await Services.fog.testFlushAllChildren();
|
||||
|
||||
is(
|
||||
|
|
|
@ -47,7 +47,7 @@ add_task(async () => {
|
|||
|
||||
await TestUtils.waitForCondition(async () => {
|
||||
try {
|
||||
await Services.fog.testTriggerRDDMetrics();
|
||||
await Services.fog.testTriggerMetrics(Ci.nsIXULRuntime.PROCESS_TYPE_RDD);
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
|
|
|
@ -299,14 +299,8 @@ FOG::TestResetFOG(const nsACString& aDataPathOverride,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FOG::TestTriggerGPUMetrics() {
|
||||
glean::TestTriggerGPUMetrics();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FOG::TestTriggerRDDMetrics(JSContext* aCx,
|
||||
mozilla::dom::Promise** aOutPromise) {
|
||||
FOG::TestTriggerMetrics(uint32_t aProcessType, JSContext* aCx,
|
||||
mozilla::dom::Promise** aOutPromise) {
|
||||
NS_ENSURE_ARG(aOutPromise);
|
||||
*aOutPromise = nullptr;
|
||||
nsIGlobalObject* global = xpc::CurrentNativeGlobal(aCx);
|
||||
|
@ -320,7 +314,7 @@ FOG::TestTriggerRDDMetrics(JSContext* aCx,
|
|||
return erv.StealNSResult();
|
||||
}
|
||||
|
||||
glean::TestTriggerRDDMetrics(promise);
|
||||
glean::TestTriggerMetrics(aProcessType, promise);
|
||||
|
||||
promise.forget(aOutPromise);
|
||||
return NS_OK;
|
||||
|
|
|
@ -122,17 +122,15 @@ interface nsIFOG : nsISupports
|
|||
/**
|
||||
* ** Test-only Method **
|
||||
*
|
||||
* Trigger test metric instrumentation on the GPU process.
|
||||
*/
|
||||
void testTriggerGPUMetrics();
|
||||
|
||||
/**
|
||||
* ** Test-only Method **
|
||||
* Trigger test metric instrumentation on the GPU, RDD or Socket process.
|
||||
*
|
||||
* Trigger test metric instrumentation on the RDD process.
|
||||
* @param aProcessType - A PROCESS_TYPE_* value from the constants defined
|
||||
* in the nsIXULRuntime interface.
|
||||
*
|
||||
* @returns A promise that resolves when the test data has been added.
|
||||
* The promise will be rejected if the process type is not supported
|
||||
* or if sending the IPC to the child process fails.
|
||||
*/
|
||||
[implicit_jscontext]
|
||||
Promise testTriggerRDDMetrics();
|
||||
Promise testTriggerMetrics(in unsigned long aProcessType);
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче