LCOV - code coverage report
Current view: top level - dom/performance - PerformanceObserverEntryList.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 42 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 12 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             : #include "PerformanceObserverEntryList.h"
       8             : 
       9             : #include "mozilla/dom/Performance.h"
      10             : #include "mozilla/dom/PerformanceObserverEntryListBinding.h"
      11             : #include "nsString.h"
      12             : #include "PerformanceResourceTiming.h"
      13             : 
      14             : using namespace mozilla;
      15             : using namespace mozilla::dom;
      16             : 
      17           0 : NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(PerformanceObserverEntryList,
      18             :                                       mOwner,
      19             :                                       mEntries)
      20             : 
      21           0 : NS_IMPL_CYCLE_COLLECTING_ADDREF(PerformanceObserverEntryList)
      22           0 : NS_IMPL_CYCLE_COLLECTING_RELEASE(PerformanceObserverEntryList)
      23             : 
      24           0 : NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PerformanceObserverEntryList)
      25           0 :   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
      26           0 :   NS_INTERFACE_MAP_ENTRY(nsISupports)
      27           0 : NS_INTERFACE_MAP_END
      28             : 
      29           0 : PerformanceObserverEntryList::~PerformanceObserverEntryList()
      30             : {
      31           0 : }
      32             : 
      33             : JSObject*
      34           0 : PerformanceObserverEntryList::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
      35             : {
      36           0 :   return PerformanceObserverEntryListBinding::Wrap(aCx, this, aGivenProto);
      37             : }
      38             : 
      39             : void
      40           0 : PerformanceObserverEntryList::GetEntries(
      41             :   const PerformanceEntryFilterOptions& aFilter,
      42             :   nsTArray<RefPtr<PerformanceEntry>>& aRetval)
      43             : {
      44           0 :   aRetval.Clear();
      45           0 :   for (const RefPtr<PerformanceEntry>& entry : mEntries) {
      46           0 :     if (aFilter.mInitiatorType.WasPassed()) {
      47             :       const PerformanceResourceTiming* resourceEntry =
      48           0 :         entry->ToResourceTiming();
      49           0 :       if (!resourceEntry) {
      50           0 :         continue;
      51             :       }
      52           0 :       nsAutoString initiatorType;
      53           0 :       resourceEntry->GetInitiatorType(initiatorType);
      54           0 :       if (!initiatorType.Equals(aFilter.mInitiatorType.Value())) {
      55           0 :         continue;
      56             :       }
      57             :     }
      58           0 :     if (aFilter.mName.WasPassed() &&
      59           0 :         !entry->GetName().Equals(aFilter.mName.Value())) {
      60           0 :       continue;
      61             :     }
      62           0 :     if (aFilter.mEntryType.WasPassed() &&
      63           0 :         !entry->GetEntryType().Equals(aFilter.mEntryType.Value())) {
      64           0 :       continue;
      65             :     }
      66             : 
      67           0 :     aRetval.AppendElement(entry);
      68             :   }
      69           0 : }
      70             : 
      71             : void
      72           0 : PerformanceObserverEntryList::GetEntriesByType(
      73             :   const nsAString& aEntryType,
      74             :   nsTArray<RefPtr<PerformanceEntry>>& aRetval)
      75             : {
      76           0 :   aRetval.Clear();
      77           0 :   for (const RefPtr<PerformanceEntry>& entry : mEntries) {
      78           0 :     if (entry->GetEntryType().Equals(aEntryType)) {
      79           0 :       aRetval.AppendElement(entry);
      80             :     }
      81             :   }
      82           0 : }
      83             : 
      84             : void
      85           0 : PerformanceObserverEntryList::GetEntriesByName(
      86             :   const nsAString& aName,
      87             :   const Optional<nsAString>& aEntryType,
      88             :   nsTArray<RefPtr<PerformanceEntry>>& aRetval)
      89             : {
      90           0 :   aRetval.Clear();
      91           0 :   for (const RefPtr<PerformanceEntry>& entry : mEntries) {
      92           0 :     if (entry->GetName().Equals(aName)) {
      93           0 :       aRetval.AppendElement(entry);
      94             :     }
      95             :   }
      96           0 : }

Generated by: LCOV version 1.13