Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 : * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #include "nsCodeCoverage.h"
7 : #include "mozilla/CodeCoverageHandler.h"
8 : #include "mozilla/Unused.h"
9 : #include "mozilla/dom/ContentParent.h"
10 :
11 : using namespace mozilla;
12 : using namespace mozilla::dom;
13 :
14 18 : NS_IMPL_ISUPPORTS(nsCodeCoverage,
15 : nsICodeCoverage)
16 :
17 1 : nsCodeCoverage::nsCodeCoverage()
18 : {
19 1 : }
20 :
21 0 : nsCodeCoverage::~nsCodeCoverage()
22 : {
23 0 : }
24 :
25 1 : NS_IMETHODIMP nsCodeCoverage::DumpCounters()
26 : {
27 1 : MOZ_ASSERT(XRE_IsParentProcess());
28 1 : MOZ_ASSERT(NS_IsMainThread());
29 :
30 1 : CodeCoverageHandler::DumpCounters(0);
31 0 : for (auto* cp : ContentParent::AllProcesses(ContentParent::eLive)) {
32 0 : Unused << cp->SendDumpCodeCoverageCounters();
33 : }
34 :
35 0 : return NS_OK;
36 : }
37 :
38 0 : NS_IMETHODIMP nsCodeCoverage::ResetCounters()
39 : {
40 0 : MOZ_ASSERT(XRE_IsParentProcess());
41 0 : MOZ_ASSERT(NS_IsMainThread());
42 :
43 0 : CodeCoverageHandler::ResetCounters(0);
44 0 : for (auto* cp : ContentParent::AllProcesses(ContentParent::eLive)) {
45 0 : Unused << cp->SendResetCodeCoverageCounters();
46 : }
47 :
48 0 : return NS_OK;
49 : }
|