LCOV - code coverage report
Current view: top level - dom/broadcastchannel - BroadcastChannel.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 5 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #ifndef mozilla_dom_BroadcastChannel_h
       8             : #define mozilla_dom_BroadcastChannel_h
       9             : 
      10             : #include "mozilla/Attributes.h"
      11             : #include "mozilla/DOMEventTargetHelper.h"
      12             : #include "nsAutoPtr.h"
      13             : #include "nsIIPCBackgroundChildCreateCallback.h"
      14             : #include "nsIObserver.h"
      15             : #include "nsTArray.h"
      16             : #include "mozilla/RefPtr.h"
      17             : 
      18             : class nsPIDOMWindowInner;
      19             : 
      20             : namespace mozilla {
      21             : 
      22             : namespace ipc {
      23             : class PrincipalInfo;
      24             : } // namespace ipc
      25             : 
      26             : namespace dom {
      27             : 
      28             : namespace workers {
      29             : class WorkerHolder;
      30             : } // namespace workers
      31             : 
      32             : class BroadcastChannelChild;
      33             : class BroadcastChannelMessage;
      34             : 
      35             : class BroadcastChannel final
      36             :   : public DOMEventTargetHelper
      37             :   , public nsIIPCBackgroundChildCreateCallback
      38             :   , public nsIObserver
      39             : {
      40             :   friend class BroadcastChannelChild;
      41             : 
      42             :   NS_DECL_NSIIPCBACKGROUNDCHILDCREATECALLBACK
      43             :   NS_DECL_NSIOBSERVER
      44             : 
      45             :   typedef mozilla::ipc::PrincipalInfo PrincipalInfo;
      46             : 
      47             : public:
      48             :   NS_DECL_ISUPPORTS_INHERITED
      49             : 
      50           0 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(BroadcastChannel,
      51             :                                            DOMEventTargetHelper)
      52             : 
      53             :   virtual JSObject*
      54             :   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
      55             : 
      56             :   static already_AddRefed<BroadcastChannel>
      57             :   Constructor(const GlobalObject& aGlobal, const nsAString& aChannel,
      58             :               ErrorResult& aRv);
      59             : 
      60           0 :   void GetName(nsAString& aName) const
      61             :   {
      62           0 :     aName = mChannel;
      63           0 :   }
      64             : 
      65             :   void PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
      66             :                    ErrorResult& aRv);
      67             : 
      68             :   void Close();
      69             : 
      70           0 :   IMPL_EVENT_HANDLER(message)
      71             : 
      72             :   void Shutdown();
      73             : 
      74             : private:
      75             :   BroadcastChannel(nsPIDOMWindowInner* aWindow,
      76             :                    const PrincipalInfo& aPrincipalInfo,
      77             :                    const nsACString& aOrigin,
      78             :                    const nsAString& aChannel);
      79             : 
      80             :   ~BroadcastChannel();
      81             : 
      82             :   void PostMessageData(BroadcastChannelMessage* aData);
      83             : 
      84             :   void PostMessageInternal(JSContext* aCx, JS::Handle<JS::Value> aMessage,
      85             :                            ErrorResult& aRv);
      86             : 
      87             :   void RemoveDocFromBFCache();
      88             : 
      89             :   RefPtr<BroadcastChannelChild> mActor;
      90             :   nsTArray<RefPtr<BroadcastChannelMessage>> mPendingMessages;
      91             : 
      92             :   nsAutoPtr<workers::WorkerHolder> mWorkerHolder;
      93             : 
      94             :   nsAutoPtr<PrincipalInfo> mPrincipalInfo;
      95             : 
      96             :   nsCString mOrigin;
      97             :   nsString mChannel;
      98             : 
      99             :   uint64_t mInnerID;
     100             : 
     101             :   enum {
     102             :     StateActive,
     103             :     StateClosing,
     104             :     StateClosed
     105             :   } mState;
     106             : };
     107             : 
     108             : } // namespace dom
     109             : } // namespace mozilla
     110             : 
     111             : #endif // mozilla_dom_BroadcastChannel_h

Generated by: LCOV version 1.13