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 mozilla_ObservedDocShell_h_
8 : #define mozilla_ObservedDocShell_h_
9 :
10 : #include "MarkersStorage.h"
11 : #include "mozilla/RefPtr.h"
12 : #include "mozilla/UniquePtr.h"
13 : #include "nsTArray.h"
14 :
15 : class nsIDocShell;
16 :
17 : namespace mozilla {
18 : class AbstractTimelineMarker;
19 :
20 : namespace dom {
21 : struct ProfileTimelineMarker;
22 : }
23 :
24 : // # ObservedDocShell
25 : //
26 : // A wrapper around a docshell for which docshell-specific markers are
27 : // allowed to exist. See TimelineConsumers for register/unregister logic.
28 0 : class ObservedDocShell : public MarkersStorage
29 : {
30 : private:
31 : RefPtr<nsIDocShell> mDocShell;
32 :
33 : // Main thread only.
34 : nsTArray<UniquePtr<AbstractTimelineMarker>> mTimelineMarkers;
35 : bool mPopping;
36 :
37 : // Off the main thread only.
38 : nsTArray<UniquePtr<AbstractTimelineMarker>> mOffTheMainThreadTimelineMarkers;
39 :
40 : public:
41 : explicit ObservedDocShell(nsIDocShell* aDocShell);
42 : nsIDocShell* operator*() const { return mDocShell.get(); }
43 :
44 : void AddMarker(UniquePtr<AbstractTimelineMarker>&& aMarker) override;
45 : void AddOTMTMarker(UniquePtr<AbstractTimelineMarker>&& aMarker) override;
46 : void ClearMarkers() override;
47 : void PopMarkers(JSContext* aCx, nsTArray<dom::ProfileTimelineMarker>& aStore) override;
48 : };
49 :
50 : } // namespace mozilla
51 :
52 : #endif /* mozilla_ObservedDocShell_h_ */
|