Skip to content

Commit 42d55fe

Browse files
Merge pull request #467 from RecordReplay/kannan/implement-get-dispatch-server-in-cpp
Implement getDispatchServer in C++ for process prealloc.
2 parents c43c4a5 + 051b366 commit 42d55fe

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

dom/ipc/ContentParent.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -650,8 +650,10 @@ static const char* sObserverTopics[] = {
650650
// PreallocateProcess is called by the PreallocatedProcessManager.
651651
// ContentParent then takes this process back within GetNewOrUsedBrowserProcess.
652652
/*static*/ RefPtr<ContentParent::LaunchPromise>
653-
ContentParent::PreallocateProcess() {
654-
RefPtr<ContentParent> process = new ContentParent(PREALLOC_REMOTE_TYPE, nsString());
653+
ContentParent::PreallocateProcess(const nsAString& aRecordingDispatchAddress) {
654+
RefPtr<ContentParent> process = new ContentParent(
655+
PREALLOC_REMOTE_TYPE,
656+
aRecordingDispatchAddress);
655657

656658
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
657659
("Preallocating process of type prealloc"));

dom/ipc/ContentParent.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ class ContentParent final
152152
/**
153153
* Create a subprocess suitable for use later as a content process.
154154
*/
155-
static RefPtr<LaunchPromise> PreallocateProcess();
155+
static RefPtr<LaunchPromise> PreallocateProcess(
156+
const nsAString& aRecordingDispatchAddress = nsString());
156157

157158
/**
158159
* Start up the content-process machinery. This might include

dom/ipc/PreallocatedProcessManager.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ class PreallocatedProcessManagerImpl final : public nsIObserver {
4747

4848
static StaticRefPtr<PreallocatedProcessManagerImpl> sSingleton;
4949

50+
static nsresult GetReplayDispatchServer(nsAString& dispatchServer);
51+
5052
PreallocatedProcessManagerImpl();
5153
~PreallocatedProcessManagerImpl();
5254
PreallocatedProcessManagerImpl(const PreallocatedProcessManagerImpl&) =
@@ -119,6 +121,15 @@ PreallocatedProcessManagerImpl::~PreallocatedProcessManagerImpl() {
119121
MOZ_RELEASE_ASSERT(!mLaunchInProgress);
120122
}
121123

124+
nsresult PreallocatedProcessManagerImpl::GetReplayDispatchServer(nsAString& addr) {
125+
const char* envAddr = getenv("RECORD_REPLAY_SERVER");
126+
if (envAddr) {
127+
CopyUTF8toUTF16(mozilla::Span(envAddr, strlen(envAddr)), addr);
128+
return NS_OK;
129+
}
130+
return Preferences::GetString("devtools.recordreplay.cloudServer", addr);
131+
}
132+
122133
void PreallocatedProcessManagerImpl::Init() {
123134
Preferences::AddStrongObserver(this, "dom.ipc.processPrelaunch.enabled");
124135
// We have to respect processCount at all time. This is especially important

0 commit comments

Comments
 (0)