LCOV - code coverage report
Current view: top level - dom/flyweb - FlyWebService.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 3 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 3 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_FlyWebService_h
       8             : #define mozilla_dom_FlyWebService_h
       9             : 
      10             : #include "nsISupportsImpl.h"
      11             : #include "mozilla/ErrorResult.h"
      12             : #include "nsIProtocolHandler.h"
      13             : #include "nsDataHashtable.h"
      14             : #include "nsClassHashtable.h"
      15             : #include "nsIObserver.h"
      16             : #include "mozilla/MozPromise.h"
      17             : #include "mozilla/ReentrantMonitor.h"
      18             : #include "mozilla/dom/FlyWebDiscoveryManagerBinding.h"
      19             : #include "nsITimer.h"
      20             : #include "nsICancelable.h"
      21             : #include "nsIDNSServiceDiscovery.h"
      22             : 
      23             : class nsPIDOMWindowInner;
      24             : class nsIProxyInfo;
      25             : class nsISocketTransport;
      26             : 
      27             : namespace mozilla {
      28             : namespace dom {
      29             : 
      30             : struct FlyWebPublishOptions;
      31             : struct FlyWebFilter;
      32             : class FlyWebPublishedServer;
      33             : class FlyWebPublishedServerImpl;
      34             : class FlyWebPairingCallback;
      35             : class FlyWebDiscoveryManager;
      36             : class FlyWebMDNSService;
      37             : 
      38             : typedef MozPromise<RefPtr<FlyWebPublishedServer>, nsresult, false>
      39             :   FlyWebPublishPromise;
      40             : 
      41             : class FlyWebService final : public nsIObserver
      42             : {
      43             :   friend class FlyWebMDNSService;
      44             : public:
      45             :   NS_DECL_THREADSAFE_ISUPPORTS
      46             :   NS_DECL_NSIOBSERVER
      47             : 
      48             :   static FlyWebService* GetExisting();
      49             :   static FlyWebService* GetOrCreate();
      50           0 :   static already_AddRefed<FlyWebService> GetOrCreateAddRefed()
      51             :   {
      52           0 :     return do_AddRef(GetOrCreate());
      53             :   }
      54             : 
      55             :   already_AddRefed<FlyWebPublishPromise>
      56             :     PublishServer(const nsAString& aName,
      57             :                   const FlyWebPublishOptions& aOptions,
      58             :                   nsPIDOMWindowInner* aWindow);
      59             : 
      60             :   void UnregisterServer(FlyWebPublishedServer* aServer);
      61             : 
      62             :   bool HasConnectionOrServer(uint64_t aWindowID);
      63             : 
      64             :   void ListDiscoveredServices(nsTArray<FlyWebDiscoveredService>& aServices);
      65             :   void PairWithService(const nsAString& aServiceId, FlyWebPairingCallback& aCallback);
      66             :   nsresult CreateTransportForHost(const char **types,
      67             :                                   uint32_t typeCount,
      68             :                                   const nsACString &host,
      69             :                                   int32_t port,
      70             :                                   const nsACString &hostRoute,
      71             :                                   int32_t portRoute,
      72             :                                   nsIProxyInfo *proxyInfo,
      73             :                                   nsISocketTransport **result);
      74             : 
      75             :   already_AddRefed<FlyWebPublishedServer> FindPublishedServerByName(
      76             :             const nsAString& aName);
      77             : 
      78             :   void RegisterDiscoveryManager(FlyWebDiscoveryManager* aDiscoveryManager);
      79             :   void UnregisterDiscoveryManager(FlyWebDiscoveryManager* aDiscoveryManager);
      80             : 
      81             :   // Should only be called by FlyWebPublishedServerImpl
      82             :   void StartDiscoveryOf(FlyWebPublishedServerImpl* aServer);
      83             : 
      84             : private:
      85             :   FlyWebService();
      86             :   ~FlyWebService();
      87             : 
      88             :   ErrorResult Init();
      89             : 
      90             :   void NotifyDiscoveredServicesChanged();
      91             : 
      92             :   // Might want to make these hashes for perf
      93             :   nsTArray<FlyWebPublishedServer*> mServers;
      94             : 
      95             :   RefPtr<FlyWebMDNSService> mMDNSHttpService;
      96             :   RefPtr<FlyWebMDNSService> mMDNSFlywebService;
      97             : 
      98           0 :   struct PairedInfo
      99             :   {
     100             :     FlyWebPairedService mService;
     101             :     nsCOMPtr<nsIDNSServiceInfo> mDNSServiceInfo;
     102             :   };
     103             :   nsClassHashtable<nsCStringHashKey, PairedInfo>
     104             :     mPairedServiceTable;
     105             :   ReentrantMonitor mMonitor; // Protecting mPairedServiceTable
     106             : 
     107             :   nsTHashtable<nsPtrHashKey<FlyWebDiscoveryManager>> mDiscoveryManagerTable;
     108             : };
     109             : 
     110             : } // namespace dom
     111             : } // namespace mozilla
     112             : 
     113             : #endif // mozilla_dom_FlyWebService_h

Generated by: LCOV version 1.13