Граф коммитов

1905 Коммитов

Автор SHA1 Сообщение Дата
Toshihito Kikuchi 09dbd09134 Bug 1468250 - Block all versions of database.dll to stop the crash. r=aklotz
We blocked the older versions of database.dll as Bug 1566109 in 2019,
but the same crash is still happening with the newer versions.
We decided to block all versions because crashing in the middle of printing
or file uploading is not acceptable.

Differential Revision: https://phabricator.services.mozilla.com/D92988
2020-10-09 20:39:58 +00:00
Gerald Squelart db3689ee3d Bug 1670046 - If NoPayload marker has a stack and/or inner window id, convert to NoPayloadUserData - r=gregtatum
It is possible to add options to a NoPayload marker, but stack and inner window ids would be lost because they are normally stored in the payload 'data' JSON object, which doesn't exist for NoPayload markers.
So in this case, we automatically change the marker to a new (internal) "NoPayloadUserData" type, which has a payload in which we can store options.

This is temporary, until bug 1646714 moves these options into the top-level marker JSON object.

Differential Revision: https://phabricator.services.mozilla.com/D93059
2020-10-09 13:00:48 +00:00
Toshihito Kikuchi 481aa7905b Bug 1588245 - More values to DetourResultCode. r=mhowell
This is the third attempt to investigate the launcher failure of our detour.
The previous commits d8315e4ed18d and 1b81ea85c43d added the assembly bytes
of a detour target and a special error code `DetourResultCode` to the launcher
failure ping.

In the latest telemetry data, however, the most common value of `hresult`
is still `ERROR_UNIDENTIFIED_ERROR`, meaning the previous commit missed to
set an error code in the common fallible codepath we wanted to know.
Besides `ERROR_UNIDENTIFIED_ERROR`, we're seeing `DETOUR_PATCHER_DO_RESERVE_ERROR`
in the telemetry, but having that code is not enough to pinpoint a falling
operation.

For further investigation, this patch adds ten more values to `DetourResultCode`.
`FUNCHOOKCROSSPROCESS_COPYSTUB_ERROR` is the last codepath we forgot to cover
in the previous commit.  The values of `MMPOLICY_RESERVE_*` are to investigate
`DETOUR_PATCHER_DO_RESERVE_ERROR` in the MMPolicy level.  In both cases, we add
the last Windows error code to `DetourError::mOrigBytes`.

Differential Revision: https://phabricator.services.mozilla.com/D92974
2020-10-08 19:00:22 +00:00
David Parks c6ffb4b0a9 Bug 1668057: Allow DLL interceptor to patch 64-bit immediate MOVs r=tkikuchi
The latest Windows Insider Preview (version 20226.1000) changes the machine code for BaseThreadInitThunk to have a preamble like the following:

00007FFDBF244C40 48 83 EC 28          sub         rsp,28h
00007FFDBF244C44 85 C9                test        ecx,ecx
00007FFDBF244C46 75 25                jne         00007FFDBF244C6D
00007FFDBF244C48 49 BA 70 A2 DC 12 6A 97 99 B0 mov         r10,0B099976A12DCA270h

This patch adds "MOV r64, imm64" capability to the DLL interceptor so that we can hook this.

Differential Revision: https://phabricator.services.mozilla.com/D92146
2020-10-05 22:25:44 +00:00
Florian Quèze 01d197240a Bug 1524625 - DLL loads during early startup should show profiler markers, r=gerald.
Differential Revision: https://phabricator.services.mozilla.com/D92340
2020-10-05 13:47:27 +00:00
Alexis Beingessner ab37cbed76 Bug 1601980 - use MOZ_ATOMIC_BITFIELDS in imagelib to avoid races on flags. r=aosmond,decoder
Differential Revision: https://phabricator.services.mozilla.com/D91633
2020-10-01 13:22:49 +00:00
Gerald Squelart 79c0e0c0ef Bug 1667915 - Marker type is now given as a reified empty argument instead of a template argument - r=gregtatum
This makes it clearer where marker-type-specific payload arguments start, just after the marker type object.

Also improved the main API documentation.

Differential Revision: https://phabricator.services.mozilla.com/D91681
2020-10-01 11:02:54 +00:00
Gerald Squelart ee701f64d7 Bug 1667915 - Separate marker category from marker options - r=gregtatum
The `category.WithOptions(...)` syntax was a bit strange and difficult to explain.

