LCOV - code coverage report
Current view: top level - xpcom/base - DebuggerOnGCRunnable.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 17 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 3 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 "mozilla/DebuggerOnGCRunnable.h"
       8             : 
       9             : #include "mozilla/dom/ScriptSettings.h"
      10             : #include "mozilla/CycleCollectedJSContext.h"
      11             : #include "mozilla/Move.h"
      12             : #include "mozilla/SystemGroup.h"
      13             : #include "js/Debug.h"
      14             : 
      15             : namespace mozilla {
      16             : 
      17             : /* static */ nsresult
      18           0 : DebuggerOnGCRunnable::Enqueue(JSContext* aCx, const JS::GCDescription& aDesc)
      19             : {
      20           0 :   auto gcEvent = aDesc.toGCEvent(aCx);
      21           0 :   if (!gcEvent) {
      22           0 :     return NS_ERROR_OUT_OF_MEMORY;
      23             :   }
      24             : 
      25             :   RefPtr<DebuggerOnGCRunnable> runOnGC =
      26           0 :     new DebuggerOnGCRunnable(Move(gcEvent));
      27           0 :   if (NS_IsMainThread()) {
      28           0 :     return SystemGroup::Dispatch("DebuggerOnGCRunnable", TaskCategory::GarbageCollection, runOnGC.forget());
      29             :   } else {
      30           0 :     return NS_DispatchToCurrentThread(runOnGC);
      31             :   }
      32             : }
      33             : 
      34             : NS_IMETHODIMP
      35           0 : DebuggerOnGCRunnable::Run()
      36             : {
      37           0 :   AutoJSAPI jsapi;
      38           0 :   jsapi.Init();
      39           0 :   if (!JS::dbg::FireOnGarbageCollectionHook(jsapi.cx(), Move(mGCData))) {
      40           0 :     return NS_ERROR_OUT_OF_MEMORY;
      41             :   }
      42           0 :   return NS_OK;
      43             : }
      44             : 
      45             : nsresult
      46           0 : DebuggerOnGCRunnable::Cancel()
      47             : {
      48           0 :   mGCData = nullptr;
      49           0 :   return NS_OK;
      50             : }
      51             : 
      52             : } // namespace mozilla

Generated by: LCOV version 1.13