ffos:gecko 内核之ProcLoader,进程加载器分析PProcLoader--ipdl

ELF加载器的原理与实现 ELF加载器 为什么需要ELF 隔离应用服务和内核服务 有了ELF,我们的应用程序都可以通过编译成ELF的方式从外部加载,系统内核部分只提供关键的内核服务(内存管理/中断/调度/IPC)和系统服务(文件/网络),用户服务程序都可以通过ELF的方式进行加载。同时库的同步更新可以在不更新内核的情况进行同步更新。 提供统一编程接口 我们通过提供统一的POSIX标准库,来为用户提供标准的编程接口,方便了应用程序开发人员进行标准开发 应用程序可以动态加载和卸载 通过ELF,用户可以动态的加载和卸载相关服务, 阅读详情

b2g与nuwa相互通信的具体ipdl源码分析:

ipdl机制分析:

PProcLoader.ipdl接口定义文件:

objdir-gecko/ipc/ipdl/PProcLoader
PProcLoaderChild.cpp  

PProcLoader.cpp       

PProcLoaderParent.cpp

 

接口文件:

 PProcLoader.ipdl

 

protocol PProcLoader
{
child:
  /**
   * Request B2G loader service to load content process.
   *
   * It actually calls the main() function of plugin-container.
   */
  async Load(nsCString[] argv, nsCString[] env,
             FDRemap[] fdsRemap, uint32_t privs,
             int32_t cookie);

//child send,parent那里有个recv

parent:
  /**
   * The acknowledgement of Load().
   */
  async LoadComplete(int32_t pid, int32_t cookie);

//这里parent send,child那边revc
};

故,有两对send ,recv

 

B2G loader service指的是nuwa那端吗?它会调用plugin-container的main()函数,

没错。

PProcLoaderChild.cpp  部分源码分析:

共享内存,send, recv,open

PProcLoaderChild::SendLoadComplete

PProcLoaderChild::GetIPCChannel()

  if ((!(PProcLoader::Transition(mState, Trigger(Trigger::Send, PProcLoader::Msg_Load__ID), (&(mState)))))) {
                NS_WARNING("bad state transition!");
            }
 if ((!(RecvLoad(mozilla::Move(argv), mozilla::Move(env), mozilla::Move(fdsRemap), mozilla::Move(privs), mozilla::Move(cookie))))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler for Load returned error code");
                return MsgProcessingError;
            }

PProcLoaderChild::Write()

PProcLoaderChild::Read()

 

 

PProcLoaderParent.cpp部分源码

PProcLoaderParent::PProcLoaderParent()

PProcLoaderParent::Open()

PProcLoaderParent::SendLoad()

PProcLoaderParent::CreateSharedMemory()