Now the category and options are separate parameters. Default options can be specified with `MarkerOptions{}` or just `{}`.

As a special case, defaulted-NoPayload functions don't need `<>`, and defaulted-NoPayload functions and macros don't even need `{}` for default options, e.g.:
`profiler_add_marker("name", OTHER); PROFILER_MARKER_UNTYPED("name", OTHER);`

Differential Revision: https://phabricator.services.mozilla.com/D91680
2020-10-01 11:02:23 +00:00
Bogdan Tara ababae891b Backed out 2 changesets (bug 1667915) for platform related bustage CLOSED TREE
Backed out changeset e7a0788a1741 (bug 1667915)
Backed out changeset d34505b2d81b (bug 1667915)
2020-10-01 12:34:39 +03:00
Gerald Squelart 58ca6739aa Bug 1667915 - Marker type is now given as a reified empty argument instead of a template argument - r=gregtatum
This makes it clearer where marker-type-specific payload arguments start, just after the marker type object.

Also improved the main API documentation.

Differential Revision: https://phabricator.services.mozilla.com/D91681
2020-10-01 01:45:20 +00:00
Gerald Squelart e07ae06a1d Bug 1667915 - Separate marker category from marker options - r=gregtatum
The `category.WithOptions(...)` syntax was a bit strange and difficult to explain.

Now the category and options are separate parameters. Default options can be specified with `MarkerOptions{}` or just `{}`.

As a special case, defaulted-NoPayload functions don't need `<>`, and defaulted-NoPayload functions and macros don't even need `{}` for default options, e.g.:
`profiler_add_marker("name", OTHER); PROFILER_MARKER_UNTYPED("name", OTHER);`

Differential Revision: https://phabricator.services.mozilla.com/D91680
2020-10-01 01:44:47 +00:00
Toshihito Kikuchi 7034355c29 Bug 1588245 - Introduce an extra errorcode inside WindowsDllInterceptor. r=mhowell
The previous commit d8315e4ed18d introduced a new telemetry field
in the launcher process ping to collect the assembly pattern of
a target function on detour failure, but most of the crash instances
do not have a value in the field.  This means the failure happens
before or after `CreateTrampoline`.

To narrow down the root cause, this patch puts a fine-grained error value
in the "hresult" field instead of the hardcoded ERROR_UNIDENTIFIED_ERROR.

This patch also adds `IsPageAccessible` check before fetching data from
a different process because fetching data from an invalid address hits
`MOZ_RELEASE_ASSERT` in `EnsureLimit`, resulting in crash without sending
the launcher process failure.

Differential Revision: https://phabricator.services.mozilla.com/D91881
2020-09-30 20:09:22 +00:00
Florian Quèze 9c87b313a1 Bug 1668056 - Bailout profiler markers should be text markers. r=jandem,gerald
Differential Revision: https://phabricator.services.mozilla.com/D91775
2020-09-30 12:19:54 +00:00
Toshihito Kikuchi abfd030f16 Bug 1666571 - Part 2. Support CALL [disp32] for Avast. r=handyman
The last Avast Antivirus's hook function contains `CALL [disp32]` instruction.
Our detour needs to be able to handle that pattern.

Differential Revision: https://phabricator.services.mozilla.com/D91155
2020-09-25 23:18:02 +00:00
Toshihito Kikuchi 05e886ea80 Bug 1666571 - Part 1. Support more patterns of OpCode 0xFF. r=handyman
This patch optimizes our detour's code handling Opcode 0xFF, expanding
its coverage to INC and DEC reg64 as well as PUSH and CALL.
Testcases for these scenarios are of course included.

Differential Revision: https://phabricator.services.mozilla.com/D91154
2020-09-25 23:18:15 +00:00
Markus Stange f366fca45a Bug 1666617 - Allow creating MarkerInnerWindowId with a Maybe<uint64_t>. r=gerald
Depends on D91078

Differential Revision: https://phabricator.services.mozilla.com/D91079
2020-09-23 00:04:17 +00:00
Doug Thayer c0eae2f201 Bug 1665453 - Poll for native events in between prefetching early dlls r=agashlin
In the initial patches for bug 1656526, mhowell noticed that for startups which
take a very long time, if the user interacts with the skeleton UI window, the OS
will flag us as not responsive, which could be a poorer user experience than
seeing nothing. Since our UI is designed to look non-interactive anyway, we
assume that a better experience would be to simply squash the not responsive
response from the OS by trivially processing native events. It's not perfect in,
say, the event that startup is hung for some reason, but it's arguably preferable
to our old model of startup being hung, which was just nothing being displayed at
all.

