2015-07-18 06:35:59 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef ObservedDocShell_h_
|
|
|
|
#define ObservedDocShell_h_
|
|
|
|
|
2015-07-18 06:35:59 -07:00
|
|
|
#include "GeckoProfiler.h"
|
|
|
|
#include "nsTArray.h"
|
2015-07-18 06:35:59 -07:00
|
|
|
#include "nsRefPtr.h"
|
|
|
|
|
|
|
|
class nsDocShell;
|
2015-07-18 06:35:59 -07:00
|
|
|
class TimelineMarker;
|
2015-07-18 06:35:59 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
2015-07-18 06:35:59 -07:00
|
|
|
namespace dom {
|
|
|
|
struct ProfileTimelineMarker;
|
|
|
|
}
|
2015-07-18 06:35:59 -07:00
|
|
|
|
|
|
|
// # ObservedDocShell
|
|
|
|
//
|
|
|
|
// A wrapper around a docshell for which docshell-specific markers are
|
|
|
|
// allowed to exist. See TimelineConsumers for register/unregister logic.
|
|
|
|
class ObservedDocShell : public LinkedListElement<ObservedDocShell>
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
nsRefPtr<nsDocShell> mDocShell;
|
2015-07-18 06:35:59 -07:00
|
|
|
nsTArray<UniquePtr<TimelineMarker>> mTimelineMarkers;
|
|
|
|
|
2015-07-18 06:35:59 -07:00
|
|
|
public:
|
2015-07-18 06:35:59 -07:00
|
|
|
explicit ObservedDocShell(nsDocShell* aDocShell);
|
|
|
|
nsDocShell* operator*() const { return mDocShell.get(); }
|
2015-07-18 06:35:59 -07:00
|
|
|
|
|
|
|
void AddMarker(const char* aName, TracingMetadata aMetaData);
|
|
|
|
void AddMarker(UniquePtr<TimelineMarker>&& aMarker);
|
|
|
|
void ClearMarkers();
|
2015-07-18 06:35:59 -07:00
|
|
|
void PopMarkers(JSContext* aCx, nsTArray<dom::ProfileTimelineMarker>& aStore);
|
2015-07-18 06:35:59 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* ObservedDocShell_h_ */
|