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

Unified Diff: third_party/harfbuzz-ng/src/hb-common.cc

Issue 10915172: harfbuzz-ng roll (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-common.h ('k') | third_party/harfbuzz-ng/src/hb-coretext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/harfbuzz-ng/src/hb-common.cc
diff --git a/third_party/harfbuzz-ng/src/hb-common.cc b/third_party/harfbuzz-ng/src/hb-common.cc
index 331d255b45f38e12cdf839c6ee6a062bc317594f..33a514dbfda8758283208a9e264a8cee98c64137 100644
--- a/third_party/harfbuzz-ng/src/hb-common.cc
+++ b/third_party/harfbuzz-ng/src/hb-common.cc
@@ -58,6 +58,15 @@ hb_tag_from_string (const char *s, int len)
return HB_TAG_CHAR4 (tag);
}
+void
+hb_tag_to_string (hb_tag_t tag, char *buf)
+{
+ buf[0] = (char) (uint8_t) (tag >> 24);
+ buf[1] = (char) (uint8_t) (tag >> 16);
+ buf[2] = (char) (uint8_t) (tag >> 8);
+ buf[3] = (char) (uint8_t) (tag >> 0);
+}
+
/* hb_direction_t */
@@ -98,7 +107,7 @@ hb_direction_to_string (hb_direction_t direction)
/* hb_language_t */
-struct _hb_language_t {
+struct hb_language_impl_t {
const char s[1];
};
@@ -238,17 +247,12 @@ hb_language_to_string (hb_language_t language)
hb_language_t
hb_language_get_default (void)
{
- static hb_language_t default_language;
-
- if (!default_language) {
- /* This block is not quite threadsafe, but is not as bad as
- * it looks since it's idempotent. As long as pointer ops
- * are atomic, we are safe. */
-
- /* I hear that setlocale() doesn't honor env vars on Windows,
- * but for now we ignore that. */
+ static hb_language_t default_language = HB_LANGUAGE_INVALID;
- default_language = hb_language_from_string (setlocale (LC_CTYPE, NULL), -1);
+ hb_language_t language = (hb_language_t) hb_atomic_ptr_get (&default_language);
+ if (unlikely (language == HB_LANGUAGE_INVALID)) {
+ language = hb_language_from_string (setlocale (LC_CTYPE, NULL), -1);
+ hb_atomic_ptr_cmpexch (&default_language, HB_LANGUAGE_INVALID, language);
}
return default_language;
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-common.h ('k') | third_party/harfbuzz-ng/src/hb-coretext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698