1 /* -*- Mode: C++; tab-width: 20; 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
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 
6 #include "nsProfilerStartParams.h"
7 #include "ipc/IPCMessageUtils.h"
8 
NS_IMPL_ISUPPORTS(nsProfilerStartParams,nsIProfilerStartParams)9 NS_IMPL_ISUPPORTS(nsProfilerStartParams, nsIProfilerStartParams)
10 
11 nsProfilerStartParams::nsProfilerStartParams(
12     uint32_t aEntries, const mozilla::Maybe<double>& aDuration,
13     double aInterval, uint32_t aFeatures, nsTArray<nsCString>&& aFilters,
14     uint64_t aActiveTabID)
15     : mEntries(aEntries),
16       mDuration(aDuration),
17       mInterval(aInterval),
18       mFeatures(aFeatures),
19       mFilters(std::move(aFilters)),
20       mActiveTabID(aActiveTabID) {}
21 
~nsProfilerStartParams()22 nsProfilerStartParams::~nsProfilerStartParams() {}
23 
24 NS_IMETHODIMP
GetEntries(uint32_t * aEntries)25 nsProfilerStartParams::GetEntries(uint32_t* aEntries) {
26   NS_ENSURE_ARG_POINTER(aEntries);
27   *aEntries = mEntries;
28   return NS_OK;
29 }
30 
31 NS_IMETHODIMP
GetDuration(double * aDuration)32 nsProfilerStartParams::GetDuration(double* aDuration) {
33   NS_ENSURE_ARG_POINTER(aDuration);
34   if (mDuration) {
35     *aDuration = *mDuration;
36   } else {
37     *aDuration = 0;
38   }
39   return NS_OK;
40 }
41 
42 NS_IMETHODIMP
GetInterval(double * aInterval)43 nsProfilerStartParams::GetInterval(double* aInterval) {
44   NS_ENSURE_ARG_POINTER(aInterval);
45   *aInterval = mInterval;
46   return NS_OK;
47 }
48 
49 NS_IMETHODIMP
GetFeatures(uint32_t * aFeatures)50 nsProfilerStartParams::GetFeatures(uint32_t* aFeatures) {
51   NS_ENSURE_ARG_POINTER(aFeatures);
52   *aFeatures = mFeatures;
53   return NS_OK;
54 }
55 
GetFilters()56 const nsTArray<nsCString>& nsProfilerStartParams::GetFilters() {
57   return mFilters;
58 }
59 
60 NS_IMETHODIMP
GetActiveTabID(uint64_t * aActiveTabID)61 nsProfilerStartParams::GetActiveTabID(uint64_t* aActiveTabID) {
62   NS_ENSURE_ARG_POINTER(aActiveTabID);
63   *aActiveTabID = mActiveTabID;
64   return NS_OK;
65 }
66