Bug 1892041 - Part 1: Update test262 features. r=spidermonkey-reviewers,dminor
[gecko.git] / dom / performance / PerformanceStorageWorker.h
blobe585069112a2b412f532b3528bdca037799ccc6e
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/. */
7 #ifndef mozilla_dom_PerformanceStorageWorker_h
8 #define mozilla_dom_PerformanceStorageWorker_h
10 #include "mozilla/Mutex.h"
11 #include "PerformanceStorage.h"
13 namespace mozilla::dom {
15 class WeakWorkerRef;
16 class WorkerPrivate;
18 class PerformanceProxyData;
20 class PerformanceStorageWorker final : public PerformanceStorage {
21 public:
22 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(PerformanceStorageWorker, override)
24 static already_AddRefed<PerformanceStorageWorker> Create(
25 WorkerPrivate* aWorkerPrivate);
27 void ShutdownOnWorker();
29 void AddEntry(nsIHttpChannel* aChannel,
30 nsITimedChannel* aTimedChannel) override;
31 void AddEntry(const nsString& aEntryName, const nsString& aInitiatorType,
32 UniquePtr<PerformanceTimingData>&& aData) override;
33 void AddEntryOnWorker(UniquePtr<PerformanceProxyData>&& aData);
35 private:
36 PerformanceStorageWorker();
37 ~PerformanceStorageWorker();
39 Mutex mMutex;
41 // Protected by mutex.
42 // Created and released on worker-thread. Used also on main-thread.
43 RefPtr<WeakWorkerRef> mWorkerRef MOZ_GUARDED_BY(mMutex);
46 } // namespace mozilla::dom
48 #endif // mozilla_dom_PerformanceStorageWorker_h