Differential Revision: https://phabricator.services.mozilla.com/D91005
2020-09-24 23:51:42 +00:00
Doug Thayer 53dd0a0de2 Bug 1666030 - Fix floor missing on some builds r=dmajor
Depends on D91004

Differential Revision: https://phabricator.services.mozilla.com/D91284
2020-09-24 14:43:55 +00:00
Doug Thayer acd22d7041 Bug 1665453 - Rename EarlyBlankWindow to PreXULSkeletonUI r=agashlin
This is just a more correct name for what's going on.

Differential Revision: https://phabricator.services.mozilla.com/D91004
2020-09-24 14:25:56 +00:00
Gerald Squelart 6b05ae158e Bug 1666708 - Only store category pair in MarkerCategory - r=gregtatum
This saves 1 byte when serializing each marker (and removes all the code that was related to the 2nd byte).
Also it will be easier to use it in legacy code that only knows about the category pair.

Added unit tests for the whole of MarkerCategory.

Differential Revision: https://phabricator.services.mozilla.com/D91110
2020-09-24 03:23:28 +00:00
Alexis Beingessner 6d1f7fdce9 Bug 1656266 - Remove fixed TSAN supression. r=decoder
This supression was setup for Bug 1607712, but it was the same underlying issue as this bug.

Depends on D91036

Differential Revision: https://phabricator.services.mozilla.com/D91037
2020-09-22 18:45:36 +00:00
Alexis Beingessner 5ea0bbd246 Bug 1652300 - Remove supression for fixed issue. r=decoder
Differential Revision: https://phabricator.services.mozilla.com/D90770
2020-09-22 12:51:27 +00:00
Alexis Beingessner 43cd5538c7 Bug 1607426 - Remove supression for fixed issue. r=decoder
Differential Revision: https://phabricator.services.mozilla.com/D90775
2020-09-22 12:51:40 +00:00
Alexis Beingessner fedd8a3482 Bug 1606860 - Remove supression for fixed issue. r=decoder
Differential Revision: https://phabricator.services.mozilla.com/D90777
2020-09-19 08:13:49 +00:00
Jon Coppeard 6bb01d4a27 Bug 1665338 - Make GC cell header word atomic to avoid race in compacting GC r=sfink,decoder
Differential Revision: https://phabricator.services.mozilla.com/D90389
2020-09-22 12:49:40 +00:00
Doug Thayer d61ea08ebb Bug 1665459 - Control pre-xul skele UI registry value via prefs r=mhowell
This patch uses the prefs relevant to the pre-xul skeleton UI to control the
registry value. There are three prefs:

- A new pref intended to be the global toggle once all themes can be handled.
- browser.startup.blankWindow - we currently depend on the code in BrowserGlue.jsm,
  gated on this pref, which immediately specifies the width and height of the
  window and ultimately causes XUL to consume and take ownership of our pre-xul
  window. Without this, we resize to fit a small content area, and then resize
  again back to the correct size.
- extensions.activeThemeID - Given that we have hardcoded layout and colors, we
  need to ensure that we're only presenting the skeleton UI for the default theme.

We're hoping to not need to gate on any prefs other than the new pref that we're
adding, but this allows us to provide a simple direction for users who may want
to dogfood our changes in the mean time: use the default theme, ensure the
browser.startup.blankWindow pref is set, and turn our new pref on.

Differential Revision: https://phabricator.services.mozilla.com/D90884
2020-09-21 19:24:56 +00:00
Alexis Beingessner d99fd95ed5 Bug 1612054 - Remove supression for fixed issue. r=decoder
Differential Revision: https://phabricator.services.mozilla.com/D90759
2020-09-18 22:52:16 +00:00
Toshihito Kikuchi 7ff1c84dc1 Bug 1665734 - Fix -Wunused-lambda-capture warnings in non-Nightly build. r=mhowell
This patch bypasses `-Wunused-lambda-capture` warnings by using `Unused` as
Bug 1375386 did.  Having two definitions with `#ifdef` confuses clang-format.
Using `Unused` seems like the easiest approach.

Differential Revision: https://phabricator.services.mozilla.com/D90610
2020-09-18 16:47:41 +00:00
Toshihito Kikuchi 4c58dba463 Bug 1588245 - Collect the assembly pattern of a target function on detour failure. r=mhowell
Many instances of the launcher failure ping indicate hooking NtMapViewOfSection
or LdrLoadDll failed.  This is most likely caused by a third-party application
applying a hook onto the same target earlier than we do.

