1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
From 823d20044c74ff8524954b2f3b01a51f390567b0 Mon Sep 17 00:00:00 2001
From: Jose Dapena Paz <jose.dapena@lge.com>
Date: Tue, 29 May 2018 18:38:39 +0000
Subject: [PATCH] GCC: workaround GCC bug "std::map::insert(value_type &&) not
selected"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
There are several calls following this pattern:
std:map<A, std::unique_ptr<B>> map;
A a;
std::unique_ptr<B> b;
map.insert({a, std::move(b)});
This fails in gcc < 7.3 because the operator for inserting from &&
is not present, as reported here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82522
So apply a workaround that makes the move steps explicit.
Change-Id: I54cea26eac6e74a3d9c2d17a37e3c4c9ce62fd74
Reviewed-on: https://chromium-review.googlesource.com/1076471
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Dan Elphick <delphick@chromium.org>
Commit-Queue: José Dapena Paz <jose.dapena@lge.com>
Cr-Commit-Position: refs/heads/master@{#562519}
---
content/browser/background_fetch/background_fetch_context.cc | 5 ++++-
content/renderer/input/input_event_prediction.cc | 5 ++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/content/browser/background_fetch/background_fetch_context.cc b/content/browser/background_fetch/background_fetch_context.cc
index 5dec01f82db31..649d4595ba83e 100644
--- ./content/browser/background_fetch/background_fetch_context.cc
+++ ./content/browser/background_fetch/background_fetch_context.cc
@@ -222,7 +222,10 @@ void BackgroundFetchContext::InitializeController(
scheduler_->AddJobController(controller.get());
- job_controllers_.insert({unique_id, std::move(controller)});
+ // Workaround for GLIBC C++ < 7.3 that fails to insert with braces
+ // See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82522
+ auto pair = std::make_pair(unique_id, std::move(controller));
+ job_controllers_.insert(std::move(pair));
std::move(done_closure).Run();
}
diff --git a/content/renderer/input/input_event_prediction.cc b/content/renderer/input/input_event_prediction.cc
index 89636c9736da5..f1bce36364ed9 100644
--- ./content/renderer/input/input_event_prediction.cc
+++ ./content/renderer/input/input_event_prediction.cc
@@ -119,7 +119,10 @@ void InputEventPrediction::UpdateSinglePointer(
if (predictor != pointer_id_predictor_map_.end()) {
predictor->second->Update(data);
} else {
- pointer_id_predictor_map_.insert({event.id, SetUpPredictor()});
+ // Workaround for GLIBC C++ < 7.3 that fails to insert with braces
+ // See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82522
+ auto pair = std::make_pair(event.id, SetUpPredictor());
+ pointer_id_predictor_map_.insert(std::move(pair));
pointer_id_predictor_map_[event.id]->Update(data);
}
}
|