toolkit/components/telemetry/core/ipc/TelemetryIPCAccumulator.h
author Ehsan Akhgari <ehsan@mozilla.com>
Thu, 29 Nov 2018 10:30:46 +0000
changeset 505141 04f0bbf40bf36957dc1f72a8aae9916df0e3222f
parent 500183 839d553dbafbbca096f5261d96fa1b8439846c27
child 505383 6f3709b3878117466168c40affa7bca0b60cf75b
permissions -rw-r--r--
Bug 1508472 - Part 5: Fifth batch of comment fix-ups in preparation for the tree reformat r=sylvestre This is a best effort attempt at ensuring that the adverse impact of reformatting the entire tree over the comments would be minimal. I've used a combination of strategies including disabling of formatting, some manual formatting and some changes to formatting to work around some clang-format limitations. Differential Revision: https://phabricator.services.mozilla.com/D13371

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef TelemetryIPCAccumulator_h__
#define TelemetryIPCAccumulator_h__

#include "mozilla/AlreadyAddRefed.h"
#include "mozilla/Maybe.h"
#include "nsStringFwd.h"
#include "TelemetryComms.h"

class nsIRunnable;
class nsITimer;

namespace mozilla {

class TimeStamp;

namespace TelemetryIPCAccumulator {

// Histogram accumulation functions.
void AccumulateChildHistogram(mozilla::Telemetry::HistogramID aId, uint32_t aSample);
void AccumulateChildKeyedHistogram(mozilla::Telemetry::HistogramID aId, const nsCString& aKey,
                                   uint32_t aSample);

// Scalar accumulation functions.
void RecordChildScalarAction(uint32_t aId, bool aDynamic,
                             mozilla::Telemetry::ScalarActionType aAction,
                             const mozilla::Telemetry::ScalarVariant& aValue);

void RecordChildKeyedScalarAction(uint32_t aId, bool aDynamic, const nsAString& aKey,
                                  mozilla::Telemetry::ScalarActionType aAction,
                                  const mozilla::Telemetry::ScalarVariant& aValue);

void RecordChildEvent(const mozilla::TimeStamp& timestamp,
                      const nsACString& category,
                      const nsACString& method,
                      const nsACString& object,
                      const mozilla::Maybe<nsCString>& value,
                      const nsTArray<mozilla::Telemetry::EventExtraEntry>& extra);

void IPCTimerFired(nsITimer* aTimer, void* aClosure);

void DeInitializeGlobalState();

void DispatchToMainThread(already_AddRefed<nsIRunnable>&& aEvent);

}
}

#endif // TelemetryIPCAccumulator_h__