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

Side by Side Diff: content/browser/renderer_host/pepper/pepper_browser_font_singleton_host.cc

Issue 13458002: Use sequenced workers for the getting the system's font list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use sequenced workers Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "content/browser/renderer_host/pepper/pepper_browser_font_singleton_hos t.h" 5 #include "content/browser/renderer_host/pepper/pepper_browser_font_singleton_hos t.h"
6 6
7 #include "base/threading/sequenced_worker_pool.h" 7 #include "base/threading/sequenced_worker_pool.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "content/common/font_list.h" 9 #include "content/common/font_list.h"
10 #include "content/public/browser/browser_ppapi_host.h" 10 #include "content/public/browser/browser_ppapi_host.h"
(...skipping 28 matching lines...) Expand all
39 }; 39 };
40 40
41 FontMessageFilter::FontMessageFilter() { 41 FontMessageFilter::FontMessageFilter() {
42 } 42 }
43 43
44 FontMessageFilter::~FontMessageFilter() { 44 FontMessageFilter::~FontMessageFilter() {
45 } 45 }
46 46
47 scoped_refptr<base::TaskRunner> FontMessageFilter::OverrideTaskRunnerForMessage( 47 scoped_refptr<base::TaskRunner> FontMessageFilter::OverrideTaskRunnerForMessage(
48 const IPC::Message& msg) { 48 const IPC::Message& msg) {
49 // Use the blocking pool to get the font list (currently the only message 49 // Use the blocking pool to get the font list (currently the only message)
50 // so we can always just return it). 50 // Since getting the font list is non-threadsafe on Linux (for versions of
51 return scoped_refptr<base::TaskRunner>(BrowserThread::GetBlockingPool()); 51 // Pango predating 2013), use a sequenced task runner.
52 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool();
53 return pool->GetSequencedTaskRunner(
54 pool->GetNamedSequenceToken(kFontListSequenceToken));
52 } 55 }
53 56
54 int32_t FontMessageFilter::OnResourceMessageReceived( 57 int32_t FontMessageFilter::OnResourceMessageReceived(
55 const IPC::Message& msg, 58 const IPC::Message& msg,
56 ppapi::host::HostMessageContext* context) { 59 ppapi::host::HostMessageContext* context) {
57 IPC_BEGIN_MESSAGE_MAP(FontMessageFilter, msg) 60 IPC_BEGIN_MESSAGE_MAP(FontMessageFilter, msg)
58 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0( 61 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(
59 PpapiHostMsg_BrowserFontSingleton_GetFontFamilies, 62 PpapiHostMsg_BrowserFontSingleton_GetFontFamilies,
60 OnHostMsgGetFontFamilies) 63 OnHostMsgGetFontFamilies)
61 IPC_END_MESSAGE_MAP() 64 IPC_END_MESSAGE_MAP()
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 PP_Resource resource) 102 PP_Resource resource)
100 : ResourceHost(host->GetPpapiHost(), instance, resource) { 103 : ResourceHost(host->GetPpapiHost(), instance, resource) {
101 AddFilter(scoped_refptr<ppapi::host::ResourceMessageFilter>( 104 AddFilter(scoped_refptr<ppapi::host::ResourceMessageFilter>(
102 new FontMessageFilter())); 105 new FontMessageFilter()));
103 } 106 }
104 107
105 PepperBrowserFontSingletonHost::~PepperBrowserFontSingletonHost() { 108 PepperBrowserFontSingletonHost::~PepperBrowserFontSingletonHost() {
106 } 109 }
107 110
108 } // namespace content 111 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698