PProcLoaderParent::AdoptSharedMemory(

PProcLoaderParent::LookupSharedMemory(Shmem::id_t aId)

 PProcLoaderParent::OnMessageReceived(const Message& msg__){压根没收到消息,为什么???

 if ((!(PProcLoader::Transition(mState, Trigger(Trigger::Recv, PProcLoader::Msg_LoadComplete__ID), (&(mState)))))) {
                NS_WARNING("bad state transition!");
            }
            if ((!(RecvLoadComplete(mozilla::Move(pid), mozilla::Move(cookie))))) {//一直不能complete,使一直服务???
                mozilla::ipc::ProtocolErrorBreakpoint("Handler for LoadComplete returned error code");
                return MsgProcessingError;

            }

}

PProcLoaderParent::Write()

PProcLoaderParent::Read()

ipdl里的两个接口,

child: Load  //目的在于与加载某某某

parent: LoadComplete//目的是告诉child Load 结束了,完成了

 

child .cpp里实现的是SendLoadComplete以及它所接收的消息是RecvLoad,

parent.cpp里实现的是SendLoad  ,比较奇怪,它只发而似乎永远没收到RecvLoadComplete,OnMessageReceived都没执行,不知为何?

 

 

 

 

PProcLoader.cpp     源码分析,

//
// Automatically generated by ipdlc.
// Edit at your own risk
//


#include "mozilla/ipc/PProcLoader.h"

namespace mozilla {
namespace ipc {
namespace PProcLoader {

bool
Transition(//过渡
        State from,
        mozilla::ipc::Trigger trigger,
        State* next)
{
    switch (from) {
    case __Null:
    case __Error:
        return (__Null) == (from);
    case __Dead:
        NS_RUNTIMEABORT("__delete__()d actor");
        return false;
    case __Dying:
        NS_RUNTIMEABORT("__delete__()d (and unexpectedly dying) actor");
        return false;
    default:
        NS_RUNTIMEABORT("corrupted actor state");
        return false;
    }
}

} // namespace PProcLoader
} // namespace ipc
} // namespace mozilla

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct FDRemap|
//
namespace mozilla {
namespace ipc {
MOZ_IMPLICIT FDRemap::FDRemap() :
    mapto_()
{
    Init();
}

FDRemap::~FDRemap()
{
}

auto FDRemap::operator==(const FDRemap& _o) const -> bool
{
    if ((!((fd()) == ((_o).fd())))) {
        return false;
    }
    if ((!((mapto()) == ((_o).mapto())))) {
        return false;
    }
    return true;
}

auto FDRemap::Init() -> void
{
}

auto FDRemap::Assign(//分派,调派
        const FileDescriptor& _fd,
        const int& _mapto) -> void
{
    fd_ = _fd;
    mapto_ = _mapto;
}

} // namespace ipc
} // namespace mozilla

 

 

 

 

 

PProcLoaderChild.cpp  部分源码分析:

共享内存,send, recv,open

PProcLoaderChild::SendLoadComplete

PProcLoaderChild::GetIPCChannel()

PProcLoaderChild::OnMessageReceived(const Message& msg__){

if ((!(PProcLoader::Transition(mState, Trigger(Trigger::Send, PProcLoader::Msg_Load__ID), (&(mState)))))) {}

if ((!(RecvLoad(mozilla::Move(argv), mozilla::Move(env), mozilla::Move(fdsRemap), mozilla::Move(privs), mozilla::Move(cookie)))))

{}

}

PProcLoaderChild::Write()

PProcLoaderChild::Read()

 

 

 

//
// Automatically generated by ipdlc.
// Edit at your own risk
//


#include "mozilla/ipc/PProcLoaderChild.h"
#ifdef MOZ_CRASHREPORTER
#  include "nsXULAppAPI.h"
#endif


#include "nsIFile.h"
#include "GeckoProfiler.h"

///////////////////////////////////////////////////////////////////////////////////
//personal debug switch//////////////////////////////////////////////////////////
/********************************************************************************
P_DEBUG:
0     turn off debug
1        turn on debug
 ********************************************************************************/
#ifndef P_LOGI

#include "utils/Log.h"
#define P_DEBUG    1
#if P_DEBUG
static char mark_label[64] = "pmain-PProcLoaderChild";
#define SEPARATOR_LINE "----------------------------------"
      #define STA_LINE ">>>>>>>>>>>>>>>>>>>>>>>>>>>st.func"
      #define END_LINE "<<<<<<<<<<<<<<<<<<<<<<<<<<<ed.func"
#define LONNG_LINE = "------------------------------------------------------------------------------"
//static char mark_label[18] = "";//for the label you wish to mark when you adb logcat or whatever
#define P_LOGI(fmt, ...) ALOGI("%s-,F:%s:%d, Fuc:%s  " fmt,mark_label,(char*)__FILE__,__LINE__,(char*)__FUNCTION__,##__VA_ARGS__)
//#define P_LOGI(fmt, ...) printf("%s-,F:%s:%d, Fuc:%s  " fmt,mark_label,(char*)__FILE__,__LINE__,(char*)__FUNCTION__,##__VA_ARGS__)
#else
#define P_LOGI(...)
#endif

#endif

///////////////////////////////////////////////////////////////////////////////////
    //P_LOGI(SEPARATOR_LINE);
///////////////////////////////////////////////////////////////////////////////////
namespace mozilla {
namespace ipc {


auto PProcLoaderChild::ActorDestroy(ActorDestroyReason aWhy) -> void
{
}

auto PProcLoaderChild::ProcessingError(
        Result aCode,
        const char* aReason) -> void
{
}

auto PProcLoaderChild::ShouldContinueFromReplyTimeout() -> bool
{
    return true;
}

auto PProcLoaderChild::EnteredCxxStack() -> void
{
}

auto PProcLoaderChild::ExitedCxxStack() -> void
{
}

auto PProcLoaderChild::EnteredCall() -> void
{
}

auto PProcLoaderChild::ExitedCall() -> void
{
}


MOZ_IMPLICIT PProcLoaderChild::PProcLoaderChild() : //用来初始化变量
    mozilla::ipc::IToplevelProtocol(PProcLoaderMsgStart),
    mChannel(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
    mLastRouteId(0),
    mOtherPid(mozilla::ipc::kInvalidProcessId),
    mLastShmemId(0),
    mState(PProcLoader::__Start)
{
    MOZ_COUNT_CTOR(PProcLoaderChild);
}


PProcLoaderChild::~PProcLoaderChild()
{
    MOZ_COUNT_DTOR(PProcLoaderChild);
}

auto PProcLoaderChild::Open(
        Channel::Transport* aTransport,
        base::ProcessId aOtherPid,
        MessageLoop* aThread,
        mozilla::ipc::Side aSide) -> bool
{
P_LOGI(SEPARATOR_LINE);
    mOtherPid = aOtherPid;
P_LOGI("call -- return (mChannel).Open(aTransport, aThread:XXXX, aSide:%d); --->", aSide);
    return (mChannel).Open(aTransport, aThread, aSide);
}

auto PProcLoaderChild::Open(//auto 返回值占位
        MessageChannel* aChannel,
        MessageLoop* aMessageLoop,
        mozilla::ipc::Side aSide) -> bool
{
P_LOGI(SEPARATOR_LINE);
    mOtherPid = base::GetCurrentProcId();
P_LOGI("call -- return (mChannel).Open(aChannel:XXXX, aMessageLoop:XXXXtype, aSide:%d); --->", aSide);
    return (mChannel).Open(aChannel, aMessageLoop, aSide);
}

auto PProcLoaderChild::Close() -> void
{
    (mChannel).Close();
}

auto PProcLoaderChild::state() -> PProcLoader::State
{
    return mState;
}

auto PProcLoaderChild::SendLoadComplete(
        const int32_t& pid,
        const int32_t& cookie) -> bool
{
    P_LOGI(SEPARATOR_LINE);
    PProcLoader::Msg_LoadComplete* msg__ = new PProcLoader::Msg_LoadComplete(MSG_ROUTING_CONTROL);

    Write(pid, msg__);
    Write(cookie, msg__);


    if (mozilla::ipc::LoggingEnabledFor("PProcLoader")) {
        (msg__)->Log("[PProcLoaderChild] Sending ", OtherPid(), false);
    }
    PROFILER_LABEL("IPDL::PProcLoader", "AsyncSendLoadComplete", js::ProfileEntry::Category::OTHER);
    if ((!(PProcLoader::Transition(mState, Trigger(Trigger::Recv, PProcLoader::Msg_LoadComplete__ID), (&(mState)))))) {
        NS_WARNING("bad state transition!");
    }

    bool sendok__ = (mChannel).Send(msg__);
    return sendok__;
}

auto PProcLoaderChild::Register(ProtocolBase* aRouted) -> int32_t
{
    int32_t tmp = (--(mLastRouteId));
    (mActorMap).AddWithID(aRouted, tmp);
    return tmp;
}

auto PProcLoaderChild::RegisterID(
        ProtocolBase* aRouted,
        int32_t aId) -> int32_t
{
    (mActorMap).AddWithID(aRouted, aId);
P_LOGI("call -- return aId:%d; --->",aId);
    return aId;
}

auto PProcLoaderChild::Lookup(int32_t aId) -> ProtocolBase*
{
P_LOGI("call -- return (mActorMap).Lookup(aId:%d); --->",aId);
    return (mActorMap).Lookup(aId);
}

auto PProcLoaderChild::Unregister(int32_t aId) -> void
{
    return (mActorMap).Remove(aId);
}

auto PProcLoaderChild::RemoveManagee(
        int32_t aProtocolId,
        ProtocolBase* aListener) -> void
{
    NS_RUNTIMEABORT("unreached");
    return;
}

auto PProcLoaderChild::CreateSharedMemory(
        size_t aSize,
        Shmem::SharedMemory::SharedMemoryType aType,
        bool aUnsafe,
        Shmem::id_t* aId) -> Shmem::SharedMemory*
{
    RefPtr<Shmem::SharedMemory> segment(Shmem::Alloc(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), aSize, aType, aUnsafe));
    if ((!(segment))) {
        return nullptr;
    }
    Shmem shmem(
            Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(),
            (segment).get(),
            (--(mLastShmemId)));
    Message* descriptor = (shmem).ShareTo(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), OtherPid(), MSG_ROUTING_CONTROL);
    if ((!(descriptor))) {
        return nullptr;
    }
    if ((!((mChannel).Send(descriptor)))) {
    }
    (*(aId)) = (shmem).Id(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead());
    Shmem::SharedMemory* rawSegment = (segment).get();
    (mShmemMap).AddWithID(((segment).forget()).take(), (*(aId)));
    return rawSegment;
}

auto PProcLoaderChild::AdoptSharedMemory(
        Shmem::SharedMemory* segment,
        Shmem::id_t* aId) -> bool
{
    Shmem shmem(
            Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(),
            segment,
            (--(mLastShmemId)));
    Message* descriptor = (shmem).ShareTo(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), OtherPid(), MSG_ROUTING_CONTROL);
    if ((!(descriptor))) {
        return false;
    }
    if ((!((mChannel).Send(descriptor)))) {
    }
    (*(aId)) = (shmem).Id(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead());
    (mShmemMap).AddWithID(segment, (*(aId)));
    (segment)->AddRef();
    return true;
}

auto PProcLoaderChild::LookupSharedMemory(Shmem::id_t aId) -> Shmem::SharedMemory*
{
    return (mShmemMap).Lookup(aId);
}

auto PProcLoaderChild::IsTrackingSharedMemory(Shmem::SharedMemory* segment) -> bool
{
    return (mShmemMap).HasData(segment);
}

auto PProcLoaderChild::DestroySharedMemory(Shmem& shmem) -> bool
{
    Shmem::id_t aId = (shmem).Id(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead());
    Shmem::SharedMemory* segment = LookupSharedMemory(aId);
    if ((!(segment))) {
        return false;
    }

    Message* descriptor = (shmem).UnshareFrom(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), OtherPid(), MSG_ROUTING_CONTROL);

    (mShmemMap).Remove(aId);
    Shmem::Dealloc(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), segment);

    if ((!((mChannel).CanSend()))) {
        delete descriptor;
        return true;
    }

    return (descriptor) && ((mChannel).Send(descriptor));
}

