-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathClipboardContentAnalysisChild.cpp
More file actions
33 lines (26 loc) · 1.07 KB
/
ClipboardContentAnalysisChild.cpp
File metadata and controls
33 lines (26 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* 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/. */
#include "ClipboardContentAnalysisChild.h"
#include "MainThreadUtils.h"
#include "mozilla/dom/ContentChild.h"
namespace mozilla {
StaticRefPtr<ClipboardContentAnalysisChild>
ClipboardContentAnalysisChild::sSingleton;
/* static */ ClipboardContentAnalysisChild*
ClipboardContentAnalysisChild::GetOrCreate() {
AssertIsOnMainThread();
MOZ_ASSERT(XRE_IsContentProcess());
if (!sSingleton) {
Endpoint<PClipboardContentAnalysisParent> parentEndpoint;
Endpoint<PClipboardContentAnalysisChild> childEndpoint;
MOZ_ALWAYS_SUCCEEDS(PClipboardContentAnalysis::CreateEndpoints(
&parentEndpoint, &childEndpoint));
dom::ContentChild::GetSingleton()->SendCreateClipboardContentAnalysis(
std::move(parentEndpoint));
sSingleton = new ClipboardContentAnalysisChild();
childEndpoint.Bind(sSingleton);
}
return sSingleton;
}
} // namespace mozilla