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

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim:set ts=2 sw=2 sts=2 et cindent: */
       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_PresentationConnection_h
       8             : #define mozilla_dom_PresentationConnection_h
       9             : 
      10             : #include "mozilla/DOMEventTargetHelper.h"
      11             : #include "mozilla/dom/TypedArray.h"
      12             : #include "mozilla/WeakPtr.h"
      13             : #include "mozilla/dom/PresentationConnectionBinding.h"
      14             : #include "mozilla/dom/PresentationConnectionCloseEventBinding.h"
      15             : #include "nsIPresentationListener.h"
      16             : #include "nsIRequest.h"
      17             : #include "nsWeakReference.h"
      18             : 
      19             : namespace mozilla {
      20             : namespace dom {
      21             : 
      22             : class Blob;
      23             : class PresentationConnectionList;
      24             : 
      25             : class PresentationConnection final : public DOMEventTargetHelper
      26             :                                    , public nsIPresentationSessionListener
      27             :                                    , public nsIRequest
      28             :                                    , public SupportsWeakPtr<PresentationConnection>
      29             : {
      30             : public:
      31             :   NS_DECL_ISUPPORTS_INHERITED
      32           0 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(PresentationConnection,
      33             :                                            DOMEventTargetHelper)
      34             :   NS_DECL_NSIPRESENTATIONSESSIONLISTENER
      35             :   NS_DECL_NSIREQUEST
      36           0 :   MOZ_DECLARE_WEAKREFERENCE_TYPENAME(PresentationConnection)
      37             : 
      38             :   static already_AddRefed<PresentationConnection>
      39             :   Create(nsPIDOMWindowInner* aWindow,
      40             :          const nsAString& aId,
      41             :          const nsAString& aUrl,
      42             :          const uint8_t aRole,
      43             :          PresentationConnectionList* aList = nullptr);
      44             : 
      45             :   virtual void DisconnectFromOwner() override;
      46             : 
      47             :   virtual JSObject* WrapObject(JSContext* aCx,
      48             :                                JS::Handle<JSObject*> aGivenProto) override;
      49             : 
      50             :   // WebIDL (public APIs)
      51             :   void GetId(nsAString& aId) const;
      52             : 
      53             :   void GetUrl(nsAString& aUrl) const;
      54             : 
      55             :   PresentationConnectionState State() const;
      56             : 
      57             :   PresentationConnectionBinaryType BinaryType() const;
      58             : 
      59             :   void SetBinaryType(PresentationConnectionBinaryType aType);
      60             : 
      61             :   void Send(const nsAString& aData,
      62             :             ErrorResult& aRv);
      63             : 
      64             :   void Send(Blob& aData,
      65             :             ErrorResult& aRv);
      66             : 
      67             :   void Send(const ArrayBuffer& aData,
      68             :             ErrorResult& aRv);
      69             : 
      70             :   void Send(const ArrayBufferView& aData,
      71             :             ErrorResult& aRv);
      72             : 
      73             :   void Close(ErrorResult& aRv);
      74             : 
      75             :   void Terminate(ErrorResult& aRv);
      76             : 
      77             :   bool
      78             :   Equals(uint64_t aWindowId, const nsAString& aId);
      79             : 
      80           0 :   IMPL_EVENT_HANDLER(connect);
      81           0 :   IMPL_EVENT_HANDLER(close);
      82           0 :   IMPL_EVENT_HANDLER(terminate);
      83           0 :   IMPL_EVENT_HANDLER(message);
      84             : 
      85             : private:
      86             :   PresentationConnection(nsPIDOMWindowInner* aWindow,
      87             :                          const nsAString& aId,
      88             :                          const nsAString& aUrl,
      89             :                          const uint8_t aRole,
      90             :                          PresentationConnectionList* aList);
      91             : 
      92             :   ~PresentationConnection();
      93             : 
      94             :   bool Init();
      95             : 
      96             :   void Shutdown();
      97             : 
      98             :   nsresult ProcessStateChanged(nsresult aReason);
      99             : 
     100             :   nsresult DispatchConnectionCloseEvent(PresentationConnectionClosedReason aReason,
     101             :                                          const nsAString& aMessage,
     102             :                                          bool aDispatchNow = false);
     103             : 
     104             :   nsresult DispatchMessageEvent(JS::Handle<JS::Value> aData);
     105             : 
     106             :   nsresult ProcessConnectionWentAway();
     107             : 
     108             :   nsresult AddIntoLoadGroup();
     109             : 
     110             :   nsresult RemoveFromLoadGroup();
     111             : 
     112             :   void AsyncCloseConnectionWithErrorMsg(const nsAString& aMessage);
     113             : 
     114             :   nsresult DoReceiveMessage(const nsACString& aData, bool aIsBinary);
     115             : 
     116             :   nsString mId;
     117             :   nsString mUrl;
     118             :   uint8_t mRole;
     119             :   PresentationConnectionState mState;
     120             :   RefPtr<PresentationConnectionList> mOwningConnectionList;
     121             :   nsWeakPtr mWeakLoadGroup;
     122             :   PresentationConnectionBinaryType mBinaryType;
     123             : };
     124             : 
     125             : } // namespace dom
     126             : } // namespace mozilla
     127             : 
     128             : #endif // mozilla_dom_PresentationConnection_h

Generated by: LCOV version 1.13