auto PProcLoaderChild::OtherPid() const -> base::ProcessId
{
    P_LOGI(SEPARATOR_LINE);
    P_LOGI("mOtherPid:%d",(int)mOtherPid);
    return mOtherPid;
}

auto PProcLoaderChild::GetIPCChannel() -> MessageChannel*
{
    P_LOGI(SEPARATOR_LINE);
    return (&(mChannel));
}

auto PProcLoaderChild::CloneManagees(
        ProtocolBase* aSource,
        ProtocolCloneContext* aCtx) -> void
{
}

auto PProcLoaderChild::CloneProtocol(
        Channel* aChannel,
        ProtocolCloneContext* aCtx) -> mozilla::ipc::IProtocol*
{
    NS_RUNTIMEABORT("Clone() for PProcLoader has not yet been implemented");
    return nullptr;
}

auto PProcLoaderChild::OnMessageReceived(const Message& msg__) -> PProcLoaderChild::Result
{
    P_LOGI(SEPARATOR_LINE);
    switch ((msg__).type()) {判断消息类型,如果是load类型的就处理,其他的忽略?
    case PProcLoader::Msg_Load__ID:
        {
            (const_cast<Message&>(msg__)).set_name("PProcLoader::Msg_Load");
            if (mozilla::ipc::LoggingEnabledFor("PProcLoader")) {
                (static_cast<const PProcLoader::Msg_Load*>((&(msg__))))->Log("[PProcLoaderChild] Received ", OtherPid(), true);
            }
            PROFILER_LABEL("IPDL::PProcLoader", "RecvLoad", js::ProfileEntry::Category::OTHER);

            void* iter__ = nullptr;
            nsTArray<nsCString> argv;
            nsTArray<nsCString> env;
            nsTArray<FDRemap> fdsRemap;
            uint32_t privs;
            int32_t cookie;

            if ((!(Read((&(argv)), (&(msg__)), (&(iter__)))))) {
                FatalError("Error deserializing 'nsTArray'");
                return MsgValueError;
            }
            if ((!(Read((&(env)), (&(msg__)), (&(iter__)))))) {
                FatalError("Error deserializing 'nsTArray'");
                return MsgValueError;
            }
            if ((!(Read((&(fdsRemap)), (&(msg__)), (&(iter__)))))) {
                FatalError("Error deserializing 'nsTArray'");
                return MsgValueError;
            }
            if ((!(Read((&(privs)), (&(msg__)), (&(iter__)))))) {
                FatalError("Error deserializing 'uint32_t'");
                return MsgValueError;
            }
            if ((!(Read((&(cookie)), (&(msg__)), (&(iter__)))))) {
                FatalError("Error deserializing 'int32_t'");
                return MsgValueError;
            }
            (msg__).EndRead(iter__);
            if ((!(PProcLoader::Transition(mState, Trigger(Trigger::Send, PProcLoader::Msg_Load__ID), (&(mState)))))) {
                NS_WARNING("bad state transition!");
            }
P_LOGI("call -- if ((!(RecvLoad(mozilla::Move(argv), mozilla::Move(env), mozilla::Move(fdsRemap), mozilla::Move(privs), mozilla::Move(cookie))))) { --->");
            if ((!(RecvLoad(mozilla::Move(argv), mozilla::Move(env), mozilla::Move(fdsRemap), mozilla::Move(privs), mozilla::Move(cookie))))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler for Load returned error code");
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    default:
        {
            return MsgNotKnown;
        }
    case SHMEM_CREATED_MESSAGE_TYPE: 消息类型为创建共享内存,不处理???
        {
            NS_RUNTIMEABORT("this protocol tree does not use shmem");
            return MsgNotKnown;
        }
    case SHMEM_DESTROYED_MESSAGE_TYPE:消息类型为销毁共享内存,不处理???
        {
            NS_RUNTIMEABORT("this protocol tree does not use shmem");
            return MsgNotKnown;
        }
    }
}

auto PProcLoaderChild::OnMessageReceived(
        const Message& msg__,
        Message*& reply__) -> PProcLoaderChild::Result
{
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
    return MsgNotKnown;
}

auto PProcLoaderChild::OnCallReceived(
        const Message& msg__,
        Message*& reply__) -> PProcLoaderChild::Result
{
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
    return MsgNotKnown;
}

auto PProcLoaderChild::OnProcessingError(
        Result aCode,
        const char* aReason) -> void
{
    return ProcessingError(aCode, aReason);
}

auto PProcLoaderChild::GetProtocolTypeId() -> int32_t
{
    return PProcLoaderMsgStart;
}

auto PProcLoaderChild::OnEnteredCxxStack() -> void
{
    return EnteredCxxStack();
}

auto PProcLoaderChild::OnExitedCxxStack() -> void
{
    return ExitedCxxStack();
}

auto PProcLoaderChild::OnEnteredCall() -> void
{
    return EnteredCall();
}

auto PProcLoaderChild::OnExitedCall() -> void
{
    return ExitedCall();
}

auto PProcLoaderChild::IsOnCxxStack() const -> bool
{
    return (mChannel).IsOnCxxStack();
}

auto PProcLoaderChild::FlushPendingInterruptQueue() -> void
{
    ((this)->mChannel).FlushPendingInterruptQueue();
}

auto PProcLoaderChild::OnChannelClose() -> void
{
    DestroySubtree(NormalShutdown);
    DeallocSubtree();
    DeallocShmems();
}

auto PProcLoaderChild::OnChannelError() -> void
{
    DestroySubtree(AbnormalShutdown);
    DeallocSubtree();
    DeallocShmems();
}

auto PProcLoaderChild::OnChannelConnected(int32_t aPid) -> void
{
}

auto PProcLoaderChild::AllocShmem(
        size_t aSize,
        Shmem::SharedMemory::SharedMemoryType aType,
        Shmem* aOutMem) -> bool
{
    Shmem::id_t id;
    Shmem::SharedMemory* rawmem(CreateSharedMemory(aSize, aType, false, (&(id))));
    if ((!(rawmem))) {
        return false;
    }

    (*(aOutMem)) = Shmem(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), rawmem, id);
    return true;
}

auto PProcLoaderChild::AllocUnsafeShmem(
        size_t aSize,
        Shmem::SharedMemory::SharedMemoryType aType,
        Shmem* aOutMem) -> bool
{
    Shmem::id_t id;
    Shmem::SharedMemory* rawmem(CreateSharedMemory(aSize, aType, true, (&(id))));
    if ((!(rawmem))) {
        return false;
    }

    (*(aOutMem)) = Shmem(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), rawmem, id);
    return true;
}

