Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef ProfilerChild_h
8 : #define ProfilerChild_h
9 :
10 : #include "mozilla/PProfilerChild.h"
11 : #include "mozilla/RefPtr.h"
12 :
13 : class nsIThread;
14 :
15 : namespace mozilla {
16 :
17 : // The ProfilerChild actor is created in all processes except for the main
18 : // process. The corresponding ProfilerParent actor is created in the main
19 : // process, and it will notify us about profiler state changes and request
20 : // profiles from us.
21 : class ProfilerChild final : public PProfilerChild
22 : {
23 2 : NS_INLINE_DECL_REFCOUNTING(ProfilerChild)
24 :
25 : ProfilerChild();
26 :
27 : // Collects and returns a profile.
28 : // This method can be used to grab a profile just before PProfiler is torn
29 : // down. The collected profile should then be sent through a different
30 : // message channel that is guaranteed to stay open long enough.
31 : nsCString GrabShutdownProfile();
32 :
33 : void Destroy();
34 :
35 : private:
36 : virtual ~ProfilerChild();
37 :
38 : mozilla::ipc::IPCResult RecvStart(const ProfilerInitParams& params) override;
39 : mozilla::ipc::IPCResult RecvStop() override;
40 : mozilla::ipc::IPCResult RecvPause() override;
41 : mozilla::ipc::IPCResult RecvResume() override;
42 : mozilla::ipc::IPCResult RecvGatherProfile(GatherProfileResolver&& aResolve) override;
43 :
44 : void ActorDestroy(ActorDestroyReason aActorDestroyReason) override;
45 :
46 : nsCOMPtr<nsIThread> mThread;
47 : bool mDestroyed;
48 : };
49 :
50 : } // namespace mozilla
51 :
52 : #endif // ProfilerChild_h
|