Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Issue 1683973002: Enable threadsafe static initialization (aka 'magic statics') (Closed)

Created:
4 years, 10 months ago by jamesr
Modified:
4 years, 10 months ago
Reviewers:
viettrungluu
CC:
mojo-reviews_chromium.org
Base URL:
git@github.com:domokit/mojo.git@master
Target Ref:
refs/heads/master
Project:
mojo
Visibility:
Public.

Description

Enable threadsafe static initialization (aka 'magic statics') C++11 guarantees that initialization of function statics will be threadsafe. We disabled this by passing -fno-threadsafe-statics because we used to support building using visual studio and older versions (older than 2015) did not implement this functionality. Now we only use modern toolchains which do support this and it's increasingly likely that libraries we want to use and that other C++ developers will expect rely on the standard behavior instead of our nonstandard init. Using the toolchain's implementation of threadsafe initialization is also very likely to be more efficient than our own handrolled threadsafe initialization and less error prone. With the specified behavior, many uses of base::Singleton for threadsafe initialization can be replaced by function statics for a performance boost. There's also a very slight risk that code that was depending on racy initialization could break, but such code is at the very least suspect if not outright broken already. Equivalent change in the Flutter engine is here: https://github.com/flutter/engine/pull/2375 R=viettrungluu@chromium.org Committed: https://chromium.googlesource.com/external/mojo/+/a406dee71d184264bee3ac7d8765deff733c5826

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+0 lines, -2 lines) Patch
M build/config/compiler/BUILD.gn View 1 chunk +0 lines, -2 lines 0 comments Download

Messages

Total messages: 7 (4 generated)
jamesr
4 years, 10 months ago (2016-02-10 02:12:14 UTC) #4
viettrungluu
lgtm
4 years, 10 months ago (2016-02-10 15:49:47 UTC) #5
jamesr
4 years, 10 months ago (2016-02-10 17:54:14 UTC) #7
Message was sent while issue was closed.
Committed patchset #1 (id:1) manually as
a406dee71d184264bee3ac7d8765deff733c5826 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698