This patch is to add a new field "detour_orig_bytes" in the laucnher failure ping
to collect the first sixteen bytes of a detour target function.  With this,
we can know whether those detour failures were caused by a third-party hook or not,
and if yes, what was the actual binary pattern.

Differential Revision: https://phabricator.services.mozilla.com/D89836
2020-09-17 01:42:26 +00:00
Doug Thayer 37cb06da7e Bug 1665357 - Ensure DPI_AWARENESS_CONTEXT is defined r=mhowell
This is currently failing the tier 2 MinGW-Clang builds, complaining
that DPI_AWARENESS_CONTEXT is not defined. Accordingly I pulled out the
logic from WinUtils.h which ensures it is defined into a shared header.

Differential Revision: https://phabricator.services.mozilla.com/D90467
2020-09-16 20:14:40 +00:00
Dorel Luca aadcb9bfbc Backed out changeset d5725a81ffd7 (bug 1588245) for Windows build bustages. CLOSED TREE 2020-09-17 00:56:25 +03:00
Toshihito Kikuchi b45fd9fde1 Bug 1588245 - Collect the assembly pattern of a target function on detour failure. r=mhowell
Many instances of the launcher failure ping indicate hooking NtMapViewOfSection
or LdrLoadDll failed.  This is most likely caused by a third-party application
applying a hook onto the same target earlier than we do.

This patch is to add a new field "detour_orig_bytes" in the laucnher failure ping
to collect the first sixteen bytes of a detour target function.  With this,
we can know whether those detour failures were caused by a third-party hook or not,
and if yes, what was the actual binary pattern.

Differential Revision: https://phabricator.services.mozilla.com/D89836
2020-09-16 20:12:08 +00:00
Toshihito Kikuchi d77b5bdf35 Bug 1662560 - Always retrieve the imagebase of the child process's executable from a process handle. r=mhowell
The earlier fix ea452bb92e6a proved the executable's imagebase in a child
process is not always the same as the local imagebase.  This patch applies
the new approach to retieve the imagebase from a handle to all channels.

Interestingly, we observed the launcher failures at `VirtualProtectEx` only
when launching a sandboxed process, not when launching the browser process.
In the long term, we may need to take care of all `WriteProcessMemory` calls
for a child process for greater safety, but given that observation, this
patch only updates `RestoreImportDirectory` and `InitializeDllBlocklistOOP`.

Differential Revision: https://phabricator.services.mozilla.com/D90316
2020-09-15 21:10:06 +00:00
Doug Thayer 2e5dcd024d Bug 1656526 - Lazily load user32 and gdi32 for skeleton UI r=mhowell
We need this because otherwise we load user32, which fails the check in
WindowsDllBlocklist.cpp (line 649). It sounds like this check is non-
negotiable, so this is the only solution I can come up with. Obviously
please let me know if there is some reason we cannot do this, but it
seems to function fine.

Depends on D89670

Differential Revision: https://phabricator.services.mozilla.com/D90271
2020-09-15 16:23:16 +00:00
Doug Thayer 57e80f531d Bug 1656526 - Draw app skeleton UI r=Gijs,mhowell
Hopefully the comments in the actual code are enough to explain what is going
on here.

NOTE: this patch does not represent a finished skeleton UI. There are some
questions in comments within the code, and generally I'm seeking feedback on
whether the overall approach seems sane or not. Gijs, I'm including you for
feedback on whether you think this is maintainable by more frontend-oriented
folks, and Molly, I'm including you for feedback on whether the justification
for writing to a raw pixel buffer seems sound or not, and a general review of
the approach.

Differential Revision: https://phabricator.services.mozilla.com/D86447
2020-09-15 14:50:21 +00:00
Doug Thayer fa7b10106a Bug 1656526 - Show blank window prior to loading xul on Windows r=mhowell
See bug for justification. This patch aims to display a blank window prior to
loading/prefetching xul.dll. It also has a placeholder for drawing a
skeleton UI into that window. Note that this is disabled by default based on
a registry value, as there are still kinks to work out (for instance, what
happens if we aren't actually going to display a window, because, say, Firefox
is already running.) This just gives a basic implementation to dogfood, and
facilitates distributing work across multiple contributors.

