Bug 1942006 - Upstream a variety of Servo-specific code from Servo's downstream fork...
[gecko.git] / widget / ClipboardContentAnalysisChild.h
blob017fd7170c69e442d58778ae1d0de077a7c70678
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef MOZILLA_WIDGET_CLIPBOARDCONTENTANALYSISCHILD_H_
7 #define MOZILLA_WIDGET_CLIPBOARDCONTENTANALYSISCHILD_H_
9 #include "mozilla/ipc/Endpoint.h"
10 #include "mozilla/PClipboardContentAnalysisChild.h"
12 namespace mozilla {
13 class ClipboardContentAnalysisChild final
14 : public PClipboardContentAnalysisChild {
15 public:
16 NS_INLINE_DECL_REFCOUNTING(ClipboardContentAnalysisChild, override)
18 static ClipboardContentAnalysisChild* GetOrCreate();
20 void ActorDestroy(ActorDestroyReason aReason) override final {
21 // There's only one singleton, so remove our reference to it.
22 sSingleton = nullptr;
25 private:
26 friend PClipboardContentAnalysisChild;
27 ClipboardContentAnalysisChild() { MOZ_ASSERT(XRE_IsContentProcess()); }
28 ~ClipboardContentAnalysisChild() = default;
29 static StaticRefPtr<ClipboardContentAnalysisChild> sSingleton;
31 } // namespace mozilla
33 #endif // MOZILLA_WIDGET_CLIPBOARDCONTENTANALYSISCHILD_H_