LCOV - code coverage report
Current view: top level - docshell/base/timeline - AutoRestyleTimelineMarker.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 15 25 60.0 %
Date: 2017-07-14 16:53:18 Functions: 2 2 100.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 "AutoRestyleTimelineMarker.h"
       8             : 
       9             : #include "TimelineConsumers.h"
      10             : #include "MainThreadUtils.h"
      11             : #include "RestyleTimelineMarker.h"
      12             : 
      13             : namespace mozilla {
      14             : 
      15         120 : AutoRestyleTimelineMarker::AutoRestyleTimelineMarker(
      16             :     nsIDocShell* aDocShell,
      17             :     bool aIsAnimationOnly
      18         120 :     MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
      19             :   : mDocShell(nullptr)
      20         120 :   , mIsAnimationOnly(aIsAnimationOnly)
      21             : {
      22         120 :   MOZ_GUARD_OBJECT_NOTIFIER_INIT;
      23         120 :   MOZ_ASSERT(NS_IsMainThread());
      24             : 
      25         120 :   if (!aDocShell) {
      26         125 :     return;
      27             :   }
      28             : 
      29         115 :   RefPtr<TimelineConsumers> timelines = TimelineConsumers::Get();
      30         115 :   if (!timelines || !timelines->HasConsumer(aDocShell)) {
      31         115 :     return;
      32             :   }
      33             : 
      34           0 :   mDocShell = aDocShell;
      35           0 :   timelines->AddMarkerForDocShell(mDocShell, Move(
      36           0 :     MakeUnique<RestyleTimelineMarker>(
      37             :       mIsAnimationOnly,
      38           0 :       MarkerTracingType::START)));
      39             : }
      40             : 
      41         240 : AutoRestyleTimelineMarker::~AutoRestyleTimelineMarker()
      42             : {
      43         120 :   MOZ_ASSERT(NS_IsMainThread());
      44             : 
      45         120 :   if (!mDocShell) {
      46         240 :     return;
      47             :   }
      48             : 
      49           0 :   RefPtr<TimelineConsumers> timelines = TimelineConsumers::Get();
      50           0 :   if (!timelines || !timelines->HasConsumer(mDocShell)) {
      51           0 :     return;
      52             :   }
      53             : 
      54           0 :   timelines->AddMarkerForDocShell(mDocShell, Move(
      55           0 :     MakeUnique<RestyleTimelineMarker>(
      56             :       mIsAnimationOnly,
      57           0 :       MarkerTracingType::END)));
      58         120 : }
      59             : 
      60             : } // namespace mozilla

Generated by: LCOV version 1.13