0

GCC: workaround of GCC bug passing a parent class method to a fixed_flat_map

In PdfViewWebPlugin we are hitting a GCC bug on initialization of
message handlers fixed_flat_map with the members of the parent class.

Bug reported to GCC at:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105996

Bug: 819294
Change-Id: Ied9a050145675be8865304eed6fdb9cf0fd09df4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3709463
Reviewed-by: K. Moon <kmoon@chromium.org>
Commit-Queue: José Dapena Paz <jdapena@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1015489}
This commit is contained in:
Jose Dapena Paz
2022-06-17 19:55:53 +00:00
committed by Chromium LUCI CQ
parent 91586b6b86
commit 1a2a8453a8

@ -978,7 +978,13 @@ PdfViewWebPlugin::CreateAssociatedURLLoader(
void PdfViewWebPlugin::OnMessage(const base::Value::Dict& message) {
using MessageHandler = void (PdfViewWebPlugin::*)(const base::Value::Dict&);
static constexpr auto kMessageHandlers =
// Settings this as const instead of constexpr to workaround a bug
// in GCC, that will try to reinterpret_cast the method pointers.
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105996
// TODO(crbug.com/1302059): make it constexpr again when we get rid
// of PdfViewPluginBase
static const auto kMessageHandlers =
base::MakeFixedFlatMap<base::StringPiece, MessageHandler>({
{"displayAnnotations",
&PdfViewWebPlugin::HandleDisplayAnnotationsMessage},