LCOV - code coverage report
Current view: top level - dom/workers - SharedWorker.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 4 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_workers_sharedworker_h__
       8             : #define mozilla_dom_workers_sharedworker_h__
       9             : 
      10             : #include "Workers.h"
      11             : 
      12             : #include "mozilla/dom/BindingDeclarations.h"
      13             : #include "mozilla/DOMEventTargetHelper.h"
      14             : 
      15             : class nsIDOMEvent;
      16             : class nsPIDOMWindowInner;
      17             : 
      18             : namespace mozilla {
      19             : class EventChainPreVisitor;
      20             : 
      21             : namespace dom {
      22             : class MessagePort;
      23             : class StringOrWorkerOptions;
      24             : }
      25             : } // namespace mozilla
      26             : 
      27             : BEGIN_WORKERS_NAMESPACE
      28             : 
      29             : class RuntimeService;
      30             : class WorkerPrivate;
      31             : 
      32             : class SharedWorker final : public DOMEventTargetHelper
      33             : {
      34             :   friend class RuntimeService;
      35             : 
      36             :   typedef mozilla::ErrorResult ErrorResult;
      37             :   typedef mozilla::dom::GlobalObject GlobalObject;
      38             : 
      39             :   RefPtr<WorkerPrivate> mWorkerPrivate;
      40             :   RefPtr<MessagePort> mMessagePort;
      41             :   nsTArray<nsCOMPtr<nsIDOMEvent>> mFrozenEvents;
      42             :   bool mFrozen;
      43             : 
      44             : public:
      45             :   static already_AddRefed<SharedWorker>
      46             :   Constructor(const GlobalObject& aGlobal, const nsAString& aScriptURL,
      47             :               const StringOrWorkerOptions& aOptions, ErrorResult& aRv);
      48             : 
      49             :   MessagePort*
      50             :   Port();
      51             : 
      52             :   bool
      53           0 :   IsFrozen() const
      54             :   {
      55           0 :     return mFrozen;
      56             :   }
      57             : 
      58             :   void
      59             :   Freeze();
      60             : 
      61             :   void
      62             :   Thaw();
      63             : 
      64             :   void
      65             :   QueueEvent(nsIDOMEvent* aEvent);
      66             : 
      67             :   void
      68             :   Close();
      69             : 
      70             :   NS_DECL_ISUPPORTS_INHERITED
      71           0 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SharedWorker, DOMEventTargetHelper)
      72             : 
      73           0 :   IMPL_EVENT_HANDLER(error)
      74             : 
      75             :   virtual JSObject*
      76             :   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
      77             : 
      78             :   virtual nsresult
      79             :   GetEventTargetParent(EventChainPreVisitor& aVisitor) override;
      80             : 
      81             :   WorkerPrivate*
      82             :   GetWorkerPrivate() const
      83             :   {
      84             :     return mWorkerPrivate;
      85             :   }
      86             : 
      87             : private:
      88             :   // This class can only be created from the RuntimeService.
      89             :   SharedWorker(nsPIDOMWindowInner* aWindow,
      90             :                WorkerPrivate* aWorkerPrivate,
      91             :                MessagePort* aMessagePort);
      92             : 
      93             :   // This class is reference-counted and will be destroyed from Release().
      94             :   ~SharedWorker();
      95             : 
      96             :   // Only called by MessagePort.
      97             :   void
      98             :   PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
      99             :               const Sequence<JSObject*>& aTransferable, ErrorResult& aRv);
     100             : };
     101             : 
     102             : END_WORKERS_NAMESPACE
     103             : 
     104             : #endif // mozilla_dom_workers_sharedworker_h__

Generated by: LCOV version 1.13