auto PProcLoaderChild::AdoptShmem(
        Shmem& aMem,
        Shmem* aOutMem) -> bool
{
    Shmem::SharedMemory* rawmem = (aMem).Segment(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead());
    if (((!(rawmem))) || (IsTrackingSharedMemory(rawmem))) {
        NS_RUNTIMEABORT("bad Shmem");
        return false;
    }

    Shmem::id_t id;
    if ((!(AdoptSharedMemory(rawmem, (&(id)))))) {
        return false;
    }

    (*(aOutMem)) = Shmem(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), rawmem, id);
    return true;
}

auto PProcLoaderChild::DeallocShmem(Shmem& aMem) -> bool
{
    bool ok = DestroySharedMemory(aMem);
#ifdef DEBUG
    if ((!(ok))) {
        NS_RUNTIMEABORT("bad Shmem");
        return false;
    }
#endif // DEBUG
    (aMem).forget(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead());
    return ok;
}

auto PProcLoaderChild::FatalError(const char* const aMsg) const -> void
{
    mozilla::ipc::FatalError("PProcLoaderChild", aMsg, 0, false);
}

auto PProcLoaderChild::DestroySubtree(ActorDestroyReason why) -> void
{
    // Finally, destroy "us".
    ActorDestroy(why);
}

auto PProcLoaderChild::DeallocSubtree() -> void
{
}

auto PProcLoaderChild::DeallocShmems() -> void
{
    for (IDMap<SharedMemory>::const_iterator cit = (mShmemMap).begin(); (cit) != ((mShmemMap).end()); (++(cit))) {
        Shmem::Dealloc(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), (cit)->second);
    }
    (mShmemMap).Clear();
}

auto PProcLoaderChild::Write(
        const nsTArray<FDRemap>& v__,
        Message* msg__) -> void
{
    uint32_t length = (v__).Length();
    Write(length, msg__);

    for (uint32_t i = 0; (i) < (length); (++(i))) {
        Write(v__[i], msg__);
    }
}

auto PProcLoaderChild::Read(
        nsTArray<FDRemap>* v__,
        const Message* msg__,
        void** iter__) -> bool
{
    FallibleTArray<FDRemap> fa;
    uint32_t length;
    if ((!(Read((&(length)), msg__, iter__)))) {
        FatalError("Error deserializing 'length' (uint32_t) of 'FDRemap[]'");
        return false;
    }

    if ((!((fa).SetLength(length, mozilla::fallible)))) {
        FatalError("Error setting the array length");
        return false;
    }
    for (uint32_t i = 0; (i) < (length); (++(i))) {
        if ((!(Read((&(fa[i])), msg__, iter__)))) {
            FatalError("Error deserializing 'FDRemap[i]'");
            return false;
        }
    }
    (v__)->SwapElements(fa);
    return true;
}

auto PProcLoaderChild::Write(
        const FDRemap& v__,
        Message* msg__) -> void
{
    Write((v__).fd(), msg__);
    Write((v__).mapto(), msg__);
}

auto PProcLoaderChild::Read(
        FDRemap* v__,
        const Message* msg__,
        void** iter__) -> bool
{
    if ((!(Read((&((v__)->fd())), msg__, iter__)))) {
        FatalError("Error deserializing 'fd' (FileDescriptor) member of 'FDRemap'");
        return false;
    }
    if ((!(Read((&((v__)->mapto())), msg__, iter__)))) {
        FatalError("Error deserializing 'mapto' (int) member of 'FDRemap'");
        return false;
    }
    return true;
}

auto PProcLoaderChild::Write(
        const FileDescriptor& v__,
        Message* msg__) -> void
{
    FileDescriptor::PickleType pfd = (v__).ShareTo(FileDescriptor::IPDLPrivate(), OtherPid());
    IPC::WriteParam(msg__, pfd);
}

auto PProcLoaderChild::Read(
        FileDescriptor* v__,
        const Message* msg__,
        void** iter__) -> bool
{
    FileDescriptor::PickleType pfd;
    if ((!(IPC::ReadParam(msg__, iter__, (&(pfd)))))) {
        return false;
    }

    FileDescriptor fd = FileDescriptor(FileDescriptor::IPDLPrivate(), pfd);
    if ((!((fd).IsValid()))) {
        mozilla::ipc::ProtocolErrorBreakpoint("[PProcLoaderChild] Received an invalid file descriptor!");
    }

    (*(v__)) = fd;
    return true;
}

 

} // namespace ipc
} // namespace mozilla

 

 

 

 

 

 

PProcLoaderParent.cpp部分源码

PProcLoaderParent::PProcLoaderParent()

PProcLoaderParent::Open()

PProcLoaderParent::SendLoad()

PProcLoaderParent::CreateSharedMemory()

