2015-08-18 01:13:20 +03: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 mozilla_dom_PerformanceObserver_h__
|
|
|
|
#define mozilla_dom_PerformanceObserver_h__
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsISupports.h"
|
2015-10-18 08:24:48 +03:00
|
|
|
#include "mozilla/RefPtr.h"
|
2015-08-18 01:13:20 +03:00
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsTArray.h"
|
|
|
|
#include "nsWrapperCache.h"
|
|
|
|
|
|
|
|
class nsPIDOMWindow;
|
|
|
|
class PerformanceBase;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
class ErrorResult;
|
|
|
|
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class GlobalObject;
|
|
|
|
class PerformanceEntry;
|
|
|
|
class PerformanceObserverCallback;
|
|
|
|
struct PerformanceObserverInit;
|
|
|
|
namespace workers {
|
|
|
|
class WorkerPrivate;
|
|
|
|
} // namespace workers
|
|
|
|
|
|
|
|
class PerformanceObserver final : public nsISupports,
|
|
|
|
public nsWrapperCache
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PerformanceObserver)
|
|
|
|
|
|
|
|
static already_AddRefed<PerformanceObserver>
|
|
|
|
Constructor(const GlobalObject& aGlobal,
|
|
|
|
PerformanceObserverCallback& aCb,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
|
|
|
PerformanceObserver(nsPIDOMWindow* aOwner,
|
|
|
|
PerformanceObserverCallback& aCb);
|
|
|
|
|
|
|
|
PerformanceObserver(workers::WorkerPrivate* aWorkerPrivate,
|
|
|
|
PerformanceObserverCallback& aCb);
|
|
|
|
|
|
|
|
virtual JSObject* WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) override;
|
|
|
|
|
|
|
|
nsISupports* GetParentObject() const { return mOwner; }
|
|
|
|
|
|
|
|
void Observe(const PerformanceObserverInit& aOptions,
|
|
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
|
|
|
|
void Disconnect();
|
|
|
|
|
2015-09-03 00:41:00 +03:00
|
|
|
void Notify();
|
|
|
|
void QueueEntry(PerformanceEntry* aEntry);
|
2015-08-18 01:13:20 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
~PerformanceObserver();
|
|
|
|
|
|
|
|
nsCOMPtr<nsISupports> mOwner;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<PerformanceObserverCallback> mCallback;
|
|
|
|
RefPtr<PerformanceBase> mPerformance;
|
2015-08-18 01:13:20 +03:00
|
|
|
nsTArray<nsString> mEntryTypes;
|
2015-08-21 00:33:54 +03:00
|
|
|
bool mConnected;
|
2015-10-18 08:24:48 +03:00
|
|
|
nsTArray<RefPtr<PerformanceEntry>> mQueuedEntries;
|
2015-08-18 01:13:20 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|