LCOV - code coverage report
Current view: top level - dom/workers - WorkerNavigator.h (source / functions) Hit Total Coverage
Test: output.info Lines: 1 25 4.0 %
Date: 2017-07-14 16:53:18 Functions: 1 14 7.1 %
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_workernavigator_h__
       8             : #define mozilla_dom_workernavigator_h__
       9             : 
      10             : #include "Workers.h"
      11             : #include "RuntimeService.h"
      12             : #include "nsString.h"
      13             : #include "nsWrapperCache.h"
      14             : #include "mozilla/dom/BindingDeclarations.h"
      15             : #include "mozilla/dom/StorageManager.h"
      16             : 
      17             : namespace mozilla {
      18             : namespace dom {
      19             : class Promise;
      20             : class StorageManager;
      21             : 
      22             : namespace network {
      23             : class Connection;
      24             : } // namespace network
      25             : 
      26             : class WorkerNavigator final : public nsWrapperCache
      27             : {
      28             :   typedef struct workers::RuntimeService::NavigatorProperties NavigatorProperties;
      29             : 
      30             :   NavigatorProperties mProperties;
      31             :   RefPtr<StorageManager> mStorageManager;
      32             :   RefPtr<network::Connection> mConnection;
      33             :   bool mOnline;
      34             : 
      35             :   WorkerNavigator(const NavigatorProperties& aProperties, bool aOnline);
      36             :   ~WorkerNavigator();
      37             : 
      38             : public:
      39             : 
      40           0 :   NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WorkerNavigator)
      41           1 :   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WorkerNavigator)
      42             : 
      43             :   static already_AddRefed<WorkerNavigator>
      44             :   Create(bool aOnLine);
      45             : 
      46             :   virtual JSObject*
      47             :   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
      48             : 
      49           0 :   nsISupports* GetParentObject() const {
      50           0 :     return nullptr;
      51             :   }
      52             : 
      53           0 :   void GetAppCodeName(nsString& aAppCodeName) const
      54             :   {
      55           0 :     aAppCodeName.AssignLiteral("Mozilla");
      56           0 :   }
      57             :   void GetAppName(nsString& aAppName, CallerType aCallerType) const;
      58             : 
      59             :   void GetAppVersion(nsString& aAppVersion, CallerType aCallerType,
      60             :                      ErrorResult& aRv) const;
      61             : 
      62             :   void GetPlatform(nsString& aPlatform, CallerType aCallerType,
      63             :                    ErrorResult& aRv) const;
      64             : 
      65           0 :   void GetProduct(nsString& aProduct) const
      66             :   {
      67           0 :     aProduct.AssignLiteral("Gecko");
      68           0 :   }
      69             : 
      70           0 :   bool TaintEnabled() const
      71             :   {
      72           0 :     return false;
      73             :   }
      74             : 
      75           0 :   void GetLanguage(nsString& aLanguage) const
      76             :   {
      77           0 :     if (mProperties.mLanguages.Length() >= 1) {
      78           0 :       aLanguage.Assign(mProperties.mLanguages[0]);
      79             :     } else {
      80           0 :       aLanguage.Truncate();
      81             :     }
      82           0 :   }
      83             : 
      84           0 :   void GetLanguages(nsTArray<nsString>& aLanguages) const
      85             :   {
      86           0 :     aLanguages = mProperties.mLanguages;
      87           0 :   }
      88             : 
      89             :   void GetUserAgent(nsString& aUserAgent, CallerType aCallerType,
      90             :                     ErrorResult& aRv) const;
      91             : 
      92           0 :   bool OnLine() const
      93             :   {
      94           0 :     return mOnline;
      95             :   }
      96             : 
      97             :   // Worker thread only!
      98           0 :   void SetOnLine(bool aOnline)
      99             :   {
     100           0 :     mOnline = aOnline;
     101           0 :   }
     102             : 
     103             :   void SetLanguages(const nsTArray<nsString>& aLanguages);
     104             : 
     105             :   uint64_t HardwareConcurrency() const;
     106             : 
     107             :   StorageManager* Storage();
     108             : 
     109             :   network::Connection* GetConnection(ErrorResult& aRv);
     110             : };
     111             : 
     112             : } // namespace dom
     113             : } // namespace mozilla
     114             : 
     115             : #endif // mozilla_dom_workernavigator_h__

Generated by: LCOV version 1.13