PProcLoaderParent::AdoptSharedMemory(

PProcLoaderParent::LookupSharedMemory(Shmem::id_t aId)

 PProcLoaderParent::OnMessageReceived(const Message& msg__){

 if ((!(PProcLoader::Transition(mState, Trigger(Trigger::Recv, PProcLoader::Msg_LoadComplete__ID), (&(mState)))))) {
                NS_WARNING("bad state transition!");
            }
            if ((!(RecvLoadComplete(mozilla::Move(pid), mozilla::Move(cookie))))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler for LoadComplete returned error code");
                return MsgProcessingError;
            }

}

 

 

//
// Automatically generated by ipdlc.
// Edit at your own risk
//


#include "mozilla/ipc/PProcLoaderParent.h"
#ifdef MOZ_CRASHREPORTER
#  include "nsXULAppAPI.h"
#endif


#include "nsIFile.h"
#include "GeckoProfiler.h"

///////////////////////////////////////////////////////////////////////////////////
//personal debug switch//////////////////////////////////////////////////////////
/********************************************************************************
P_DEBUG:
0     turn off debug
1        turn on debug
 ********************************************************************************/
#ifndef P_LOGI

#include "utils/Log.h"
#define P_DEBUG    1
#if P_DEBUG
static char mark_label[64] = "pmain-PProcLoaderParent";
#define SEPARATOR_LINE "----------------------------------"
      #define STA_LINE ">>>>>>>>>>>>>>>>>>>>>>>>>>>st.func"
      #define END_LINE "<<<<<<<<<<<<<<<<<<<<<<<<<<<ed.func"
#define LONNG_LINE = "------------------------------------------------------------------------------"
//static char mark_label[18] = "";//for the label you wish to mark when you adb logcat or whatever
#define P_LOGI(fmt, ...) ALOGI("%s-,F:%s:%d, Fuc:%s  " fmt,mark_label,(char*)__FILE__,__LINE__,(char*)__FUNCTION__,##__VA_ARGS__)
//#define P_LOGI(fmt, ...) printf("%s-,F:%s:%d, Fuc:%s  " fmt,mark_label,(char*)__FILE__,__LINE__,(char*)__FUNCTION__,##__VA_ARGS__)
#else
#define P_LOGI(...)
#endif

#endif

///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
namespace mozilla {
namespace ipc {

 

auto PProcLoaderParent::ProcessingError(
        Result aCode,
        const char* aReason) -> void
{
}

auto PProcLoaderParent::ShouldContinueFromReplyTimeout() -> bool
{
    return true;
}

auto PProcLoaderParent::EnteredCxxStack() -> void
{
}

auto PProcLoaderParent::ExitedCxxStack() -> void
{
}

auto PProcLoaderParent::EnteredCall() -> void
{
}

auto PProcLoaderParent::ExitedCall() -> void
{
}

MOZ_IMPLICIT PProcLoaderParent::PProcLoaderParent() :
    mozilla::ipc::IToplevelProtocol(PProcLoaderMsgStart),
    mChannel(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
    mLastRouteId(1),
    mOtherPid(mozilla::ipc::kInvalidProcessId),
    mLastShmemId(1),
    mState(PProcLoader::__Start)
{
    MOZ_COUNT_CTOR(PProcLoaderParent);
}

PProcLoaderParent::~PProcLoaderParent()
{
    MOZ_COUNT_DTOR(PProcLoaderParent);
}

auto PProcLoaderParent::Open(
        Channel::Transport* aTransport,
        base::ProcessId aOtherPid,
        MessageLoop* aThread,
        mozilla::ipc::Side aSide) -> bool
{
    mOtherPid = aOtherPid;
P_LOGI("call -- mOtherPid = base::ProcessId aOtherPid: %d; --->",mOtherPid);
P_LOGI("call -- return (mChannel).Open(aTransport, aThread, aSide); --->");
    return (mChannel).Open(aTransport, aThread, aSide);
}

auto PProcLoaderParent::Open(
        MessageChannel* aChannel,
        MessageLoop* aMessageLoop,
        mozilla::ipc::Side aSide) -> bool
{
P_LOGI(SEPARATOR_LINE);
    mOtherPid = base::GetCurrentProcId();
P_LOGI("call -- mOtherPid = base::GetCurrentProcId():%d; --->",mOtherPid);
P_LOGI("call -- return (mChannel).Open(aChannel, aMessageLoop, aSide); --->");
    return (mChannel).Open(aChannel, aMessageLoop, aSide);
}

auto PProcLoaderParent::Close() -> void
{
    (mChannel).Close();
}

auto PProcLoaderParent::state() -> PProcLoader::State
{
    return mState;
}

auto PProcLoaderParent::SendLoad(
        const nsTArray<nsCString>& argv,
        const nsTArray<nsCString>& env,
        const nsTArray<FDRemap>& fdsRemap,
        const uint32_t& privs,
        const int32_t& cookie) -> bool
{
    P_LOGI(SEPARATOR_LINE);
    PProcLoader::Msg_Load* msg__ = new PProcLoader::Msg_Load(MSG_ROUTING_CONTROL);

    Write(argv, msg__);
    Write(env, msg__);
    Write(fdsRemap, msg__);
    Write(privs, msg__);
    Write(cookie, msg__);

 


    if (mozilla::ipc::LoggingEnabledFor("PProcLoader")) {
        (msg__)->Log("[PProcLoaderParent] Sending ", OtherPid(), false);
    }
    PROFILER_LABEL("IPDL::PProcLoader", "AsyncSendLoad", js::ProfileEntry::Category::OTHER);
    if ((!(PProcLoader::Transition(mState, Trigger(Trigger::Send, PProcLoader::Msg_Load__ID), (&(mState)))))) {
        NS_WARNING("bad state transition!");
    }

    bool sendok__ = (mChannel).Send(msg__);
    return sendok__;
}

auto PProcLoaderParent::Register(ProtocolBase* aRouted) -> int32_t
{
    int32_t tmp = (++(mLastRouteId));
    (mActorMap).AddWithID(aRouted, tmp);
    return tmp;
}

auto PProcLoaderParent::RegisterID(
        ProtocolBase* aRouted,
        int32_t aId) -> int32_t
{
P_LOGI("call -- (mActorMap).AddWithID(aRouted, aId:%d); --->",aId);
    (mActorMap).AddWithID(aRouted, aId);
P_LOGI("call -- return aId: %d; --->",aId );
    return aId;
}

auto PProcLoaderParent::Lookup(int32_t aId) -> ProtocolBase*
{
P_LOGI(SEPARATOR_LINE);
P_LOGI("call -- return (mActorMap).Lookup(aId:%d); --->",aId);
    return (mActorMap).Lookup(aId);
}

auto PProcLoaderParent::Unregister(int32_t aId) -> void
{
    return (mActorMap).Remove(aId);
}

auto PProcLoaderParent::RemoveManagee(
        int32_t aProtocolId,
        ProtocolBase* aListener) -> void
{
    NS_RUNTIMEABORT("unreached");
    return;
}

auto PProcLoaderParent::CreateSharedMemory(
        size_t aSize,
        Shmem::SharedMemory::SharedMemoryType aType,
        bool aUnsafe,
        Shmem::id_t* aId) -> Shmem::SharedMemory*
{
    RefPtr<Shmem::SharedMemory> segment(Shmem::Alloc(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), aSize, aType, aUnsafe));
    if ((!(segment))) {
        return nullptr;
    }
    Shmem shmem(
            Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(),
            (segment).get(),
            (++(mLastShmemId)));
    Message* descriptor = (shmem).ShareTo(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), OtherPid(), MSG_ROUTING_CONTROL);
    if ((!(descriptor))) {
        return nullptr;
    }
    if ((!((mChannel).Send(descriptor)))) {
    }
    (*(aId)) = (shmem).Id(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead());
    Shmem::SharedMemory* rawSegment = (segment).get();
    (mShmemMap).AddWithID(((segment).forget()).take(), (*(aId)));
    return rawSegment;
}

auto PProcLoaderParent::AdoptSharedMemory(
        Shmem::SharedMemory* segment,
        Shmem::id_t* aId) -> bool
{
    Shmem shmem(
            Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(),
            segment,
            (++(mLastShmemId)));
    Message* descriptor = (shmem).ShareTo(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), OtherPid(), MSG_ROUTING_CONTROL);
    if ((!(descriptor))) {
        return false;
    }
    if ((!((mChannel).Send(descriptor)))) {
    }
    (*(aId)) = (shmem).Id(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead());
    (mShmemMap).AddWithID(segment, (*(aId)));
    (segment)->AddRef();
    return true;
}

auto PProcLoaderParent::LookupSharedMemory(Shmem::id_t aId) -> Shmem::SharedMemory*
{
    return (mShmemMap).Lookup(aId);
}

auto PProcLoaderParent::IsTrackingSharedMemory(Shmem::SharedMemory* segment) -> bool
{
    return (mShmemMap).HasData(segment);
}

auto PProcLoaderParent::DestroySharedMemory(Shmem& shmem) -> bool
{
    Shmem::id_t aId = (shmem).Id(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead());
    Shmem::SharedMemory* segment = LookupSharedMemory(aId);
    if ((!(segment))) {
        return false;
    }

    Message* descriptor = (shmem).UnshareFrom(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), OtherPid(), MSG_ROUTING_CONTROL);

    (mShmemMap).Remove(aId);
    Shmem::Dealloc(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), segment);

    if ((!((mChannel).CanSend()))) {
        delete descriptor;
        return true;
    }

    return (descriptor) && ((mChannel).Send(descriptor));
}

auto PProcLoaderParent::OtherPid() const -> base::ProcessId
{
    P_LOGI(SEPARATOR_LINE);
P_LOGI("call -- return mOtherPid:%d; --->",mOtherPid);
    return mOtherPid;
}