Onto the details. The patch achieves its goal by creating a window and
assigning its handle to a static variable, which will be consumed inside
nsWindow::Create by the first toplevel window we want to make. nsWindow::Create
will take ownership of the window handle, restyle it to its own liking, and
then proceed as if everything is normal and it had created the window itself.

Differential Revision: https://phabricator.services.mozilla.com/D86263
2020-09-15 14:50:19 +00:00
Gerald Squelart 782cf5d3ad Bug 1657033 - Use Span<const char> in JSONWriter - r=froydnj
In most situations, JSONWriter users already know string lengths (either directly, or through `nsCString` and friends), so we should keep this information through JSONWriter and not recompute it again.
This also allows using JSONWriter with sub-strings (e.g., from a bigger buffer), without having to create null-terminated strings.

Public JSONWriter functions have overloads that accept literal strings.

Differential Revision: https://phabricator.services.mozilla.com/D86192
2020-09-14 02:33:20 +00:00
Dorel Luca 634b687351 Backed out 4 changesets (bug 1656526) for Browser-chrome failures in toolkit/xre/test/browser_checkdllblockliststate.js. CLOSED TREE
Backed out changeset 24648c48a49c (bug 1656526)
Backed out changeset 472b724994eb (bug 1656526)
Backed out changeset 6fbb7e7ac121 (bug 1656526)
Backed out changeset 88ff36a4bcfb (bug 1656526)
2020-09-11 23:17:23 +03:00
Doug Thayer c893a9a0c2 Bug 1656526 - Draw app skeleton UI r=Gijs,mhowell
Hopefully the comments in the actual code are enough to explain what is going
on here.

NOTE: this patch does not represent a finished skeleton UI. There are some
questions in comments within the code, and generally I'm seeking feedback on
whether the overall approach seems sane or not. Gijs, I'm including you for
feedback on whether you think this is maintainable by more frontend-oriented
folks, and Molly, I'm including you for feedback on whether the justification
for writing to a raw pixel buffer seems sound or not, and a general review of
the approach.

Differential Revision: https://phabricator.services.mozilla.com/D86447
2020-09-11 14:12:15 +00:00
Doug Thayer efe700e222 Bug 1656526 - Show blank window prior to loading xul on Windows r=mhowell
See bug for justification. This patch aims to display a blank window prior to
loading/prefetching xul.dll. It also has a placeholder for drawing a
skeleton UI into that window. Note that this is disabled by default based on
a registry value, as there are still kinks to work out (for instance, what
happens if we aren't actually going to display a window, because, say, Firefox
is already running.) This just gives a basic implementation to dogfood, and
facilitates distributing work across multiple contributors.

Onto the details. The patch achieves its goal by creating a window and
assigning its handle to a static variable, which will be consumed inside
nsWindow::Create by the first toplevel window we want to make. nsWindow::Create
will take ownership of the window handle, restyle it to its own liking, and
then proceed as if everything is normal and it had created the window itself.

Differential Revision: https://phabricator.services.mozilla.com/D86263
2020-09-11 14:12:00 +00:00
Gerald Squelart 2ac895ec86 Bug 1664122 - Clearer MarkerOptions accessors - r=gregtatum
`MarkerOptions::Set()` returns the same reference type as the object it's invoked on, i.e.: & -> &, and && -> &&.

`MarkerOptions::NAME()` now always returns a reference to a `const` member, so it's clear it cannot be modified (even if the object at hand is not `const`).
`MarkerOptions::NAMERef()` must be used when non-`const` access is needed.

Differential Revision: https://phabricator.services.mozilla.com/D89715
2020-09-11 00:44:18 +00:00
Gerald Squelart a087b2df35 Bug 1663554 - Convert AUTO_PROFILER_TEXT_MARKER_... to new AUTO_PROFILER_MARKER_TEXT - r=gregtatum
The name `AUTO_PROFILER_MARKER_TEXT` is more consistent with the equivalent non-`AUTO` macro, and similarly arguments have been re-ordered to be the same, i.e.: Name, category&options, text.

The different macros with different argument sets can now be collapsed into one macro, and the optional arguments (timing, inner window id, backtrace) can easily be added to the `MarkerOptions` where needed.

As a bonus, a specific start time can optionally be provided at construction time.

