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

Side by Side Diff: content/common/font_list.h

Issue 2886883003: Remove content::kFontListSequenceToken. (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_COMMON_FONT_LIST_H_ 5 #ifndef CONTENT_COMMON_FONT_LIST_H_
6 #define CONTENT_COMMON_FONT_LIST_H_ 6 #define CONTENT_COMMON_FONT_LIST_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/sequenced_task_runner.h"
11
10 namespace base { 12 namespace base {
11 class ListValue; 13 class ListValue;
12 } 14 }
13 15
14 namespace content { 16 namespace content {
15 17
16 // Getting the list of fonts on the system is non-threadsafe on Linux for 18 // GetFontList_SlowBlocking() must only be called from the SequencedTaskRunner
17 // versions of Pango predating 2013. This sequence token can be used to enforce 19 // returned by this function because it is non-threadsafe on Linux for versions
18 // serial execution of get font list tasks. 20 // of Pango predating 2013.
19 extern const char kFontListSequenceToken[]; 21 scoped_refptr<base::SequencedTaskRunner> GetFontListTaskRunner();
20 22
21 // Retrieves the fonts available on the current platform and returns them. 23 // Retrieves the fonts available on the current platform and returns them.
22 // The caller will own the returned pointer. Each entry will be a list of 24 // The caller will own the returned pointer. Each entry will be a list of
23 // two strings, the first being the font family, and the second being the 25 // two strings, the first being the font family, and the second being the
24 // localized name. 26 // localized name.
25 // 27 //
26 // This function is potentially slow (the system may do a bunch of I/O) so be 28 // Can only be called from the SequencedTaskRunner returned by
27 // sure not to call this on a time-critical thread like the UI or I/O threads. 29 // GetFontListTaskRunner(). Most callers will want to use the GetFontListAsync
28 // 30 // function in content/browser/font_list_async.h which does an asynchronous
29 // Since getting the fonts is not threadsafe on Linux, use 31 // call.
30 // |kFontListSequenceToken| to prevent race conditions.
31 //
32 // Most callers will want to use the GetFontListAsync function in
33 // content/browser/font_list_async.h which does an asynchronous call.
34 std::unique_ptr<base::ListValue> GetFontList_SlowBlocking(); 32 std::unique_ptr<base::ListValue> GetFontList_SlowBlocking();
35 33
36 } // namespace content 34 } // namespace content
37 35
38 #endif // CONTENT_COMMON_FONT_LIST_H_ 36 #endif // CONTENT_COMMON_FONT_LIST_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/pepper/pepper_truetype_font_list_host.cc ('k') | content/common/font_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698