auto PProcLoaderParent::GetIPCChannel() -> MessageChannel*
{
    return (&(mChannel));
}

auto PProcLoaderParent::CloneManagees(
        ProtocolBase* aSource,
        ProtocolCloneContext* aCtx) -> void
{
}

auto PProcLoaderParent::CloneProtocol(
        Channel* aChannel,
        ProtocolCloneContext* aCtx) -> mozilla::ipc::IProtocol*
{
    NS_RUNTIMEABORT("Clone() for PProcLoader has not yet been implemented");
    return nullptr;
}

auto PProcLoaderParent::OnMessageReceived(const Message& msg__) -> PProcLoaderParent::Result
{
    P_LOGI(SEPARATOR_LINE);
    switch ((msg__).type()) {
    case PProcLoader::Msg_LoadComplete__ID:
        {
            (const_cast<Message&>(msg__)).set_name("PProcLoader::Msg_LoadComplete");
            if (mozilla::ipc::LoggingEnabledFor("PProcLoader")) {
                (static_cast<const PProcLoader::Msg_LoadComplete*>((&(msg__))))->Log("[PProcLoaderParent] Received ", OtherPid(), true);
            }
            PROFILER_LABEL("IPDL::PProcLoader", "RecvLoadComplete", js::ProfileEntry::Category::OTHER);

            void* iter__ = nullptr;
            int32_t pid;
            int32_t cookie;

            if ((!(Read((&(pid)), (&(msg__)), (&(iter__)))))) {
                FatalError("Error deserializing 'int32_t'");
                return MsgValueError;
            }
            if ((!(Read((&(cookie)), (&(msg__)), (&(iter__)))))) {
                FatalError("Error deserializing 'int32_t'");
                return MsgValueError;
            }
            (msg__).EndRead(iter__);
            if ((!(PProcLoader::Transition(mState, Trigger(Trigger::Recv, PProcLoader::Msg_LoadComplete__ID), (&(mState)))))) {
                NS_WARNING("bad state transition!");
            }
            P_LOGI("call -- if ((!(RecvLoadComplete(mozilla::Move(pid:%d), mozilla::Move(cookie))))) { --->",pid);
            if ((!(RecvLoadComplete(mozilla::Move(pid), mozilla::Move(cookie))))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler for LoadComplete returned error code");
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    default:
        {
            return MsgNotKnown;
        }
    case SHMEM_CREATED_MESSAGE_TYPE:
        {
            NS_RUNTIMEABORT("this protocol tree does not use shmem");
            return MsgNotKnown;
        }
    case SHMEM_DESTROYED_MESSAGE_TYPE:
        {
            NS_RUNTIMEABORT("this protocol tree does not use shmem");
            return MsgNotKnown;
        }
    }
}

auto PProcLoaderParent::OnMessageReceived(
        const Message& msg__,
        Message*& reply__) -> PProcLoaderParent::Result
{
    P_LOGI(SEPARATOR_LINE);
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
    return MsgNotKnown;
}

auto PProcLoaderParent::OnCallReceived(
        const Message& msg__,
        Message*& reply__) -> PProcLoaderParent::Result
{
    P_LOGI(SEPARATOR_LINE);
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
    return MsgNotKnown;
}

auto PProcLoaderParent::OnProcessingError(
        Result aCode,
        const char* aReason) -> void
{
    return ProcessingError(aCode, aReason);
}

auto PProcLoaderParent::GetProtocolTypeId() -> int32_t
{
    return PProcLoaderMsgStart;
}

auto PProcLoaderParent::OnEnteredCxxStack() -> void
{
    return EnteredCxxStack();
}

auto PProcLoaderParent::OnExitedCxxStack() -> void
{
    return ExitedCxxStack();
}

auto PProcLoaderParent::OnEnteredCall() -> void
{
    return EnteredCall();
}

auto PProcLoaderParent::OnExitedCall() -> void
{
    return ExitedCall();
}

auto PProcLoaderParent::IsOnCxxStack() const -> bool
{
    return (mChannel).IsOnCxxStack();
}

auto PProcLoaderParent::FlushPendingInterruptQueue() -> void
{
    ((this)->mChannel).FlushPendingInterruptQueue();
}

auto PProcLoaderParent::OnChannelClose() -> void
{
    DestroySubtree(NormalShutdown);
    DeallocSubtree();
    DeallocShmems();
}

auto PProcLoaderParent::OnChannelError() -> void
{
    DestroySubtree(AbnormalShutdown);
    DeallocSubtree();
    DeallocShmems();
}

auto PProcLoaderParent::OnChannelConnected(int32_t aPid) -> void
{
    P_LOGI(SEPARATOR_LINE);
P_LOGI("call -- auto PProcLoaderParent::OnChannelConnected(int32_t aPid:%d) -> void --->",aPid);
}

auto PProcLoaderParent::AllocShmem(
        size_t aSize,
        Shmem::SharedMemory::SharedMemoryType aType,
        Shmem* aOutMem) -> bool
{
    Shmem::id_t id;
    Shmem::SharedMemory* rawmem(CreateSharedMemory(aSize, aType, false, (&(id))));
    if ((!(rawmem))) {
        return false;
    }

    (*(aOutMem)) = Shmem(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), rawmem, id);
    return true;
}

auto PProcLoaderParent::AllocUnsafeShmem(
        size_t aSize,
        Shmem::SharedMemory::SharedMemoryType aType,
        Shmem* aOutMem) -> bool
{
    Shmem::id_t id;
    Shmem::SharedMemory* rawmem(CreateSharedMemory(aSize, aType, true, (&(id))));
    if ((!(rawmem))) {
        return false;
    }

    (*(aOutMem)) = Shmem(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), rawmem, id);
    return true;
}

auto PProcLoaderParent::AdoptShmem(
        Shmem& aMem,
        Shmem* aOutMem) -> bool
{
    Shmem::SharedMemory* rawmem = (aMem).Segment(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead());
    if (((!(rawmem))) || (IsTrackingSharedMemory(rawmem))) {
        NS_WARNING("bad Shmem");
        return false;
    }

    Shmem::id_t id;
    if ((!(AdoptSharedMemory(rawmem, (&(id)))))) {
        return false;
    }

    (*(aOutMem)) = Shmem(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), rawmem, id);
    return true;
}

auto PProcLoaderParent::DeallocShmem(Shmem& aMem) -> bool
{
    bool ok = DestroySharedMemory(aMem);
#ifdef DEBUG
    if ((!(ok))) {
        NS_WARNING("bad Shmem");
        return false;
    }
#endif // DEBUG
    (aMem).forget(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead());
    return ok;
}

auto PProcLoaderParent::SetOtherProcessId(base::ProcessId aOtherPid) -> void
{
    mOtherPid = aOtherPid;
}

auto PProcLoaderParent::TakeMinidump(
        nsIFile** aDump,
        uint32_t* aSequence) const -> bool
{
#ifdef MOZ_CRASHREPORTER
    return XRE_TakeMinidumpForChild(OtherPid(), aDump, aSequence);
#else
    return false;
#endif
}

auto PProcLoaderParent::FatalError(const char* const aMsg) const -> void
{
    mozilla::ipc::FatalError("PProcLoaderParent", aMsg, OtherPid(), true);
}

