summaryrefslogtreecommitdiffstats
path: root/content/common
diff options
context:
space:
mode:
authorfalken@chromium.org <falken@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-04 12:01:35 +0000
committerfalken@chromium.org <falken@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-04 12:01:35 +0000
commitbc96dad5024f6b875da211924a72cb0372824956 (patch)
treef8976778d36a0b2f76ce3bb8e6b6813af54f4e22 /content/common
parentdd61dc15ed0bea2dbce0d4107b43c59426c84ad6 (diff)
downloadchromium_src-bc96dad5024f6b875da211924a72cb0372824956.zip
chromium_src-bc96dad5024f6b875da211924a72cb0372824956.tar.gz
chromium_src-bc96dad5024f6b875da211924a72cb0372824956.tar.bz2
Use sequenced workers for the getting the system's font list.
This is necessary because on Linux we use Pango, which is not threadsafe (only newer versions are). BUG=223772 Review URL: https://chromiumcodereview.appspot.com/13458002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192307 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common')
-rw-r--r--content/common/font_list.cc9
-rw-r--r--content/common/font_list.h8
2 files changed, 17 insertions, 0 deletions
diff --git a/content/common/font_list.cc b/content/common/font_list.cc
new file mode 100644
index 0000000..398ee80
--- /dev/null
+++ b/content/common/font_list.cc
@@ -0,0 +1,9 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/common/font_list.h"
+
+namespace content {
+const char kFontListSequenceToken[] = "_font_list_sequence_token_";
+}
diff --git a/content/common/font_list.h b/content/common/font_list.h
index 4f59e6d..dd14ce7 100644
--- a/content/common/font_list.h
+++ b/content/common/font_list.h
@@ -13,6 +13,11 @@ class ListValue;
namespace content {
+// Getting the list of fonts on the system is non-threadsafe on Linux for
+// versions of Pango predating 2013. This sequence token can be used to enforce
+// serial execution of get font list tasks.
+extern const char kFontListSequenceToken[];
+
// Retrieves the fonts available on the current platform and returns them.
// The caller will own the returned pointer. Each entry will be a list of
// two strings, the first being the font family, and the second being the
@@ -21,6 +26,9 @@ namespace content {
// This function is potentially slow (the system may do a bunch of I/O) so be
// sure not to call this on a time-critical thread like the UI or I/O threads.
//
+// Since getting the fonts is not threadsafe on Linux, use
+// |kFontListSequenceToken| to prevent race conditions.
+//
// Most callers will want to use the GetFontListAsync function in
// content/browser/font_list_async.h which does an asynchronous call.
scoped_ptr<base::ListValue> GetFontList_SlowBlocking();