From ffa591aa664fc8620ca387afa041a0a65b0339c6 Mon Sep 17 00:00:00 2001 From: Christophe Chapuis Date: Tue, 10 May 2016 17:37:37 +0000 Subject: [PATCH 07/10] storage browser quota: workaround for crash on cache update When using GCC 5.3.0, we get a crash on the statement: "int64* usage = &cached_usage_by_host_[host][origin]" Apparently adding implicitely a new (GURL,int64) pair in the host cache results in incorrect code on armv7. This fix adds the pair more smoothly, step-by-step. The resulting binary code isn't faulty anymore. This could be related to the following bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69841 Signed-off-by: Christophe Chapuis --- chromium/storage/browser/quota/client_usage_tracker.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/chromium/storage/browser/quota/client_usage_tracker.cc b/src/3rdparty/chromium/storage/browser/quota/client_usage_tracker.cc index c9c46f6..c4e9585 100644 --- a/src/3rdparty/chromium/storage/browser/quota/client_usage_tracker.cc +++ b/src/3rdparty/chromium/storage/browser/quota/client_usage_tracker.cc @@ -358,7 +358,17 @@ void ClientUsageTracker::AddCachedOrigin(const GURL& origin, DCHECK(IsUsageCacheEnabledForOrigin(origin)); std::string host = net::GetHostOrSpecFromURL(origin); - int64_t* usage = &cached_usage_by_host_[host][origin]; + + UsageMap& cached_usage_for_host = cached_usage_by_host_[host]; + UsageMap::iterator found = cached_usage_for_host.find(origin); + if (found == cached_usage_for_host.end()) { + // try to add it smoothly + std::pair newPair(origin,0); + cached_usage_for_host.insert(newPair); + } + int64_t* usage = &(cached_usage_for_host[origin]); + + //int64* usage = &cached_usage_by_host_[host][origin]; int64_t delta = new_usage - *usage; *usage = new_usage; if (delta) { -- 2.7.4