LCOV - code coverage report
Current view: top level - dom/workers - ServiceWorkerClient.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 21 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 16 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 file,
       5             :  * You can obtain one at http://mozilla.org/MPL/2.0/.
       6             :  */
       7             : 
       8             : #ifndef mozilla_dom_workers_serviceworkerclient_h
       9             : #define mozilla_dom_workers_serviceworkerclient_h
      10             : 
      11             : #include "nsCOMPtr.h"
      12             : #include "nsWrapperCache.h"
      13             : #include "mozilla/ErrorResult.h"
      14             : #include "mozilla/dom/BindingDeclarations.h"
      15             : #include "mozilla/dom/ClientBinding.h"
      16             : 
      17             : class nsIDocument;
      18             : 
      19             : namespace mozilla {
      20             : namespace dom {
      21             : namespace workers {
      22             : 
      23             : class ServiceWorkerClient;
      24             : class ServiceWorkerWindowClient;
      25             : 
      26             : // Used as a container object for information needed to create
      27             : // client objects.
      28           0 : class ServiceWorkerClientInfo final
      29             : {
      30             :   friend class ServiceWorkerClient;
      31             :   friend class ServiceWorkerWindowClient;
      32             : 
      33             : public:
      34             :   explicit ServiceWorkerClientInfo(nsIDocument* aDoc, uint32_t aOrdinal = 0);
      35             : 
      36             :   const nsString& ClientId() const
      37             :   {
      38             :     return mClientId;
      39             :   }
      40             : 
      41             :   bool operator<(const ServiceWorkerClientInfo& aRight) const;
      42             :   bool operator==(const ServiceWorkerClientInfo& aRight) const;
      43             : 
      44             : private:
      45             :   const mozilla::dom::ClientType mType;
      46             :   const uint32_t mOrdinal;
      47             :   nsString mClientId;
      48             :   uint64_t mWindowId;
      49             :   nsString mUrl;
      50             : 
      51             :   // Window Clients
      52             :   VisibilityState mVisibilityState;
      53             :   FrameType mFrameType;
      54             :   TimeStamp mLastFocusTime;
      55             :   bool mFocused;
      56             : };
      57             : 
      58             : class ServiceWorkerClient : public nsISupports,
      59             :                             public nsWrapperCache
      60             : {
      61             : public:
      62             :   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
      63           0 :   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ServiceWorkerClient)
      64             : 
      65           0 :   ServiceWorkerClient(nsISupports* aOwner,
      66             :                       const ServiceWorkerClientInfo& aClientInfo)
      67           0 :     : mOwner(aOwner)
      68           0 :     , mType(aClientInfo.mType)
      69             :     , mId(aClientInfo.mClientId)
      70             :     , mUrl(aClientInfo.mUrl)
      71           0 :     , mWindowId(aClientInfo.mWindowId)
      72           0 :     , mFrameType(aClientInfo.mFrameType)
      73             :   {
      74           0 :     MOZ_ASSERT(aOwner);
      75           0 :   }
      76             : 
      77             :   nsISupports*
      78           0 :   GetParentObject() const
      79             :   {
      80           0 :     return mOwner;
      81             :   }
      82             : 
      83           0 :   void GetId(nsString& aRetval) const
      84             :   {
      85           0 :     aRetval = mId;
      86           0 :   }
      87             : 
      88             :   void
      89           0 :   GetUrl(nsAString& aUrl) const
      90             :   {
      91           0 :     aUrl.Assign(mUrl);
      92           0 :   }
      93             : 
      94             :   mozilla::dom::FrameType
      95           0 :   FrameType() const
      96             :   {
      97           0 :     return mFrameType;
      98             :   }
      99             : 
     100             :   mozilla::dom::ClientType
     101             :   Type() const;
     102             : 
     103             :   void
     104             :   PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
     105             :               const Sequence<JSObject*>& aTransferable, ErrorResult& aRv);
     106             : 
     107             :   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
     108             : 
     109             : protected:
     110           0 :   virtual ~ServiceWorkerClient()
     111           0 :   { }
     112             : 
     113             : private:
     114             :   nsCOMPtr<nsISupports> mOwner;
     115             :   const ClientType mType;
     116             :   nsString mId;
     117             :   nsString mUrl;
     118             : 
     119             : protected:
     120             :   uint64_t mWindowId;
     121             :   mozilla::dom::FrameType mFrameType;
     122             : };
     123             : 
     124             : } // namespace workers
     125             : } // namespace dom
     126             : } // namespace mozilla
     127             : 
     128             : #endif // mozilla_dom_workers_serviceworkerclient_h

Generated by: LCOV version 1.13