зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1513057 - P7: Setup Gecko profiler on the socket process r=dragana,mayhemer,mstange
Differential Revision: https://phabricator.services.mozilla.com/D14351 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
1c5e5caaaf
Коммит
f66295c49c
|
@ -5,6 +5,7 @@
|
|||
|
||||
include MemoryReportTypes;
|
||||
include protocol PSocketProcessBridge;
|
||||
include protocol PProfiler;
|
||||
include PrefsTypes;
|
||||
|
||||
using mozilla::dom::NativeThreadId from "mozilla/dom/TabMessageUtils.h";
|
||||
|
@ -28,6 +29,7 @@ child:
|
|||
MaybeFileDesc DMDFile);
|
||||
async SetOffline(bool offline);
|
||||
async InitSocketProcessBridgeParent(ProcessId processId, Endpoint<PSocketProcessBridgeParent> endpoint);
|
||||
async InitProfiler(Endpoint<PProfilerChild> aEndpoint);
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
#include "ProcessUtils.h"
|
||||
#include "SocketProcessBridgeParent.h"
|
||||
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
#include "ChildProfilerController.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
|
@ -76,6 +80,13 @@ void SocketProcessChild::ActorDestroy(ActorDestroyReason aWhy) {
|
|||
ProcessChild::QuickExit();
|
||||
}
|
||||
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
if (mProfilerController) {
|
||||
mProfilerController->Shutdown();
|
||||
mProfilerController = nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
CrashReporterClient::DestroySingleton();
|
||||
XRE_ShutdownChildProcess();
|
||||
}
|
||||
|
@ -131,6 +142,15 @@ mozilla::ipc::IPCResult SocketProcessChild::RecvInitSocketProcessBridgeParent(
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult SocketProcessChild::RecvInitProfiler(
|
||||
Endpoint<PProfilerChild>&& aEndpoint) {
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
mProfilerController =
|
||||
mozilla::ChildProfilerController::Create(std::move(aEndpoint));
|
||||
#endif
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
void SocketProcessChild::DestroySocketProcessBridgeParent(ProcessId aId) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
#include "mozilla/net/PSocketProcessChild.h"
|
||||
#include "nsRefPtrHashtable.h"
|
||||
|
||||
namespace mozilla {
|
||||
class ChildProfilerController;
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
|
@ -36,6 +40,8 @@ class SocketProcessChild final : public PSocketProcessChild {
|
|||
mozilla::ipc::IPCResult RecvInitSocketProcessBridgeParent(
|
||||
const ProcessId& aContentProcessId,
|
||||
Endpoint<mozilla::net::PSocketProcessBridgeParent>&& aEndpoint) override;
|
||||
mozilla::ipc::IPCResult RecvInitProfiler(
|
||||
Endpoint<mozilla::PProfilerChild>&& aEndpoint) override;
|
||||
|
||||
void CleanUp();
|
||||
void DestroySocketProcessBridgeParent(ProcessId aId);
|
||||
|
@ -45,6 +51,10 @@ class SocketProcessChild final : public PSocketProcessChild {
|
|||
// This table keeps SocketProcessBridgeParent alive in socket process.
|
||||
nsRefPtrHashtable<nsUint32HashKey, SocketProcessBridgeParent>
|
||||
mSocketProcessBridgeParentMap;
|
||||
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
RefPtr<ChildProfilerController> mProfilerController;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
#include "nsIObserverService.h"
|
||||
#include "SocketProcessParent.h"
|
||||
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
#include "ProfilerParent.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
|
@ -213,6 +217,11 @@ void SocketProcessHost::InitAfterConnect(bool aSucceeded) {
|
|||
DebugOnly<nsresult> result = ioService->GetOffline(&offline);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(result), "Failed getting offline?");
|
||||
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
Unused << GetActor()->SendInitProfiler(
|
||||
ProfilerParent::CreateForProcess(GetActor()->OtherPid()));
|
||||
#endif
|
||||
|
||||
Unused << GetActor()->SendSetOffline(offline);
|
||||
|
||||
mOfflineObserver = new OfflineObserver(this);
|
||||
|
|
Загрузка…
Ссылка в новой задаче