playwright/browser_patches/firefox-beta/juggler/screencast/nsScreencastService.h
Yury Semikhatsky 02aa31048c
browser(firefox): cross thread sync in screencast (#16320)
* nsIScreencastServiceClient is not thread safe refcounted so we make nsScreencastService::Session a thread safe refcounted object and keep it alive while there are inflight frames. Once such frames get handled on the main thread we check if the session has been stopped.
* Removed mCaptureCallbackCs in favor of atomic counter (mClient is not accessed only on the main thread).
* HeadlessWindowCapturer now holds RefPtr to the headless window object to avoid use after free when clearing it as a listener on the widget.
* ScreencastEncoder is not ref counted anymore.

Pretty-diff: 5f5042ff1e
2022-08-05 15:25:26 -07:00

30 lines
659 B
C++

/* 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/. */
#pragma once
#include <memory>
#include <map>
#include "nsIScreencastService.h"
namespace mozilla {
class nsScreencastService final : public nsIScreencastService {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSISCREENCASTSERVICE
static already_AddRefed<nsIScreencastService> GetSingleton();
nsScreencastService();
private:
~nsScreencastService();
class Session;
std::map<nsString, RefPtr<Session>> mIdToSession;
};
} // namespace mozilla