Differential Revision: https://phabricator.services.mozilla.com/D89588
2020-09-11 00:42:51 +00:00
Gerald Squelart b0bf2c2172 Bug 1663554 - Convert PROFILER_ADD_TEXT_MARKER and friends to PROFILER_MARKER_TEXT - r=gregtatum
Mostly mechanical changes, with some work needed to convert the different payloads (with optional timestamps, inner window id, and/or backtrace) to the equivalent MarkerOptions.

Differential Revision: https://phabricator.services.mozilla.com/D89587
2020-09-11 00:41:27 +00:00
Gerald Squelart 5f9ff13253 Bug 1663543 - Convert PROFILER_ADD_MARKER and 2-arg profiler_add_marker to PROFILER_MARKER_UNTYPED - r=gregtatum
Mostly mechanical change, with some extra work where non-literal names are provided.
Also, when this is the only profiler call in a file, `#include "GeckoProfiler.h"` can be changed to `#include "mozilla/ProfilerMarkers.h"`.

Differential Revision: https://phabricator.services.mozilla.com/D89415
2020-09-10 03:02:36 +00:00
Gerald Squelart 6c2997d6a8 Bug 1663543 - Make MarkerCategory and MarkerOptions usable in macros - r=gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D89414
2020-09-10 03:00:54 +00:00
Toshihito Kikuchi f14b766f30 Bug 1662560 - Retrieve the imagebase of the child process's executable from a process handle. r=mhowell
Our data indicates when the browser process populates a newly-created child process,
`VirtualProtectEx` may fail with `ERROR_INVALID_ADDRESS` for some unknown reason.

One possible cause is the parameter `aRemoteExeImage` of `RestoreImportDirectory`
was wrong i.e. pointing to an invalid address.  We simply pass the local process's
imagebase as `aRemoteExeImage` based on the assumption that the same executable is
mapped onto the same address in a different process, but it may not be guaranteed.

To deal with that potential case, we could retrieve a correct imagebase from the handle
of a remote process as we do for the plugin process.  Since we're not so sure about
the root cause or the effectiveness of this fix, we run it only when the first
attempt to `VirtualProtectEx` failed in Nightly.  Once it's confirmed, we promote this
to a permanent fix.

Differential Revision: https://phabricator.services.mozilla.com/D89502
2020-09-08 22:13:27 +00:00
Gerald Squelart 87d2667590 Bug 1662994 - Fix non-MOZ_GECKO_PROFILER_BUILD - r=canaltinova
`ProfileChunkedBuffer` needed to be fully defined, because its destructor is needed to define `UniquePtr<ProfileChunkedBuffer>`.
It can just be empty, because it won't actually be used anyway.

Added non-`MOZ_GECKO_PROFILER` tests around this.

Differential Revision: https://phabricator.services.mozilla.com/D89351
2020-09-07 10:11:16 +00:00
Gerald Squelart b1c2892ebb Bug 1646266 - Profiler Markers 2.0 tests - r=gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D87260
2020-09-02 04:03:32 +00:00
Gerald Squelart ff8b12cb5c Bug 1646266 - {,Base}ProfilerMarkerTypes.h - r=gregtatum
This patch ports existing ProfilerMarkerPayload types to draft struct definitions that may be used with the new markers API.
This is just a starting point, they may be changed later on as needed, see meta-bug 1661394.

Differential Revision: https://phabricator.services.mozilla.com/D87259
2020-09-02 04:03:22 +00:00
Gerald Squelart e6bd850ec0 Bug 1646266 - {BASE_,}PROFILER_MARKER{,_TEXT} - r=gregtatum
This is the main public marker API:
- `AddMarkerToBuffer` can be used to store a marker to any buffer. This could be useful to code that wants to store markers outside of the default profiler buffers.
- `baseprofiler::AddMarker`/`profiler_add_marker` store a marker in the appropriate profiler buffer.
- BASE_PROFILER_MARKER and PROFILER_MARKER do the same, but are also defined (and empty) when MOZ_GECKO_PROFILER is not #defined.
All these take a name, marker options, a marker type, and the type's expected arguments if any (as expected by the `StreamJSONMarkerData` function).

Extra helpers for the most common types:
- BASE_PROFILER_MARKER_UNTYPED and PROFILER_MARKER_UNTYPED store a marker with no data payload.
- BASE_PROFILER_MARKER_TEXT and PROFILER_MARKER_TEXT store a text marker. `baseprofiler::markers::Text` is an example of how new marker types can be defined.

Differential Revision: https://phabricator.services.mozilla.com/D87257
2020-09-02 04:03:20 +00:00