auto PProcLoaderParent::DestroySubtree(ActorDestroyReason why) -> void
{
    // Finally, destroy "us".
    ActorDestroy(why);
}

auto PProcLoaderParent::DeallocSubtree() -> void
{
}

auto PProcLoaderParent::DeallocShmems() -> void
{
    for (IDMap<SharedMemory>::const_iterator cit = (mShmemMap).begin(); (cit) != ((mShmemMap).end()); (++(cit))) {
        Shmem::Dealloc(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), (cit)->second);
    }
    (mShmemMap).Clear();
}

auto PProcLoaderParent::Write(
        const nsTArray<FDRemap>& v__,
        Message* msg__) -> void
{
    uint32_t length = (v__).Length();
    Write(length, msg__);

    for (uint32_t i = 0; (i) < (length); (++(i))) {
        Write(v__[i], msg__);
    }
}

auto PProcLoaderParent::Read(
        nsTArray<FDRemap>* v__,
        const Message* msg__,
        void** iter__) -> bool
{
    FallibleTArray<FDRemap> fa;
    uint32_t length;
    if ((!(Read((&(length)), msg__, iter__)))) {
        FatalError("Error deserializing 'length' (uint32_t) of 'FDRemap[]'");
        return false;
    }

    if ((!((fa).SetLength(length, mozilla::fallible)))) {
        FatalError("Error setting the array length");
        return false;
    }
    for (uint32_t i = 0; (i) < (length); (++(i))) {
        if ((!(Read((&(fa[i])), msg__, iter__)))) {
            FatalError("Error deserializing 'FDRemap[i]'");
            return false;
        }
    }
    (v__)->SwapElements(fa);
    return true;
}

auto PProcLoaderParent::Write(
        const FDRemap& v__,
        Message* msg__) -> void
{
    Write((v__).fd(), msg__);
    Write((v__).mapto(), msg__);
}

auto PProcLoaderParent::Read(
        FDRemap* v__,
        const Message* msg__,
        void** iter__) -> bool
{
    if ((!(Read((&((v__)->fd())), msg__, iter__)))) {
        FatalError("Error deserializing 'fd' (FileDescriptor) member of 'FDRemap'");
        return false;
    }
    if ((!(Read((&((v__)->mapto())), msg__, iter__)))) {
        FatalError("Error deserializing 'mapto' (int) member of 'FDRemap'");
        return false;
    }
    return true;
}

auto PProcLoaderParent::Write(
        const FileDescriptor& v__,
        Message* msg__) -> void
{
    FileDescriptor::PickleType pfd = (v__).ShareTo(FileDescriptor::IPDLPrivate(), OtherPid());
    IPC::WriteParam(msg__, pfd);
}

auto PProcLoaderParent::Read(
        FileDescriptor* v__,
        const Message* msg__,
        void** iter__) -> bool
{
    FileDescriptor::PickleType pfd;
    if ((!(IPC::ReadParam(msg__, iter__, (&(pfd)))))) {
        return false;
    }

    FileDescriptor fd = FileDescriptor(FileDescriptor::IPDLPrivate(), pfd);
    if ((!((fd).IsValid()))) {
        mozilla::ipc::ProtocolErrorBreakpoint("[PProcLoaderParent] Received an invalid file descriptor!");
    }

    (*(v__)) = fd;
    return true;
}

 

} // namespace ipc
} // namespace mozilla

 

 

 

 

 

PCHunter系统安全工具全解析 本文还有配套的精品资源,点击获取 简介:本文讨论的“PCHunter”是一款由中国安全研究人员开发的系统安全分析与诊断工具,专注于Windows操作系统的深入理解与管理。PCHunter的特色功能涵盖了进程管理、注册表编辑、文件系统浏览、网络连接监控等方面,并提供系统信息报告和安全扫描等增值服务。用户可选择安装32位或64位版本以适配不同架构的计算机,但需注意该工具的使用风... 阅读详情

相关推荐

Gecko-Profiler-Addon :(不建议使用)用于控制Gecko内置Profiler的Addon

弃用通知 请注意,自Firefox 76起,该附加组件已被弃用。现在,分析器直接内置在浏览器中。 转到 ,然后单击“启用Profiler菜单按钮”按钮以启用该功能。 如果您已安装并启用了插件,则Firefox配置文件将自动升级为使用新按钮。 壁虎探查器 此加载项使您可以从Firefox收集配置文件,并在打开这些配置文件。 安装 大多数用户从安装它,然后单击那里的链接。 通过首先将文件下载到本地计算机,也可以直接从此存储库安装它。 然后将其拖放到Firefox窗口中进行安装。 用法 该插件将工具栏按钮添加到您的主工具栏。 如果探查器正在运行,则按钮的图标为蓝色,如果探查器已停止,则按钮的图标为

【2025版】最新手把手病毒分析 | 挖矿病毒处置总结,从零基础到精通,收藏这篇就够了!

我们是_

Python_0011的博客 1722

PTPX功耗分析实战——从脚本配置到报告解读

本文详细介绍了PTPX功耗分析的全流程,从脚本配置到报告解读,帮助工程师快速掌握芯片设计中的功耗估算技术。文章涵盖了环境搭建、波形文件处理、功耗报告解析等关键环节,并提供了实战经验和优化建议,特别适合需要提升PTPX功耗分析效率的开发者。

weixin_29248313的博客 293

【2025版】最新手把手病毒分析 挖矿病毒处置总结,从零基础到精通,收藏这篇就够了!

我们是_

wananxuexihu的博客 5920

使用VLC库实现视频播放器(WPF版)

使用wpf制作一个视频播放器 一、 LibVLCSharp介绍 LibVLCSharp是基于VideoLAN的LibVLC库的.NET平台的跨平台音频和视频API。它提供了一个全面的多媒体API,可以跨移动、服务器和桌面使用,以呈现视频和输出音频。支持Mono、.NET Framework和.NET核心运行时。在vs工具中,只需要安装截图中得两个nuget包。 二、视频播放器的实现 视频播放器的实现需要用到两个比较nuget包中提供的类,MediaPlayer类。MediaPlayer类型用于控

cangqiongxiaoye的博客 1万+

本体研究综述(转)

