LCOV - code coverage report
Current view: top level - js/ipc - CPOWTimer.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 17 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
       2             :  * vim: set ts=4 sw=4 et tw=80:
       3             :  *
       4             :  * This Source Code Form is subject to the terms of the Mozilla Public
       5             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       6             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       7             : 
       8             : #include "jsfriendapi.h"
       9             : #include "nsContentUtils.h"
      10             : #include "CPOWTimer.h"
      11             : 
      12             : #include "jsapi.h"
      13             : 
      14           0 : CPOWTimer::CPOWTimer(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
      15             :     : cx_(nullptr)
      16           0 :     , startInterval_(0)
      17             : {
      18           0 :     MOZ_GUARD_OBJECT_NOTIFIER_INIT;
      19           0 :     if (!js::GetStopwatchIsMonitoringCPOW(cx))
      20           0 :         return;
      21           0 :     cx_ = cx;
      22           0 :     startInterval_ = JS_Now();
      23             : }
      24           0 : CPOWTimer::~CPOWTimer()
      25             : {
      26           0 :     if (!cx_) {
      27             :         // Monitoring was off when we started the timer.
      28           0 :         return;
      29             :     }
      30             : 
      31           0 :     if (!js::GetStopwatchIsMonitoringCPOW(cx_)) {
      32             :         // Monitoring has been deactivated while we were in the timer.
      33           0 :         return;
      34             :     }
      35             : 
      36           0 :     const int64_t endInterval = JS_Now();
      37           0 :     if (endInterval <= startInterval_) {
      38             :         // Do not assume monotonicity.
      39           0 :         return;
      40             :     }
      41             : 
      42           0 :     js::AddCPOWPerformanceDelta(cx_, endInterval - startInterval_);
      43           0 : }

Generated by: LCOV version 1.13