mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 00:32:11 +00:00
Bug 1544799 - Make PSocketProcess manage PWebrtcProxyChannel r=dragana
Differential Revision: https://phabricator.services.mozilla.com/D28038 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
5f5d6f4c69
commit
45ba7eb235
@ -6,6 +6,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
include protocol PNecko;
|
||||
include protocol PSocketProcess;
|
||||
|
||||
include NeckoChannelParams;
|
||||
|
||||
@ -14,7 +15,7 @@ namespace net {
|
||||
|
||||
async protocol PWebrtcProxyChannel
|
||||
{
|
||||
manager PNecko;
|
||||
manager PNecko or PSocketProcess;
|
||||
|
||||
parent:
|
||||
async AsyncOpen(nsCString aHost,
|
||||
|
@ -3,9 +3,12 @@
|
||||
* 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 MemoryReportTypes;
|
||||
include protocol PSocketProcessBridge;
|
||||
include protocol PProfiler;
|
||||
include protocol PWebrtcProxyChannel;
|
||||
|
||||
include MemoryReportTypes;
|
||||
include PBrowserOrId;
|
||||
include PrefsTypes;
|
||||
|
||||
using mozilla::dom::NativeThreadId from "mozilla/dom/TabMessageUtils.h";
|
||||
@ -22,6 +25,8 @@ namespace net {
|
||||
|
||||
protocol PSocketProcess
|
||||
{
|
||||
manages PWebrtcProxyChannel;
|
||||
|
||||
parent:
|
||||
async InitCrashReporter(Shmem shmem, NativeThreadId threadId);
|
||||
async AddMemoryReport(MemoryReport aReport);
|
||||
@ -34,6 +39,8 @@ parent:
|
||||
async RecordChildEvents(ChildEventData[] events);
|
||||
async RecordDiscardedData(DiscardedData data);
|
||||
|
||||
async PWebrtcProxyChannel(PBrowserOrId browser);
|
||||
|
||||
child:
|
||||
async PreferenceUpdate(Pref pref);
|
||||
async RequestMemoryReport(uint32_t generation,
|
||||
|
@ -21,6 +21,10 @@
|
||||
# include "ChildProfilerController.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WEBRTC
|
||||
# include "mozilla/net/WebrtcProxyChannelChild.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
@ -170,5 +174,25 @@ void SocketProcessChild::DestroySocketProcessBridgeParent(ProcessId aId) {
|
||||
mSocketProcessBridgeParentMap.Remove(aId);
|
||||
}
|
||||
|
||||
PWebrtcProxyChannelChild* SocketProcessChild::AllocPWebrtcProxyChannelChild(
|
||||
const PBrowserOrId& browser) {
|
||||
// We don't allocate here: instead we always use IPDL constructor that takes
|
||||
// an existing object
|
||||
MOZ_ASSERT_UNREACHABLE(
|
||||
"AllocPWebrtcProxyChannelChild should not be called on"
|
||||
" socket child");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool SocketProcessChild::DeallocPWebrtcProxyChannelChild(
|
||||
PWebrtcProxyChannelChild* aActor) {
|
||||
#ifdef MOZ_WEBRTC
|
||||
WebrtcProxyChannelChild* child =
|
||||
static_cast<WebrtcProxyChannelChild*>(aActor);
|
||||
child->ReleaseIPDLReference();
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
@ -45,6 +45,10 @@ class SocketProcessChild final : public PSocketProcessChild {
|
||||
Endpoint<mozilla::PProfilerChild>&& aEndpoint);
|
||||
mozilla::ipc::IPCResult RecvSocketProcessTelemetryPing();
|
||||
|
||||
PWebrtcProxyChannelChild* AllocPWebrtcProxyChannelChild(
|
||||
const PBrowserOrId& browser);
|
||||
bool DeallocPWebrtcProxyChannelChild(PWebrtcProxyChannelChild* aActor);
|
||||
|
||||
void CleanUp();
|
||||
void DestroySocketProcessBridgeParent(ProcessId aId);
|
||||
|
||||
|
@ -9,6 +9,11 @@
|
||||
#include "mozilla/ipc/CrashReporterHost.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/TelemetryIPC.h"
|
||||
#ifdef MOZ_WEBRTC
|
||||
# include "mozilla/dom/ContentProcessManager.h"
|
||||
# include "mozilla/dom/TabParent.h"
|
||||
# include "mozilla/net/WebrtcProxyChannelParent.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
@ -127,6 +132,41 @@ mozilla::ipc::IPCResult SocketProcessParent::RecvRecordDiscardedData(
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
PWebrtcProxyChannelParent* SocketProcessParent::AllocPWebrtcProxyChannelParent(
|
||||
const PBrowserOrId& aBrowser) {
|
||||
#ifdef MOZ_WEBRTC
|
||||
if (aBrowser.type() != PBrowserOrId::TTabId) {
|
||||
MOZ_ASSERT(false, "We only allow TabId here.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
dom::ContentProcessManager* cpm = dom::ContentProcessManager::GetSingleton();
|
||||
dom::TabId tabId = aBrowser.get_TabId();
|
||||
dom::ContentParentId cpId = cpm->GetTabProcessId(tabId);
|
||||
RefPtr<dom::TabParent> tab = cpm->GetTabParentByProcessAndTabId(cpId, tabId);
|
||||
if (!tab) {
|
||||
MOZ_ASSERT(false, "Cannot find the TabParent!");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WebrtcProxyChannelParent* parent = new WebrtcProxyChannelParent(tab);
|
||||
parent->AddRef();
|
||||
return parent;
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool SocketProcessParent::DeallocPWebrtcProxyChannelParent(
|
||||
PWebrtcProxyChannelParent* aActor) {
|
||||
#ifdef MOZ_WEBRTC
|
||||
WebrtcProxyChannelParent* parent =
|
||||
static_cast<WebrtcProxyChannelParent*>(aActor);
|
||||
parent->Release();
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
// To ensure that IPDL is finished before SocketParent gets deleted.
|
||||
class DeferredDeleteSocketProcessParent : public Runnable {
|
||||
public:
|
||||
|
@ -52,6 +52,10 @@ class SocketProcessParent final : public PSocketProcessParent {
|
||||
mozilla::ipc::IPCResult RecvRecordDiscardedData(
|
||||
const DiscardedData& aDiscardedData);
|
||||
|
||||
PWebrtcProxyChannelParent* AllocPWebrtcProxyChannelParent(
|
||||
const PBrowserOrId& aBrowser);
|
||||
bool DeallocPWebrtcProxyChannelParent(PWebrtcProxyChannelParent* aActor);
|
||||
|
||||
void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
bool SendRequestMemoryReport(const uint32_t& aGeneration,
|
||||
const bool& aAnonymize,
|
||||
|
Loading…
Reference in New Issue
Block a user