(这篇文章是从http://imarine.blog.163.com/中转载过来的,个人觉得对本体的介绍比较全面!)本体综述本体作为一种能在语义和知识层次上描述领域概念的建模工具,其目标是捕获相关领域的知识,确定该领域内共同认可的词汇,通过概念之间的关系来描述概念的语义,提供对该领域知识的共同理解。语义Web(the Semantic Web)是在本体理论基础之上对现有Web所进行的扩展[

zhenshideni611的专栏 1845

Mozilla Firefox os系统构架详解

原文地址:http://www.firefoxos.cc/thread-711-1-1.html Terminology(术语) Gaia: B2G系统的用户界面。B2G系统启动后,手机屏幕上所绘制的所有内容都属于Gaia的一部分。也就是说在B2G系统中,用户所见到的几乎所有的UI界面都是基于Gaia实现的。Gaia实现了锁屏、主屏、拨号键盘、短信应用、相机应用......。Gaia是完全...

weixin_30326515的博客 453

VisionPro 9.0 QuickBuild里用C#脚本调用Halcon 23.11模型,保姆级图文配置流程

本文详细介绍了如何在VisionPro 9.0 QuickBuild环境中使用C#脚本调用Halcon 23.11深度学习模型,提供从环境配置到模型集成的保姆级图文教程。重点解决图像格式转换、许可证配置等工业视觉检测中的常见问题,帮助开发者快速实现高效、稳定的视觉检测流水线部署。

weixin_27027459的博客 446

NSArray简介

数组是一个集合类,是有序的,可以根据编制的索引找到想要的结果。OC数组只能存储对象(如字符串、数组、字典等),不能存储基本数据类型(如int,float,char),也不能存储nil。分为不可变数组(NSArray)和不可变数组(NSMutableArray)。不可变数组一经创建就不能对其内容进行操作。本篇文章只介绍NSArray的一些简单用法。NSMutableArray继承自NSArray。 ...

zhaoName的博客 2223

2021年高职组DCN信息安全管理与评估赛题-国赛真题解析答案

2021年高职组DCN信息安全管理与评估赛题-国赛真题解析答案 购买专栏解锁更多资源 DCRS工作任务 DCRS 开启 telnet 登录功能,用户名 dcn01,密码 dcn01,配置使 用 telnet 方式登录终端界面前显示如下授权信息: “WARNING!!! Authorised access only, all of your done will be recorded! Disconnected IMMEDIATELY if you are not an authorised user! O

Jay 1022

VTK GPU 加速渲染技术

/ 创建颜色工具// 创建立方体数据// 创建OpenGL映射器(注意使用vtkOpenGLPolyDataMapper而不是常规的vtkPolyDataMapper)// 启用VBO(顶点缓冲对象)// 声明几何体是静态的以获得最佳性能// 创建actor// 创建渲染器、渲染窗口和交互器renderWindow->SetWindowName("VTK自定义着色器示例");// 添加actor到渲染器。

深之JohnChen的专栏 1250

【转】Linux下进程隐藏的常见手法及侦测手段

Linux系统中进程隐藏的常见手法及侦测方法

tpriwwq的专栏 1万+

比NTP还牛逼的时间同步协议:1588v2,亚微秒级!

1588v2,又称为Precision Time Protocol Version 2,即精密时间协议的第二版本,或称为PTPv2,是一种精密时间同步协议标准,旨在实现网络中设备之间的高精度时间同步。该协议由IEEE标准组织发布,并在网络测量和控制系统中得到广泛应用。1588v2的主要目的是在计算机网络中提供高度准确的时间同步。它可用于确保不同设备之间的时钟同步,从而协调它们的操作。这对于需要协同工作的系统、无线通信基站等具有关键性的应用非常重要。

网络技术联盟站 4289

计算机系统-程序加载器

程序加载器,这是一个内核的雏形

文天大人 1033

SAP ABAP 实用小技巧合集 (一)

本合集包含了笔者从事 ABAP 开发 17 年以来积累的小技巧。持续更新。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 3266

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

操作系统的 (program)loader(程序加载器)

在计算机科学中,加载器(也叫程序加载器)属于操作系统的一部分,用于加载程序(programs)和库(libraries)。加载器是执行程序和代码必不可少的组件,正是它负责将程序送入内存,为程序的运行提供准备。加载的工作一旦完成,操作系统才会移交控制权给被加载的程序代码以执行该程序。嵌入式系统无需加载器,代码可直接在 ROM 中执行。特别地,为了加载操作系统本身,在 booting(自举)的过程中,还

4256

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

WebKit和Gecko浏览器内核渲染原理

给大家推荐一篇浏览器渲染原理的文章: 点击以下链接跳转查看:???????????? 浏览器的工作原理:新式网络浏览器幕后揭秘(地址:https://www.html5rocks.com/zh/tutorials/internals/howbrowserswork/#The_HTML_grammar_definition) ...

llq886的博客 805

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

ffos : b2g loader main到b2g_main

fork 之后分两条线, b2g 进程: main(b2g process)--&gt; b2g_main---&gt;do_main--&gt; startup xpcom 的过程: main()-&gt;RunProcesses()-&gt;b2g_main()-&gt;do_main()-&gt;XRE_main-&gt;ScopedXPCOMStartup::Initialize(...

hunter 359

b2g 启动Log分析:b2g,nuwa,preallocated,app

https://blog.csdn.net/hunter___/article/details/83016461 https://blog.csdn.net/hunter___/article/details/83022983     b2g 进程主线程b2g thread 经过b2g loader,保存或加载各必备资源,完成后。开始runprocess,即开始运行新的进程,开始fork操...

hunter 312

聊一聊Linux下进程隐藏的常见手法及侦测手段

0x00.前言 进程隐藏是恶意软件隐藏自身痕迹逃避系统管理人员发现的常用伎俩之一,当然,安全防护人员有时候也会使用到,比如隐藏蜜罐中的监控进程而不被入侵者觉察等。笔者也曾在多次安全应急响应经历中遇到过多各式各样的进程隐藏伎俩,了解进程隐藏的常见手法及发现手段是每一位安全运维工程师所应掌握的知识点。本文抛砖引玉,浅谈我所了解的Linux下进程隐藏手段及发现技巧,也希望读者能够积极分享自己相关经验与...

大方子 1万+

Windows常见基本进程一:CTF Loader 进程

 OFFICEXP:CTFMON 及其功能介绍概要在运行 Microsoft Office XP 程序时,文件 Ctfmon.exe (Ctfmon) 将在后台运行,甚至在退出所有 Office 程序之后也是如此。 什么是 Ctfmon.exe (Ctfmon.exe) 文件? Ctfmon.exe 能够激活中文可选用户输入方法文本输入处理器 (TIP) 和 Microsoft Offic

紫晶花园-计算机技术分园 1万+

Http 401错误重现实验及解决办法

根据http协议对状态码的定义,401代表未经授权的访问。在IIS中在401的基础上定义了一系列的子状态码来代表各种不同情况下未经授权访问的具体原因。 401.1 - Logon failed. -登陆失败 401.2 - Logon failed due to server configuration.-基于服务器配置的登陆失败 401.3 - Unauthorized due to AC...

web开发 1万+

Nuwa是如何以及为何启动的

b2g loader fork 之后兵分两路各自一路往前,b2g去发展完善完成成熟它自己。另一个差不多可以先叫plungin-container 进程也自己去发展完善成熟完成它自己(其中的过程是plungin-container去load出nuwa相关进程),最后把它自己贡献给nuwa,不就是setasnuwaprocess,所以此时此进程就换帅,由plugin-container process...

hunter 1658

firefox调试记录6——Firefox主窗口创建过程研究

到此为止,可以说已经到了firefox比较关键的地方了,其打开过程弄得比较清楚了,现在先来理清楚firefox是如何创建浏览器窗口,并最终展示在用户面前。这里先分析一下AppShell->Run()开始调用到消息循环开始这个过程。 当程序运行到~\firefox-8.0.source\toolkit\components\startup\nsAppRunner.cpp第35444行(在函数XRE

JumuFENG's blog 1231
上一篇: 永久解决 adb error: insufficient permissions for device的问题
下一篇: 类,构造函数
nedwons
博客等级 码龄9年 311粉丝 572原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值