BroadcastChannelChild.cpp (1403B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #include "BroadcastChannelChild.h" 8 9 #include "BroadcastChannel.h" 10 11 namespace mozilla { 12 13 using namespace ipc; 14 15 namespace dom { 16 17 BroadcastChannelChild::BroadcastChannelChild() 18 : mBC(nullptr), mActorDestroyed(false) {} 19 20 BroadcastChannelChild::~BroadcastChannelChild() { MOZ_ASSERT(!mBC); } 21 22 mozilla::ipc::IPCResult BroadcastChannelChild::RecvNotify( 23 const MessageData& aData) { 24 if (!mBC) { 25 // The object is going to be deleted soon. No notify is required. 26 return IPC_OK(); 27 } 28 29 RefPtr<BroadcastChannel> self = mBC; 30 self->MessageReceived(aData); 31 return IPC_OK(); 32 } 33 34 mozilla::ipc::IPCResult BroadcastChannelChild::RecvRefMessageDelivered( 35 const nsID& aMessageID, const uint32_t& aOtherBCs) { 36 if (!mBC) { 37 // The object is going to be deleted soon. No notify is required. 38 return IPC_OK(); 39 } 40 41 RefPtr<BroadcastChannel> self = mBC; 42 self->MessageDelivered(aMessageID, aOtherBCs); 43 return IPC_OK(); 44 } 45 46 void BroadcastChannelChild::ActorDestroy(ActorDestroyReason aWhy) { 47 mActorDestroyed = true; 48 } 49 50 } // namespace dom 51 } // namespace mozilla