author | Nathan Froyd <froydnj@gmail.com> |
Fri, 02 Sep 2016 16:13:50 -0400 | |
changeset 312429 | ee21ab5cb4796059a8136f70b8dab2371e4d6213 |
parent 312428 | fc4928fc74e5add861fb00c40ee40ba5386c82d3 |
child 312430 | 67e8b862bdb08431c362d3f5e1cbb6a0cfbe3a13 |
push id | 30643 |
push user | kwierso@gmail.com |
push date | Fri, 02 Sep 2016 20:19:12 +0000 |
treeherder | mozilla-central@63d190efe42e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | billm |
bugs | 1299594 |
milestone | 51.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/gfx/layers/ipc/CompositorBridgeParent.cpp +++ b/gfx/layers/ipc/CompositorBridgeParent.cpp @@ -2128,22 +2128,16 @@ public: void Bind(Endpoint<PCompositorBridgeParent>&& aEndpoint) { if (!aEndpoint.Bind(this, nullptr)) { return; } mSelfRef = this; } - // IToplevelProtocol::CloneToplevel() - virtual IToplevelProtocol* - CloneToplevel(const InfallibleTArray<mozilla::ipc::ProtocolFdMapping>& aFds, - base::ProcessHandle aPeerProcess, - mozilla::ipc::ProtocolCloneContext* aCtx) override; - virtual void ActorDestroy(ActorDestroyReason aWhy) override; // FIXME/bug 774388: work out what shutdown protocol we need. virtual bool RecvInitialize(const uint64_t& aRootLayerTreeId) override { return false; } virtual bool RecvRequestOverfill() override { return true; } virtual bool RecvWillClose() override { return true; } virtual bool RecvPause() override { return true; } virtual bool RecvResume() override { return true; } @@ -3089,26 +3083,16 @@ CrossProcessCompositorBridgeParent::Defe } CrossProcessCompositorBridgeParent::~CrossProcessCompositorBridgeParent() { MOZ_ASSERT(XRE_GetIOMessageLoop()); MOZ_ASSERT(IToplevelProtocol::GetTransport()); } -IToplevelProtocol* -CrossProcessCompositorBridgeParent::CloneToplevel( - const InfallibleTArray<mozilla::ipc::ProtocolFdMapping>& aFds, - base::ProcessHandle aPeerProcess, - mozilla::ipc::ProtocolCloneContext* aCtx) -{ - MOZ_ASSERT_UNREACHABLE("Not supported"); - return nullptr; -} - PTextureParent* CrossProcessCompositorBridgeParent::AllocPTextureParent(const SurfaceDescriptor& aSharedData, const LayersBackend& aLayersBackend, const TextureFlags& aFlags, const uint64_t& aId, const uint64_t& aSerial) { CompositorBridgeParent::LayerTreeState* state = nullptr;
--- a/gfx/layers/ipc/ImageBridgeParent.cpp +++ b/gfx/layers/ipc/ImageBridgeParent.cpp @@ -360,25 +360,16 @@ ImageBridgeParent::DeferredDestroy() ImageBridgeParent* ImageBridgeParent::GetInstance(ProcessId aId) { NS_ASSERTION(sImageBridges.count(aId) == 1, "ImageBridgeParent for the process"); return sImageBridges[aId]; } -IToplevelProtocol* -ImageBridgeParent::CloneToplevel(const InfallibleTArray<ProtocolFdMapping>& aFds, - base::ProcessHandle aPeerProcess, - mozilla::ipc::ProtocolCloneContext* aCtx) -{ - MOZ_ASSERT_UNREACHABLE("Not supported"); - return nullptr; -} - void ImageBridgeParent::OnChannelConnected(int32_t aPid) { mCompositorThreadHolder = GetCompositorThreadHolder(); } bool
--- a/gfx/layers/ipc/ImageBridgeParent.h +++ b/gfx/layers/ipc/ImageBridgeParent.h @@ -129,22 +129,16 @@ public: using CompositableParentManager::SendPendingAsyncMessages; static void SendPendingAsyncMessages(base::ProcessId aChildProcessId); static ImageBridgeParent* GetInstance(ProcessId aId); static bool NotifyImageComposites(nsTArray<ImageCompositeNotification>& aNotifications); - // Overriden from IToplevelProtocol - IToplevelProtocol* - CloneToplevel(const InfallibleTArray<ProtocolFdMapping>& aFds, - base::ProcessHandle aPeerProcess, - mozilla::ipc::ProtocolCloneContext* aCtx) override; - virtual bool UsesImageBridge() const override { return true; } virtual bool IPCOpen() const override { return !mClosed; } protected: void OnChannelConnected(int32_t pid) override; void Bind(Endpoint<PImageBridgeParent>&& aEndpoint);
--- a/gfx/layers/ipc/SharedBufferManagerParent.cpp +++ b/gfx/layers/ipc/SharedBufferManagerParent.cpp @@ -355,28 +355,10 @@ SharedBufferManagerParent::GetGraphicBuf SharedBufferManagerParent* parent = GetInstance(aRef.mOwner); if (!parent) { return nullptr; } return parent->GetGraphicBuffer(aRef.mKey); } #endif -IToplevelProtocol* -SharedBufferManagerParent::CloneToplevel(const InfallibleTArray<ProtocolFdMapping>& aFds, - base::ProcessHandle aPeerProcess, - mozilla::ipc::ProtocolCloneContext* aCtx) -{ - for (unsigned int i = 0; i < aFds.Length(); i++) { - if (aFds[i].protocolId() == unsigned(GetProtocolId())) { - UniquePtr<Transport> transport = - OpenDescriptor(aFds[i].fd(), Transport::MODE_SERVER); - PSharedBufferManagerParent* bufferManager = Create(transport.get(), base::GetProcId(aPeerProcess)); - bufferManager->CloneManagees(this, aCtx); - bufferManager->IToplevelProtocol::SetTransport(Move(transport)); - return bufferManager; - } - } - return nullptr; -} - } /* namespace layers */ } /* namespace mozilla */
--- a/gfx/layers/ipc/SharedBufferManagerParent.h +++ b/gfx/layers/ipc/SharedBufferManagerParent.h @@ -58,21 +58,16 @@ public: virtual bool RecvAllocateGrallocBuffer(const IntSize&, const uint32_t&, const uint32_t&, mozilla::layers::MaybeMagicGrallocBufferHandle*) override; virtual bool RecvDropGrallocBuffer(const mozilla::layers::MaybeMagicGrallocBufferHandle& handle) override; /** * Break the buffer's sharing state, decrease buffer reference for both side */ static void DropGrallocBuffer(ProcessId id, mozilla::layers::SurfaceDescriptor aDesc); - // Overriden from IToplevelProtocol - IToplevelProtocol* - CloneToplevel(const InfallibleTArray<ProtocolFdMapping>& aFds, - base::ProcessHandle aPeerProcess, - mozilla::ipc::ProtocolCloneContext* aCtx) override; MessageLoop* GetMessageLoop(); protected: /** * Break the buffer's sharing state, decrease buffer reference for both side * * Must be called from SharedBufferManagerParent's thread
--- a/gfx/vr/ipc/VRManagerParent.cpp +++ b/gfx/vr/ipc/VRManagerParent.cpp @@ -212,25 +212,16 @@ VRManagerParent::DeferredDestroy() void VRManagerParent::ActorDestroy(ActorDestroyReason why) { UnregisterFromManager(); MessageLoop::current()->PostTask(NewRunnableMethod(this, &VRManagerParent::DeferredDestroy)); } -mozilla::ipc::IToplevelProtocol* -VRManagerParent::CloneToplevel(const InfallibleTArray<mozilla::ipc::ProtocolFdMapping>& aFds, - base::ProcessHandle aPeerProcess, - mozilla::ipc::ProtocolCloneContext* aCtx) -{ - MOZ_ASSERT_UNREACHABLE("Not supported"); - return nullptr; -} - void VRManagerParent::OnChannelConnected(int32_t aPid) { mCompositorThreadHolder = layers::CompositorThreadHolder::GetSingleton(); } bool VRManagerParent::RecvRefreshDisplays()
--- a/gfx/vr/ipc/VRManagerParent.h +++ b/gfx/vr/ipc/VRManagerParent.h @@ -28,22 +28,16 @@ class VRManagerParent final : public PVR { public: explicit VRManagerParent(ProcessId aChildProcessId); static VRManagerParent* CreateSameProcess(); static bool CreateForGPUProcess(Endpoint<PVRManagerParent>&& aEndpoint); static bool CreateForContent(Endpoint<PVRManagerParent>&& aEndpoint); - // Overriden from IToplevelProtocol - ipc::IToplevelProtocol* - CloneToplevel(const InfallibleTArray<ipc::ProtocolFdMapping>& aFds, - base::ProcessHandle aPeerProcess, - mozilla::ipc::ProtocolCloneContext* aCtx) override; - virtual base::ProcessId GetChildProcessId() override; // ShmemAllocator virtual ShmemAllocator* AsShmemAllocator() override { return this; } virtual bool AllocShmem(size_t aSize, ipc::SharedMemory::SharedMemoryType aType,
--- a/ipc/glue/BackgroundImpl.cpp +++ b/ipc/glue/BackgroundImpl.cpp @@ -269,21 +269,16 @@ private: MOZ_ASSERT(!mLiveActorArray); MOZ_ASSERT(mIsOtherProcessActor); mLiveActorArray = aLiveActorArray; mLiveActorArray->AppendElement(this); } // These methods are only called by IPDL. - virtual IToplevelProtocol* - CloneToplevel(const InfallibleTArray<ProtocolFdMapping>& aFds, - ProcessHandle aPeerProcess, - ProtocolCloneContext* aCtx) override; - virtual void ActorDestroy(ActorDestroyReason aWhy) override; }; // ----------------------------------------------------------------------------- // ChildImpl Declaration // ----------------------------------------------------------------------------- @@ -1286,51 +1281,16 @@ ParentImpl::MainThreadActorDestroy() MOZ_ASSERT(sLiveActorCount); sLiveActorCount--; // This may be the last reference! Release(); } -IToplevelProtocol* -ParentImpl::CloneToplevel(const InfallibleTArray<ProtocolFdMapping>& aFds, - ProcessHandle aPeerProcess, - ProtocolCloneContext* aCtx) -{ - AssertIsInMainProcess(); - AssertIsOnMainThread(); - MOZ_ASSERT(aCtx->GetContentParent()); - - const ProtocolId protocolId = GetProtocolId(); - - for (unsigned int i = 0; i < aFds.Length(); i++) { - if (static_cast<ProtocolId>(aFds[i].protocolId()) != protocolId) { - continue; - } - - UniquePtr<Transport> transport = OpenDescriptor(aFds[i].fd(), Transport::MODE_SERVER); - if (!transport) { - NS_WARNING("Failed to open transport!"); - break; - } - - PBackgroundParent* clonedActor = - Alloc(aCtx->GetContentParent(), transport.get(), base::GetProcId(aPeerProcess)); - MOZ_ASSERT(clonedActor); - - clonedActor->CloneManagees(this, aCtx); - clonedActor->SetTransport(Move(transport)); - - return clonedActor; - } - - return nullptr; -} - void ParentImpl::ActorDestroy(ActorDestroyReason aWhy) { AssertIsInMainProcess(); AssertIsOnBackgroundThread(); MOZ_ASSERT(!mActorDestroyed); MOZ_ASSERT_IF(mIsOtherProcessActor, mLiveActorArray);
--- a/ipc/glue/ProtocolUtils.cpp +++ b/ipc/glue/ProtocolUtils.cpp @@ -146,42 +146,16 @@ IToplevelProtocol::GetOpenedActorsUnsafe actor; actor = actor->getNext()) { MOZ_RELEASE_ASSERT(count < aActorsMax); aActors[count++] = actor; } return count; } -IToplevelProtocol* -IToplevelProtocol::CloneToplevel(const InfallibleTArray<ProtocolFdMapping>& aFds, - base::ProcessHandle aPeerProcess, - ProtocolCloneContext* aCtx) -{ - NS_NOTREACHED("Clone() for this protocol actor is not implemented"); - return nullptr; -} - -void -IToplevelProtocol::CloneOpenedToplevels(IToplevelProtocol* aTemplate, - const InfallibleTArray<ProtocolFdMapping>& aFds, - base::ProcessHandle aPeerProcess, - ProtocolCloneContext* aCtx) -{ - StaticMutexAutoLock al(gProtocolMutex); - - nsTArray<IToplevelProtocol*> actors; - aTemplate->GetOpenedActorsLocked(actors); - - for (size_t i = 0; i < actors.Length(); i++) { - IToplevelProtocol* newactor = actors[i]->CloneToplevel(aFds, aPeerProcess, aCtx); - AddOpenedActorLocked(newactor); - } -} - class ChannelOpened : public IPC::Message { public: ChannelOpened(TransportDescriptor aDescriptor, ProcessId aOtherProcess, ProtocolId aProtocol, PriorityValue aPriority = PRIORITY_NORMAL) : IPC::Message(MSG_ROUTING_CONTROL, // these only go to top-level actors
--- a/ipc/glue/ProtocolUtils.h +++ b/ipc/glue/ProtocolUtils.h @@ -180,20 +180,16 @@ public: virtual Shmem::SharedMemory* LookupSharedMemory(int32_t) = 0; virtual bool IsTrackingSharedMemory(Shmem::SharedMemory*) = 0; virtual bool DestroySharedMemory(Shmem&) = 0; // XXX odd ducks, acknowledged virtual ProcessId OtherPid() const = 0; virtual MessageChannel* GetIPCChannel() = 0; - // The implementation of function is generated by code generator. - virtual void CloneManagees(ListenerT* aSource, - ProtocolCloneContext* aCtx) = 0; - Maybe<ListenerT*> ReadActor(const IPC::Message* aMessage, PickleIterator* aIter, bool aNullable, const char* aActorDescription, int32_t aProtocolTypeId); }; typedef IPCMessageStart ProtocolId; /** * All RPC protocols should implement this interface. @@ -252,26 +248,16 @@ public: virtual MessageChannel* GetIPCChannel() = 0; // This Unsafe version should only be used when all other threads are // frozen, since it performs no locking. It also takes a stack-allocated // array and its size (number of elements) rather than an nsTArray. The Nuwa // code that calls this function is not allowed to allocate memory. size_t GetOpenedActorsUnsafe(IToplevelProtocol** aActors, size_t aActorsMax); - virtual IToplevelProtocol* - CloneToplevel(const InfallibleTArray<ProtocolFdMapping>& aFds, - base::ProcessHandle aPeerProcess, - ProtocolCloneContext* aCtx); - - void CloneOpenedToplevels(IToplevelProtocol* aTemplate, - const InfallibleTArray<ProtocolFdMapping>& aFds, - base::ProcessHandle aPeerProcess, - ProtocolCloneContext* aCtx); - private: void AddOpenedActorLocked(IToplevelProtocol* aActor); void GetOpenedActorsLocked(nsTArray<IToplevelProtocol*>& aActors); LinkedList<IToplevelProtocol> mOpenActors; // All protocol actors opened by this. IToplevelProtocol* mOpener; ProtocolId mProtocolId;
--- a/ipc/ipdl/ipdl/lower.py +++ b/ipc/ipdl/ipdl/lower.py @@ -1152,19 +1152,16 @@ class Protocol(ipdl.ast.Protocol): return ExprVar('GetIPCChannel') def callGetChannel(self, actorThis=None): fn = self.getChannelMethod() if actorThis is not None: fn = ExprSelect(actorThis, '->', fn.name) return ExprCall(fn) - def cloneManagees(self): - return ExprVar('CloneManagees') - def cloneProtocol(self): return ExprVar('CloneProtocol') def processingErrorVar(self): assert self.decl.type.isToplevel() return ExprVar('ProcessingError') def shouldContinueFromTimeoutVar(self): @@ -3659,22 +3656,16 @@ class _GenerateProtocolActorCode(ipdl.as const=1, virtual=1)) getchannel = MethodDefn(MethodDecl( p.getChannelMethod().name, ret=Type('MessageChannel', ptr=1), virtual=1)) - clonemanagees = MethodDefn(MethodDecl( - p.cloneManagees().name, - params=[ Decl(protocolbase, sourcevar.name), - Decl(clonecontexttype, clonecontextvar.name) ], - virtual=1)) - cloneprotocol = MethodDefn(MethodDecl( p.cloneProtocol().name, params=[ Decl(Type('Channel', ptr=True), 'aChannel'), Decl(clonecontexttype, clonecontextvar.name) ], ret=Type(p.fqBaseClass(), ptr=1), virtual=1)) if p.decl.type.isToplevel(): @@ -3868,98 +3859,25 @@ class _GenerateProtocolActorCode(ipdl.as cloneprotocol.addstmts([ _fatalError('Clone() has not yet been implemented'), StmtReturn(ExprLiteral.NULL) ]) othervar = ExprVar('other') managertype = Type(_actorName(p.name, self.side), ptr=1) - if len(p.managesStmts): - otherstmt = StmtDecl(Decl(managertype, - othervar.name), - init=ExprCast(sourcevar, - managertype, - static=1)) - clonemanagees.addstmt(otherstmt) - # Keep track of types created with an INOUT ctor. We need to call # Register() or RegisterID() for them depending on the side the managee # is created. inoutCtorTypes = [] for msg in p.messageDecls: msgtype = msg.decl.type if msgtype.isCtor() and msgtype.isInout(): inoutCtorTypes.append(msgtype.constructedType()) - actorvar = ExprVar('actor') - for managee in p.managesStmts: - block = StmtBlock() - manageeipdltype = managee.decl.type - actortype = ipdl.type.ActorType(manageeipdltype) - manageecxxtype = _cxxBareType(actortype, self.side) - manageearray = p.managedVar(manageeipdltype, self.side) - abortstmt = StmtIf(ExprBinary(actorvar, '==', ExprLiteral.NULL)) - abortstmt.addifstmts([ - _fatalError('can not clone an ' + actortype.name() + ' actor'), - StmtReturn()]) - forstmt = StmtFor( - init=Param(Type.UINT32, ivar.name, ExprLiteral.ZERO), - cond=ExprBinary(ivar, '<', _callCxxArrayLength(kidsvar)), - update=ExprPrefixUnop(ivar, '++')) - - registerstmt = StmtExpr(ExprCall(p.registerIDMethod(), - args=[actorvar, _actorId(actorvar)])) - # Implement if (actor id > 0) then Register() else RegisterID() - if manageeipdltype in inoutCtorTypes: - registerif = StmtIf(ExprBinary(_actorId(actorvar), - '>', - ExprLiteral.ZERO)) - registerif.addifstmt(StmtExpr(ExprCall(p.registerMethod(), - args=[actorvar]))) - registerif.addelsestmt(registerstmt) - registerstmt = registerif - - forstmt.addstmts([ - StmtExpr(ExprAssn( - actorvar, - ExprCast( - ExprCall( - ExprSelect(ithkid, - '->', - p.cloneProtocol().name), - args=[ p.channelForSubactor(), - clonecontextvar ]), - manageecxxtype, - static=1))), - abortstmt, - StmtExpr(ExprAssn(_actorId(actorvar), _actorId(ithkid))), - StmtExpr(ExprAssn(_actorManager(actorvar), ExprVar.THIS)), - StmtExpr(ExprAssn( - _actorChannel(actorvar), - p.channelForSubactor())), - StmtExpr(ExprAssn(_actorState(actorvar), _actorState(ithkid))), - StmtExpr(_callInsertManagedActor(manageearray, actorvar)), - registerstmt, - StmtExpr(ExprCall( - ExprSelect(actorvar, - '->', - p.cloneManagees().name), - args=[ ithkid, clonecontextvar ])) - ]) - block.addstmts([ - StmtDecl(Decl(_cxxArrayType(manageecxxtype, ref=0), - kidsvar.name)), - StmtExpr(ExprCall(ExprSelect(othervar, '->', - p.managedMethod(manageeipdltype, self.side).name), - args=[ kidsvar ])), - StmtDecl(Decl(manageecxxtype, actorvar.name)), - forstmt]) - clonemanagees.addstmt(block) - # all protocols share the "same" RemoveManagee() implementation pvar = ExprVar('aProtocolId') listenervar = ExprVar('aListener') removemanagee = MethodDefn(MethodDecl( p.removeManageeMethod().name, params=[ Decl(_protocolIdType(), pvar.name), Decl(protocolbase, listenervar.name) ], virtual=1)) @@ -4001,17 +3919,16 @@ class _GenerateProtocolActorCode(ipdl.as unregister, removemanagee, createshmem, lookupshmem, istracking, destroyshmem, otherpid, getchannel, - clonemanagees, cloneprotocol, Whitespace.NL ] def makeShmemIface(self): p = self.protocol idvar = ExprVar('id') sizevar = ExprVar('aSize') typevar = ExprVar('aType')
--- a/netwerk/ipc/NeckoParent.cpp +++ b/netwerk/ipc/NeckoParent.cpp @@ -701,24 +701,16 @@ NeckoParent::AllocPTransportProviderPare bool NeckoParent::DeallocPTransportProviderParent(PTransportProviderParent* aActor) { RefPtr<TransportProviderParent> provider = dont_AddRef(static_cast<TransportProviderParent*>(aActor)); return true; } -void -NeckoParent::CloneManagees(ProtocolBase* aSource, - mozilla::ipc::ProtocolCloneContext* aCtx) -{ - aCtx->SetNeckoParent(this); // For cloning protocols managed by this. - PNeckoParent::CloneManagees(aSource, aCtx); -} - mozilla::ipc::IProtocol* NeckoParent::CloneProtocol(Channel* aChannel, mozilla::ipc::ProtocolCloneContext* aCtx) { ContentParent* contentParent = aCtx->GetContentParent(); nsAutoPtr<PNeckoParent> actor(contentParent->AllocPNeckoParent()); if (!actor || !contentParent->RecvPNeckoConstructor(actor)) { return nullptr;
--- a/netwerk/ipc/NeckoParent.h +++ b/netwerk/ipc/NeckoParent.h @@ -53,19 +53,16 @@ public: CreateChannelLoadContext(const PBrowserOrId& aBrowser, PContentParent* aContent, const SerializedLoadContext& aSerialized, nsCOMPtr<nsILoadContext> &aResult); virtual void ActorDestroy(ActorDestroyReason aWhy) override; virtual nsresult OfflineNotification(nsISupports *) override; virtual uint32_t GetAppId() override { return NECKO_UNKNOWN_APP_ID; } - virtual void - CloneManagees(ProtocolBase* aSource, - mozilla::ipc::ProtocolCloneContext* aCtx) override; virtual PCookieServiceParent* AllocPCookieServiceParent() override; virtual bool RecvPCookieServiceConstructor(PCookieServiceParent* aActor) override { return PNeckoParent::RecvPCookieServiceConstructor(aActor); } /*