LCOV - app.info - objdir/ipc/ipdl/PPluginStreamParent.cpp

LCOV - code coverage report
| Current view: | directory - objdir/ipc/ipdl - PPluginStreamParent.cpp (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 190 | 0 | 0.0 %
| Date: | 2012-07-07 | Functions: | 37 | 0 | 0.0 %

           1                 : //
           2                 : // Automatically generated by ipdlc.
           3                 : // Edit at your own risk
           4                 : //
           5                 :
           6                 :
           7                 : #include "mozilla/plugins/PPluginStreamParent.h"
           8                 :
           9                 : #include "mozilla/plugins/PPluginInstanceParent.h"
          10                 :
          11                 : typedef IPC::Message Message;
          12                 : typedef mozilla::ipc::RPCChannel Channel;
          13                 : typedef mozilla::ipc::RPCChannel::RPCListener ChannelListener;
          14                 : typedef base::ProcessHandle ProcessHandle;
          15                 : typedef mozilla::ipc::AsyncChannel AsyncChannel;
          16                 : typedef mozilla::ipc::SharedMemory SharedMemory;
          17                 : typedef mozilla::ipc::Trigger Trigger;
          18                 : typedef mozilla::ipc::ActorHandle ActorHandle;
          19                 : typedef mozilla::ipc::Shmem Shmem;
          20                 : typedef mozilla::plugins::Buffer Buffer;
          21                 : using mozilla::plugins::PPluginInstanceParent;
          22                 :
          23                 : namespace mozilla {
          24                 : namespace plugins {
          25                 :
          26                 :
          27                 : bool
          28               0 : PPluginStreamParent::Answer__delete__(
          29                 :         const NPReason& reason,
          30                 :         const bool& artificial)
          31                 : {
          32               0 :     return true;
          33                 : }
          34                 :
          35                 : void
          36               0 : PPluginStreamParent::ActorDestroy(ActorDestroyReason why)
          37                 : {
          38               0 : }
          39                 :
          40               0 : PPluginStreamParent::PPluginStreamParent() :
          41                 :     mId(0),
          42               0 :     mState(PPluginStream::__Dead)
          43                 : {
          44               0 :     MOZ_COUNT_CTOR(PPluginStreamParent);
          45               0 : }
          46                 :
          47               0 : PPluginStreamParent::~PPluginStreamParent()
          48                 : {
          49               0 :     MOZ_COUNT_DTOR(PPluginStreamParent);
          50               0 : }
          51                 :
          52                 : PPluginInstanceParent*
          53               0 : PPluginStreamParent::Manager()
          54                 : {
          55               0 :     return static_cast<PPluginInstanceParent*>(mManager);
          56                 : }
          57                 :
          58                 : PPluginStream::State
          59               0 : PPluginStreamParent::state()
          60                 : {
          61               0 :     return mState;
          62                 : }
          63                 :
          64                 : bool
          65               0 : PPluginStreamParent::Call__delete__(
          66                 :         PPluginStreamParent* actor,
          67                 :         const NPReason& reason,
          68                 :         const bool& artificial)
          69                 : {
          70               0 :     if ((!(actor))) {
          71               0 :         return false;
          72                 :     }
          73                 :
          74               0 :     PPluginStream::Msg___delete__* __msg = new PPluginStream::Msg___delete__();
          75                 :
          76               0 :     (actor)->Write(actor, __msg, false);
          77               0 :     (actor)->Write(reason, __msg);
          78               0 :     (actor)->Write(artificial, __msg);
          79                 :
          80               0 :     (__msg)->set_routing_id((actor)->mId);
          81               0 :     (__msg)->set_rpc();
          82                 :
          83                 :
          84               0 :     Message __reply;
          85                 :
          86               0 :     if (mozilla::ipc::LoggingEnabled()) {
          87               0 :         (__msg)->Log("[PPluginStreamParent] Sending ", stderr);
          88                 :     }
          89               0 :     if ((!(PPluginStream::Transition((actor)->mState, Trigger(Trigger::Send, PPluginStream::Msg___delete____ID), (&((actor)->mState)))))) {
          90               0 :         NS_WARNING("bad state transition!");
          91                 :     }
          92                 :
          93               0 :     bool __sendok = ((actor)->mChannel)->Call(__msg, (&(__reply)));
          94                 :     if (false) {
          95                 :
          96                 :         if (mozilla::ipc::LoggingEnabled()) {
          97                 :             (static_cast<const PPluginStream::Reply___delete__*>((&(__reply))))->Log("[PPluginStreamParent] Received reply ", stderr);
          98                 :         }
          99                 :
         100                 :         __sendok &= false;
         101                 :     }
         102               0 :     (actor)->DestroySubtree(Deletion);
         103               0 :     (actor)->DeallocSubtree();
         104               0 :     ((actor)->mManager)->RemoveManagee(PPluginStreamMsgStart, actor);
         105                 :
         106               0 :     return __sendok;
         107                 : }
         108                 :
         109                 : int32
         110               0 : PPluginStreamParent::Register(ChannelListener* aRouted)
         111                 : {
         112               0 :     return (mManager)->Register(aRouted);
         113                 : }
         114                 :
         115                 : int32
         116               0 : PPluginStreamParent::RegisterID(
         117                 :         ChannelListener* aRouted,
         118                 :         int32 aId)
         119                 : {
         120               0 :     return (mManager)->RegisterID(aRouted, aId);
         121                 : }
         122                 :
         123                 : ChannelListener*
         124               0 : PPluginStreamParent::Lookup(int32 aId)
         125                 : {
         126               0 :     return (mManager)->Lookup(aId);
         127                 : }
         128                 :
         129                 : void
         130               0 : PPluginStreamParent::Unregister(int32 aId)
         131                 : {
         132               0 :     return (mManager)->Unregister(aId);
         133                 : }
         134                 :
         135                 : void
         136               0 : PPluginStreamParent::RemoveManagee(
         137                 :         int32 aProtocolId,
         138                 :         ChannelListener* aListener)
         139                 : {
         140               0 :     NS_RUNTIMEABORT("unreached");
         141                 :     return;
         142                 : }
         143                 :
         144                 : Shmem::SharedMemory*
         145               0 : PPluginStreamParent::CreateSharedMemory(
         146                 :         size_t aSize,
         147                 :         Shmem::SharedMemory::SharedMemoryType type,
         148                 :         bool unsafe,
         149                 :         Shmem::id_t* aId)
         150                 : {
         151               0 :     return (mManager)->CreateSharedMemory(aSize, type, unsafe, aId);
         152                 : }
         153                 :
         154                 : bool
         155               0 : PPluginStreamParent::AdoptSharedMemory(
         156                 :         Shmem::SharedMemory* segment,
         157                 :         Shmem::id_t* aId)
         158                 : {
         159               0 :     return (mManager)->AdoptSharedMemory(segment, aId);
         160                 : }
         161                 :
         162                 : Shmem::SharedMemory*
         163               0 : PPluginStreamParent::LookupSharedMemory(Shmem::id_t aId)
         164                 : {
         165               0 :     return (mManager)->LookupSharedMemory(aId);
         166                 : }
         167                 :
         168                 : bool
         169               0 : PPluginStreamParent::IsTrackingSharedMemory(Shmem::SharedMemory* segment)
         170                 : {
         171               0 :     return (mManager)->IsTrackingSharedMemory(segment);
         172                 : }
         173                 :
         174                 : bool
         175               0 : PPluginStreamParent::DestroySharedMemory(Shmem& aShmem)
         176                 : {
         177               0 :     return (mManager)->DestroySharedMemory(aShmem);
         178                 : }
         179                 :
         180                 : ProcessHandle
         181               0 : PPluginStreamParent::OtherProcess() const
         182                 : {
         183               0 :     return (mManager)->OtherProcess();
         184                 : }
         185                 :
         186                 : AsyncChannel*
         187               0 : PPluginStreamParent::GetIPCChannel()
         188                 : {
         189               0 :     return mChannel;
         190                 : }
         191                 :
         192                 : PPluginStreamParent::Result
         193               0 : PPluginStreamParent::OnMessageReceived(const Message& __msg)
         194                 : {
         195               0 :     return MsgNotKnown;
         196                 : }
         197                 :
         198                 : PPluginStreamParent::Result
         199               0 : PPluginStreamParent::OnMessageReceived(
         200                 :         const Message& __msg,
         201                 :         Message*& __reply)
         202                 : {
         203               0 :     return MsgNotKnown;
         204                 : }
         205                 :
         206                 : PPluginStreamParent::Result
         207               0 : PPluginStreamParent::OnCallReceived(
         208                 :         const Message& __msg,
         209                 :         Message*& __reply)
         210                 : {
         211               0 :     switch ((__msg).type()) {
         212                 :     case PPluginStream::Msg_NPN_Write__ID:
         213                 :         {
         214               0 :             (const_cast<Message&>(__msg)).set_name("PPluginStream::Msg_NPN_Write");
         215               0 :             if (mozilla::ipc::LoggingEnabled()) {
         216               0 :                 (static_cast<const PPluginStream::Msg_NPN_Write*>((&(__msg))))->Log("[PPluginStreamParent] Received ", stderr);
         217                 :             }
         218                 :
         219               0 :             void* __iter = 0;
         220               0 :             Buffer data;
         221                 :
         222               0 :             if ((!(Read((&(data)), (&(__msg)), (&(__iter)))))) {
         223               0 :                 FatalError("error deserializing (better message TODO)");
         224               0 :                 return MsgValueError;
         225                 :             }
         226               0 :             (__msg).EndRead(__iter);
         227               0 :             if ((!(PPluginStream::Transition(mState, Trigger(Trigger::Recv, PPluginStream::Msg_NPN_Write__ID), (&(mState)))))) {
         228               0 :                 NS_WARNING("bad state transition!");
         229                 :             }
         230                 :             int32_t written;
         231               0 :             int32 __id = mId;
         232               0 :             if ((!(AnswerNPN_Write(data, (&(written)))))) {
         233               0 :                 return MsgProcessingError;
         234                 :             }
         235                 :
         236               0 :             __reply = new PPluginStream::Reply_NPN_Write();
         237                 :
         238               0 :             Write(written, __reply);
         239               0 :             (__reply)->set_routing_id(__id);
         240               0 :             (__reply)->set_rpc();
         241               0 :             (__reply)->set_reply();
         242                 :
         243               0 :             if (mozilla::ipc::LoggingEnabled()) {
         244               0 :                 (static_cast<const PPluginStream::Reply_NPN_Write*>(__reply))->Log("[PPluginStreamParent] Sending reply ", stderr);
         245                 :             }
         246               0 :             return MsgProcessed;
         247                 :         }
         248                 :     case PPluginStream::Msg___delete____ID:
         249                 :         {
         250               0 :             (const_cast<Message&>(__msg)).set_name("PPluginStream::Msg___delete__");
         251               0 :             if (mozilla::ipc::LoggingEnabled()) {
         252               0 :                 (static_cast<const PPluginStream::Msg___delete__*>((&(__msg))))->Log("[PPluginStreamParent] Received ", stderr);
         253                 :             }
         254                 :
         255               0 :             void* __iter = 0;
         256                 :             PPluginStreamParent* actor;
         257                 :             NPReason reason;
         258                 :             bool artificial;
         259                 :
         260               0 :             if ((!(Read((&(actor)), (&(__msg)), (&(__iter)), false)))) {
         261               0 :                 FatalError("error deserializing (better message TODO)");
         262               0 :                 return MsgValueError;
         263                 :             }
         264               0 :             if ((!(Read((&(reason)), (&(__msg)), (&(__iter)))))) {
         265               0 :                 FatalError("error deserializing (better message TODO)");
         266               0 :                 return MsgValueError;
         267                 :             }
         268               0 :             if ((!(Read((&(artificial)), (&(__msg)), (&(__iter)))))) {
         269               0 :                 FatalError("error deserializing (better message TODO)");
         270               0 :                 return MsgValueError;
         271                 :             }
         272               0 :             (__msg).EndRead(__iter);
         273               0 :             if ((!(PPluginStream::Transition(mState, Trigger(Trigger::Recv, PPluginStream::Msg___delete____ID), (&(mState)))))) {
         274               0 :                 NS_WARNING("bad state transition!");
         275                 :             }
         276               0 :             if ((!(Answer__delete__(reason, artificial)))) {
         277               0 :                 return MsgProcessingError;
         278                 :             }
         279                 :
         280               0 :             int32 __id = mId;
         281               0 :             (actor)->DestroySubtree(Deletion);
         282               0 :             (actor)->DeallocSubtree();
         283               0 :             ((actor)->mManager)->RemoveManagee(PPluginStreamMsgStart, actor);
         284                 :
         285               0 :             __reply = new PPluginStream::Reply___delete__();
         286                 :
         287               0 :             (__reply)->set_routing_id(__id);
         288               0 :             (__reply)->set_rpc();
         289               0 :             (__reply)->set_reply();
         290                 :
         291               0 :             if (mozilla::ipc::LoggingEnabled()) {
         292               0 :                 (static_cast<const PPluginStream::Reply___delete__*>(__reply))->Log("[PPluginStreamParent] Sending reply ", stderr);
         293                 :             }
         294                 :
         295               0 :             return MsgProcessed;
         296                 :         }
         297                 :     default:
         298                 :         {
         299               0 :             return MsgNotKnown;
         300                 :         }
         301                 :     }
         302                 : }
         303                 :
         304                 : void
         305               0 : PPluginStreamParent::OnProcessingError(Result code)
         306                 : {
         307               0 :     NS_RUNTIMEABORT("`OnProcessingError' called on non-toplevel actor");
         308               0 : }
         309                 :
         310                 : bool
         311               0 : PPluginStreamParent::OnReplyTimeout()
         312                 : {
         313               0 :     NS_RUNTIMEABORT("`OnReplyTimeout' called on non-toplevel actor");
         314               0 :     return false;
         315                 : }
         316                 :
         317                 : void
         318               0 : PPluginStreamParent::OnChannelClose()
         319                 : {
         320               0 :     NS_RUNTIMEABORT("`OnClose' called on non-toplevel actor");
         321               0 : }
         322                 :
         323                 : void
         324               0 : PPluginStreamParent::OnChannelError()
         325                 : {
         326               0 :     NS_RUNTIMEABORT("`OnError' called on non-toplevel actor");
         327               0 : }
         328                 :
         329                 : void
         330               0 : PPluginStreamParent::OnChannelConnected(int32 pid)
         331                 : {
         332               0 :     NS_RUNTIMEABORT("'OnConnected' called on non-toplevel actor");
         333               0 : }
         334                 :
         335                 : bool
         336               0 : PPluginStreamParent::AllocShmem(
         337                 :         size_t aSize,
         338                 :         Shmem::SharedMemory::SharedMemoryType aType,
         339                 :         Shmem* aMem)
         340                 : {
         341                 :     Shmem::id_t aId;
         342               0 :     nsAutoPtr<Shmem::SharedMemory> rawmem(CreateSharedMemory(aSize, aType, false, (&(aId))));
         343               0 :     if ((!(rawmem))) {
         344               0 :         return false;
         345                 :     }
         346                 :
         347               0 :     (*(aMem)) = Shmem(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), (rawmem).forget(), aId);
         348               0 :     return true;
         349                 : }
         350                 :
         351                 : bool
         352               0 : PPluginStreamParent::AllocUnsafeShmem(
         353                 :         size_t aSize,
         354                 :         Shmem::SharedMemory::SharedMemoryType aType,
         355                 :         Shmem* aMem)
         356                 : {
         357                 :     Shmem::id_t aId;
         358               0 :     nsAutoPtr<Shmem::SharedMemory> rawmem(CreateSharedMemory(aSize, aType, true, (&(aId))));
         359               0 :     if ((!(rawmem))) {
         360               0 :         return false;
         361                 :     }
         362                 :
         363               0 :     (*(aMem)) = Shmem(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), (rawmem).forget(), aId);
         364               0 :     return true;
         365                 : }
         366                 :
         367                 : bool
         368               0 : PPluginStreamParent::AdoptShmem(
         369                 :         Shmem& aMem,
         370                 :         Shmem* aOutMem)
         371                 : {
         372               0 :     Shmem::SharedMemory* rawmem = (aMem).Segment(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead());
         373               0 :     if (((!(rawmem))) || (IsTrackingSharedMemory(rawmem))) {
         374               0 :         NS_RUNTIMEABORT("bad Shmem");
         375                 :     }
         376                 :
         377                 :     Shmem::id_t aId;
         378               0 :     if ((!(AdoptSharedMemory(rawmem, (&(aId)))))) {
         379               0 :         return false;
         380                 :     }
         381                 :
         382               0 :     (*(aOutMem)) = Shmem(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), rawmem, aId);
         383               0 :     return true;
         384                 : }
         385                 :
         386                 : bool
         387               0 : PPluginStreamParent::DeallocShmem(Shmem& aMem)
         388                 : {
         389               0 :     bool ok = DestroySharedMemory(aMem);
         390               0 :     (aMem).forget(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead());
         391               0 :     return ok;
         392                 : }
         393                 :
         394                 : void
         395               0 : PPluginStreamParent::FatalError(const char* const msg) const
         396                 : {
         397                 :     // Virtual method to prevent inlining.
         398                 :     // This give us better error reporting.
         399                 :     // See bug 589371
         400                 :
         401               0 :     NS_ERROR("IPDL error:");
         402               0 :     NS_ERROR(msg);
         403                 :
         404               0 :     NS_ERROR("[PPluginStreamParent] killing child side as a result");
         405                 :
         406               0 :     if ((!(base::KillProcess(OtherProcess(), base::PROCESS_END_KILLED_BY_USER, false)))) {
         407               0 :         NS_ERROR("  may have failed to kill child!");
         408                 :     }
         409               0 : }
         410                 :
         411                 : void
         412               0 : PPluginStreamParent::DestroySubtree(ActorDestroyReason why)
         413                 : {
         414                 :     // Unregister from our manager.
         415               0 :     Unregister(mId);
         416               0 :     mId = 1;
         417                 :
         418                 :     // Finally, destroy "us".
         419               0 :     ActorDestroy(why);
         420               0 : }
         421                 :
         422                 : void
         423               0 : PPluginStreamParent::DeallocSubtree()
         424                 : {
         425               0 : }
         426                 :
         427                 : void
         428               0 : PPluginStreamParent::Write(
         429                 :         PPluginStreamParent* __v,
         430                 :         Message* __msg,
         431                 :         bool __nullable)
         432                 : {
         433                 :     int32 id;
         434               0 :     if ((!(__v))) {
         435               0 :         if ((!(__nullable))) {
         436               0 :             NS_RUNTIMEABORT("NULL actor value passed to non-nullable param");
         437                 :         }
         438               0 :         id = 0;
         439                 :     }
         440                 :     else {
         441               0 :         id = (__v)->mId;
         442               0 :         if ((1) == (id)) {
         443               0 :             NS_RUNTIMEABORT("actor has been |delete|d");
         444                 :         }
         445                 :     }
         446                 :
         447               0 :     Write(id, __msg);
         448               0 : }
         449                 :
         450                 : bool
         451               0 : PPluginStreamParent::Read(
         452                 :         PPluginStreamParent** __v,
         453                 :         const Message* __msg,
         454                 :         void** __iter,
         455                 :         bool __nullable)
         456                 : {
         457                 :     int32 id;
         458               0 :     if ((!(Read((&(id)), __msg, __iter)))) {
         459               0 :         return false;
         460                 :     }
         461               0 :     if (((1) == (id)) || (((0) == (id)) && ((!(__nullable))))) {
         462               0 :         return false;
         463                 :     }
         464                 :
         465               0 :     if ((0) == (id)) {
         466               0 :         (*(__v)) = 0;
         467                 :     }
         468                 :     else {
         469               0 :         (*(__v)) = static_cast<PPluginStreamParent*>(Lookup(id));
         470               0 :         if ((!((*(__v))))) {
         471               0 :             return false;
         472                 :         }
         473                 :     }
         474               0 :     return true;
         475                 : }
         476                 :
         477                 :
         478                 :
         479                 : } // namespace plugins
         480                 : } // namespace mozilla

Generated by: LCOV version 1.7