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_LayerTimelineMarker_h_
8 : #define mozilla_LayerTimelineMarker_h_
9 :
10 : #include "TimelineMarker.h"
11 : #include "mozilla/dom/ProfileTimelineMarkerBinding.h"
12 : #include "nsRegion.h"
13 :
14 : namespace mozilla {
15 :
16 0 : class LayerTimelineMarker : public TimelineMarker
17 : {
18 : public:
19 0 : explicit LayerTimelineMarker(const nsIntRegion& aRegion)
20 0 : : TimelineMarker("Layer", MarkerTracingType::HELPER_EVENT)
21 0 : , mRegion(aRegion)
22 0 : {}
23 :
24 0 : void AddLayerRectangles(dom::Sequence<dom::ProfileTimelineLayerRect>& aRectangles)
25 : {
26 0 : for (auto iter = mRegion.RectIter(); !iter.Done(); iter.Next()) {
27 0 : const nsIntRect& iterRect = iter.Get();
28 0 : dom::ProfileTimelineLayerRect rect;
29 0 : rect.mX = iterRect.X();
30 0 : rect.mY = iterRect.Y();
31 0 : rect.mWidth = iterRect.Width();
32 0 : rect.mHeight = iterRect.Height();
33 0 : aRectangles.AppendElement(rect, fallible);
34 : }
35 0 : }
36 :
37 : private:
38 : nsIntRegion mRegion;
39 : };
40 :
41 : } // namespace mozilla
42 :
43 : #endif // mozilla_LayerTimelineMarker_h_
|