зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1706374 - Part 10: Remove unnecessary IToplevelProtocol::OnChannelConnected, r=handyman,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D116665
This commit is contained in:
Родитель
1811e3331a
Коммит
4a956a2673
|
@ -1971,12 +1971,6 @@ void ContentParent::OnChannelError() {
|
||||||
PContentParent::OnChannelError();
|
PContentParent::OnChannelError();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentParent::OnChannelConnected(int32_t pid) {
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
|
||||||
|
|
||||||
SetOtherProcessId(pid);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContentParent::ProcessingError(Result aCode, const char* aReason) {
|
void ContentParent::ProcessingError(Result aCode, const char* aReason) {
|
||||||
if (MsgDropped == aCode) {
|
if (MsgDropped == aCode) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -716,8 +716,6 @@ class ContentParent final
|
||||||
bool CheckBrowsingContextEmbedder(CanonicalBrowsingContext* aBC,
|
bool CheckBrowsingContextEmbedder(CanonicalBrowsingContext* aBC,
|
||||||
const char* aOperation) const;
|
const char* aOperation) const;
|
||||||
|
|
||||||
void OnChannelConnected(int32_t pid) override;
|
|
||||||
|
|
||||||
void ActorDestroy(ActorDestroyReason why) override;
|
void ActorDestroy(ActorDestroyReason why) override;
|
||||||
void ActorDealloc() override;
|
void ActorDealloc() override;
|
||||||
|
|
||||||
|
|
|
@ -145,16 +145,20 @@ void VRManagerParent::Shutdown() {
|
||||||
|
|
||||||
void VRManagerParent::ActorDestroy(ActorDestroyReason why) {}
|
void VRManagerParent::ActorDestroy(ActorDestroyReason why) {}
|
||||||
|
|
||||||
|
void VRManagerParent::ActorAlloc() {
|
||||||
|
// FIXME: This actor should probably use proper refcounting instead of manual
|
||||||
|
// reference management, and probably shouldn't manage
|
||||||
|
// `mCompositorThreadHolder` in the alloc/dealloc methods.
|
||||||
|
PVRManagerParent::ActorAlloc();
|
||||||
|
mCompositorThreadHolder = CompositorThreadHolder::GetSingleton();
|
||||||
|
}
|
||||||
|
|
||||||
void VRManagerParent::ActorDealloc() {
|
void VRManagerParent::ActorDealloc() {
|
||||||
UnregisterFromManager();
|
UnregisterFromManager();
|
||||||
mCompositorThreadHolder = nullptr;
|
mCompositorThreadHolder = nullptr;
|
||||||
mSelfRef = nullptr;
|
mSelfRef = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VRManagerParent::OnChannelConnected(int32_t aPid) {
|
|
||||||
mCompositorThreadHolder = CompositorThreadHolder::GetSingleton();
|
|
||||||
}
|
|
||||||
|
|
||||||
mozilla::ipc::IPCResult VRManagerParent::RecvDetectRuntimes() {
|
mozilla::ipc::IPCResult VRManagerParent::RecvDetectRuntimes() {
|
||||||
// Detect runtime capabilities. This will return the presense of VR and/or AR
|
// Detect runtime capabilities. This will return the presense of VR and/or AR
|
||||||
// runtime software, without enumerating or activating any hardware devices.
|
// runtime software, without enumerating or activating any hardware devices.
|
||||||
|
|
|
@ -48,7 +48,6 @@ class VRManagerParent final : public PVRManagerParent {
|
||||||
bool DeallocPVRLayerParent(PVRLayerParent* actor);
|
bool DeallocPVRLayerParent(PVRLayerParent* actor);
|
||||||
|
|
||||||
virtual void ActorDestroy(ActorDestroyReason why) override;
|
virtual void ActorDestroy(ActorDestroyReason why) override;
|
||||||
void OnChannelConnected(int32_t pid) override;
|
|
||||||
|
|
||||||
mozilla::ipc::IPCResult RecvDetectRuntimes();
|
mozilla::ipc::IPCResult RecvDetectRuntimes();
|
||||||
mozilla::ipc::IPCResult RecvRefreshDisplays();
|
mozilla::ipc::IPCResult RecvRefreshDisplays();
|
||||||
|
@ -74,6 +73,7 @@ class VRManagerParent final : public PVRManagerParent {
|
||||||
mozilla::ipc::IPCResult RecvResetPuppet();
|
mozilla::ipc::IPCResult RecvResetPuppet();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void ActorAlloc() override;
|
||||||
void ActorDealloc() override;
|
void ActorDealloc() override;
|
||||||
void RegisterWithManager();
|
void RegisterWithManager();
|
||||||
void UnregisterFromManager();
|
void UnregisterFromManager();
|
||||||
|
|
|
@ -583,8 +583,6 @@ MessageChannel::MessageChannel(const char* aName, IToplevelProtocol* aListener)
|
||||||
mAbortOnError(false),
|
mAbortOnError(false),
|
||||||
mNotifiedChannelDone(false),
|
mNotifiedChannelDone(false),
|
||||||
mFlags(REQUIRE_DEFAULT),
|
mFlags(REQUIRE_DEFAULT),
|
||||||
mPeerPidSet(false),
|
|
||||||
mPeerPid(-1),
|
|
||||||
mIsPostponingSends(false),
|
mIsPostponingSends(false),
|
||||||
mBuildIDsConfirmedMatch(false),
|
mBuildIDsConfirmedMatch(false),
|
||||||
mIsSameThreadChannel(false) {
|
mIsSameThreadChannel(false) {
|
||||||
|
@ -593,13 +591,7 @@ MessageChannel::MessageChannel(const char* aName, IToplevelProtocol* aListener)
|
||||||
#ifdef OS_WIN
|
#ifdef OS_WIN
|
||||||
mTopFrame = nullptr;
|
mTopFrame = nullptr;
|
||||||
mIsSyncWaitingOnNonMainThread = false;
|
mIsSyncWaitingOnNonMainThread = false;
|
||||||
#endif
|
|
||||||
|
|
||||||
mOnChannelConnectedTask = NewNonOwningCancelableRunnableMethod(
|
|
||||||
"ipc::MessageChannel::DispatchOnChannelConnected", this,
|
|
||||||
&MessageChannel::DispatchOnChannelConnected);
|
|
||||||
|
|
||||||
#ifdef OS_WIN
|
|
||||||
mEvent = CreateEventW(nullptr, TRUE, FALSE, nullptr);
|
mEvent = CreateEventW(nullptr, TRUE, FALSE, nullptr);
|
||||||
MOZ_RELEASE_ASSERT(mEvent, "CreateEvent failed! Nothing is going to work!");
|
MOZ_RELEASE_ASSERT(mEvent, "CreateEvent failed! Nothing is going to work!");
|
||||||
#endif
|
#endif
|
||||||
|
@ -773,8 +765,6 @@ void MessageChannel::Clear() {
|
||||||
mLink = nullptr;
|
mLink = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
mOnChannelConnectedTask->Cancel();
|
|
||||||
|
|
||||||
if (mChannelErrorTask) {
|
if (mChannelErrorTask) {
|
||||||
mChannelErrorTask->Cancel();
|
mChannelErrorTask->Cancel();
|
||||||
mChannelErrorTask = nullptr;
|
mChannelErrorTask = nullptr;
|
||||||
|
@ -2386,20 +2376,6 @@ void MessageChannel::SetReplyTimeoutMs(int32_t aTimeoutMs) {
|
||||||
(aTimeoutMs <= 0) ? kNoTimeout : (int32_t)ceil((double)aTimeoutMs / 2.0);
|
(aTimeoutMs <= 0) ? kNoTimeout : (int32_t)ceil((double)aTimeoutMs / 2.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageChannel::OnChannelConnected(int32_t peer_id) {
|
|
||||||
MOZ_RELEASE_ASSERT(!mPeerPidSet);
|
|
||||||
mPeerPidSet = true;
|
|
||||||
mPeerPid = peer_id;
|
|
||||||
RefPtr<CancelableRunnable> task = mOnChannelConnectedTask;
|
|
||||||
mWorkerThread->Dispatch(task.forget());
|
|
||||||
}
|
|
||||||
|
|
||||||
void MessageChannel::DispatchOnChannelConnected() {
|
|
||||||
AssertWorkerThread();
|
|
||||||
MOZ_RELEASE_ASSERT(mPeerPidSet);
|
|
||||||
mListener->OnChannelConnected(mPeerPid);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MessageChannel::ReportMessageRouteError(const char* channelName) const {
|
void MessageChannel::ReportMessageRouteError(const char* channelName) const {
|
||||||
PrintErrorMessage(mSide, channelName, "Need a route");
|
PrintErrorMessage(mSide, channelName, "Need a route");
|
||||||
mListener->ProcessingError(MsgRouteError, "MsgRouteError");
|
mListener->ProcessingError(MsgRouteError, "MsgRouteError");
|
||||||
|
|
|
@ -394,9 +394,6 @@ class MessageChannel : HasResultCodes {
|
||||||
|
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
// Send OnChannelConnected notification to listeners.
|
|
||||||
void DispatchOnChannelConnected();
|
|
||||||
|
|
||||||
bool InterruptEventOccurred();
|
bool InterruptEventOccurred();
|
||||||
bool HasPendingEvents();
|
bool HasPendingEvents();
|
||||||
|
|
||||||
|
@ -531,8 +528,6 @@ class MessageChannel : HasResultCodes {
|
||||||
// thread, in which case it shouldn't be delivered to the worker.
|
// thread, in which case it shouldn't be delivered to the worker.
|
||||||
bool MaybeInterceptSpecialIOMessage(const Message& aMsg);
|
bool MaybeInterceptSpecialIOMessage(const Message& aMsg);
|
||||||
|
|
||||||
void OnChannelConnected(int32_t peer_id);
|
|
||||||
|
|
||||||
// Tell the IO thread to close the channel and wait for it to ACK.
|
// Tell the IO thread to close the channel and wait for it to ACK.
|
||||||
void SynchronouslyClose();
|
void SynchronouslyClose();
|
||||||
|
|
||||||
|
@ -851,13 +846,6 @@ class MessageChannel : HasResultCodes {
|
||||||
// See SetChannelFlags
|
// See SetChannelFlags
|
||||||
ChannelFlags mFlags;
|
ChannelFlags mFlags;
|
||||||
|
|
||||||
// Task and state used to asynchronously notify channel has been connected
|
|
||||||
// safely. This is necessary to be able to cancel notification if we are
|
|
||||||
// closed at the same time.
|
|
||||||
RefPtr<CancelableRunnable> mOnChannelConnectedTask;
|
|
||||||
bool mPeerPidSet;
|
|
||||||
int32_t mPeerPid;
|
|
||||||
|
|
||||||
// Channels can enter messages are not sent immediately; instead, they are
|
// Channels can enter messages are not sent immediately; instead, they are
|
||||||
// held in a queue until another thread deems it is safe to send them.
|
// held in a queue until another thread deems it is safe to send them.
|
||||||
bool mIsPostponingSends;
|
bool mIsPostponingSends;
|
||||||
|
|
|
@ -315,8 +315,6 @@ void ProcessLink::OnTakeConnectedChannel() {
|
||||||
void ProcessLink::OnChannelConnected(int32_t peer_pid) {
|
void ProcessLink::OnChannelConnected(int32_t peer_pid) {
|
||||||
AssertIOThread();
|
AssertIOThread();
|
||||||
|
|
||||||
bool notifyChannel = false;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
MonitorAutoLock lock(*mChan->mMonitor);
|
MonitorAutoLock lock(*mChan->mMonitor);
|
||||||
// Do not force it into connected if it has errored out, started
|
// Do not force it into connected if it has errored out, started
|
||||||
|
@ -326,17 +324,12 @@ void ProcessLink::OnChannelConnected(int32_t peer_pid) {
|
||||||
mChan->mChannelState == ChannelConnected) {
|
mChan->mChannelState == ChannelConnected) {
|
||||||
mChan->mChannelState = ChannelConnected;
|
mChan->mChannelState = ChannelConnected;
|
||||||
mChan->mMonitor->Notify();
|
mChan->mMonitor->Notify();
|
||||||
notifyChannel = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mExistingListener) {
|
if (mExistingListener) {
|
||||||
mExistingListener->OnChannelConnected(peer_pid);
|
mExistingListener->OnChannelConnected(peer_pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notifyChannel) {
|
|
||||||
mChan->OnChannelConnected(peer_pid);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessLink::OnChannelConnectError() {
|
void ProcessLink::OnChannelConnectError() {
|
||||||
|
|
|
@ -434,7 +434,6 @@ class IToplevelProtocol : public IProtocol {
|
||||||
virtual void OnChannelClose() = 0;
|
virtual void OnChannelClose() = 0;
|
||||||
virtual void OnChannelError() = 0;
|
virtual void OnChannelError() = 0;
|
||||||
virtual void ProcessingError(Result aError, const char* aMsgName) {}
|
virtual void ProcessingError(Result aError, const char* aMsgName) {}
|
||||||
virtual void OnChannelConnected(int32_t peer_pid) {}
|
|
||||||
|
|
||||||
bool Open(UniquePtr<Transport> aTransport, base::ProcessId aOtherPid,
|
bool Open(UniquePtr<Transport> aTransport, base::ProcessId aOtherPid,
|
||||||
MessageLoop* aThread = nullptr,
|
MessageLoop* aThread = nullptr,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче