LCOV - code coverage report
Current view: top level - dom/flyweb - FlyWebPublishedServer.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 19 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: 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_FlyWebPublishedServer_h
       8             : #define mozilla_dom_FlyWebPublishedServer_h
       9             : 
      10             : #include "mozilla/DOMEventTargetHelper.h"
      11             : #include "mozilla/MozPromise.h"
      12             : 
      13             : class nsPIDOMWindowInner;
      14             : class nsITransportProvider;
      15             : 
      16             : namespace mozilla {
      17             : 
      18             : class ErrorResult;
      19             : 
      20             : namespace dom {
      21             : 
      22             : class InternalResponse;
      23             : class InternalRequest;
      24             : class WebSocket;
      25             : struct FlyWebPublishOptions;
      26             : class FlyWebPublishedServer;
      27             : 
      28             : typedef MozPromise<RefPtr<FlyWebPublishedServer>, nsresult, false>
      29             :   FlyWebPublishPromise;
      30             : 
      31             : class FlyWebPublishedServer : public mozilla::DOMEventTargetHelper
      32             : {
      33             : public:
      34             :   FlyWebPublishedServer(nsPIDOMWindowInner* aOwner,
      35             :                         const nsAString& aName,
      36             :                         const FlyWebPublishOptions& aOptions);
      37             : 
      38             :   virtual void LastRelease() override;
      39             : 
      40             :   virtual JSObject* WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
      41             : 
      42           0 :   uint64_t OwnerWindowID() const {
      43           0 :     return mOwnerWindowID;
      44             :   }
      45             : 
      46           0 :   void GetName(nsAString& aName)
      47             :   {
      48           0 :     aName = mName;
      49           0 :   }
      50           0 :   nsAString& Name()
      51             :   {
      52           0 :     return mName;
      53             :   }
      54             : 
      55           0 :   void GetUiUrl(nsAString& aUiUrl)
      56             :   {
      57           0 :     aUiUrl = mUiUrl;
      58           0 :   }
      59             : 
      60             :   virtual void PermissionGranted(bool aGranted) = 0;
      61             : 
      62             :   virtual void OnFetchResponse(InternalRequest* aRequest,
      63             :                                InternalResponse* aResponse) = 0;
      64             :   already_AddRefed<WebSocket>
      65             :     OnWebSocketAccept(InternalRequest* aConnectRequest,
      66             :                       const Optional<nsAString>& aProtocol,
      67             :                       ErrorResult& aRv);
      68             :   virtual void OnWebSocketResponse(InternalRequest* aConnectRequest,
      69             :                                    InternalResponse* aResponse) = 0;
      70             :   virtual already_AddRefed<nsITransportProvider>
      71             :     OnWebSocketAcceptInternal(InternalRequest* aConnectRequest,
      72             :                               const Optional<nsAString>& aProtocol,
      73             :                               ErrorResult& aRv) = 0;
      74             : 
      75             :   virtual void Close();
      76             : 
      77             :   void FireFetchEvent(InternalRequest* aRequest);
      78             :   void FireWebsocketEvent(InternalRequest* aConnectRequest);
      79             :   void PublishedServerStarted(nsresult aStatus);
      80             : 
      81           0 :   IMPL_EVENT_HANDLER(fetch)
      82           0 :   IMPL_EVENT_HANDLER(websocket)
      83           0 :   IMPL_EVENT_HANDLER(close)
      84             : 
      85             :   already_AddRefed<FlyWebPublishPromise>
      86           0 :   GetPublishPromise()
      87             :   {
      88           0 :     return mPublishPromise.Ensure(__func__);
      89             :   }
      90             : 
      91             : protected:
      92           0 :   virtual ~FlyWebPublishedServer()
      93           0 :   {
      94           0 :     MOZ_ASSERT(!mIsRegistered, "Subclass dtor forgot to call Close()");
      95           0 :   }
      96             : 
      97             :   uint64_t mOwnerWindowID;
      98             :   MozPromiseHolder<FlyWebPublishPromise> mPublishPromise;
      99             : 
     100             :   nsString mName;
     101             :   nsString mUiUrl;
     102             : 
     103             :   bool mIsRegistered;
     104             : };
     105             : 
     106             : } // namespace dom
     107             : } // namespace mozilla
     108             : 
     109             : #endif // mozilla_dom_FlyWebPublishedServer_h

Generated by: LCOV version 1.13