Skip to content

Commit

Permalink
Bug 1852098 - Generate mapping from Use Counter to use counter metric…
Browse files Browse the repository at this point in the history
…s r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D193249
  • Loading branch information
chutten committed Nov 15, 2023
1 parent 4b8a595 commit 0ab1407
Show file tree
Hide file tree
Showing 5 changed files with 3,292 additions and 147 deletions.
31 changes: 31 additions & 0 deletions dom/base/UseCounterMetrics.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 UseCounterMetrics_h_
#define UseCounterMetrics_h_

namespace mozilla::dom {

enum WorkerKind : uint8_t;

/**
* Increments the metric associated with the specific use counter.
*
* @param aUseCounter - The use counter for the feature that was used.
* @param aIsPage - Whether we should record to the page or document metric.
*/
void IncrementUseCounter(UseCounter aUseCounter, bool aIsPage);

/**
* Increments the metric associated with the specific worker use counter.
*
* @param aUseCounter - The use counter for the feature that was used.
* @param aKind - The kind of worker that triggered the use counter.
*/
void IncrementWorkerUseCounter(UseCounterWorker aUseCounter, WorkerKind aKind);

} // namespace mozilla::dom

#endif // UseCounterMetrics_h_
15 changes: 15 additions & 0 deletions dom/base/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ EXPORTS.mozilla.dom += [
"TreeOrderedArrayInlines.h",
"TreeWalker.h",
"UIDirectionManager.h",
"UseCounterMetrics.h",
"UserActivation.h",
"ViewportMetaData.h",
"VisualViewport.h",
Expand All @@ -307,6 +308,7 @@ if CONFIG["COMPILE_ENVIRONMENT"]:
)

UNIFIED_SOURCES += [
"!UseCounterMetrics.cpp",
"AbstractRange.cpp",
"AnchorAreaFormRelValues.cpp",
"AnimationFrameProvider.cpp",
Expand Down Expand Up @@ -617,3 +619,16 @@ GeneratedFile(
entry_point="use_counter_list",
inputs=["UseCountersWorker.conf"],
)

GeneratedFile(
"UseCounterMetrics.cpp",
script="usecounters.py",
entry_point="metric_map",
inputs=[
"UseCounters.conf",
"UseCountersWorker.conf",
"nsDeprecatedOperationList.h",
"!/layout/style/ServoCSSPropList.py",
"/servo/components/style/properties/counted_unknown_properties.py",
],
)
Loading

0 comments on commit 0ab1407

Please sign in to comment.