OLD | NEW |
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // Since getting the font list is non-threadsafe on Linux (for versions of | 48 // Since getting the font list is non-threadsafe on Linux (for versions of |
49 // Pango predating 2013), use a sequenced task runner. | 49 // Pango predating 2013), use a sequenced task runner. |
50 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); | 50 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); |
51 return pool->GetSequencedTaskRunner( | 51 return pool->GetSequencedTaskRunner( |
52 pool->GetNamedSequenceToken(kFontListSequenceToken)); | 52 pool->GetNamedSequenceToken(kFontListSequenceToken)); |
53 } | 53 } |
54 | 54 |
55 int32_t FontMessageFilter::OnResourceMessageReceived( | 55 int32_t FontMessageFilter::OnResourceMessageReceived( |
56 const IPC::Message& msg, | 56 const IPC::Message& msg, |
57 ppapi::host::HostMessageContext* context) { | 57 ppapi::host::HostMessageContext* context) { |
58 IPC_BEGIN_MESSAGE_MAP(FontMessageFilter, msg) | 58 PPAPI_BEGIN_MESSAGE_MAP(FontMessageFilter, msg) |
59 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0( | 59 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0( |
60 PpapiHostMsg_BrowserFontSingleton_GetFontFamilies, | 60 PpapiHostMsg_BrowserFontSingleton_GetFontFamilies, |
61 OnHostMsgGetFontFamilies) | 61 OnHostMsgGetFontFamilies) |
62 IPC_END_MESSAGE_MAP() | 62 PPAPI_END_MESSAGE_MAP() |
63 return PP_ERROR_FAILED; | 63 return PP_ERROR_FAILED; |
64 } | 64 } |
65 | 65 |
66 int32_t FontMessageFilter::OnHostMsgGetFontFamilies( | 66 int32_t FontMessageFilter::OnHostMsgGetFontFamilies( |
67 ppapi::host::HostMessageContext* context) { | 67 ppapi::host::HostMessageContext* context) { |
68 // OK to use "slow blocking" version since we're on the blocking pool. | 68 // OK to use "slow blocking" version since we're on the blocking pool. |
69 scoped_ptr<base::ListValue> list(GetFontList_SlowBlocking()); | 69 scoped_ptr<base::ListValue> list(GetFontList_SlowBlocking()); |
70 | 70 |
71 std::string output; | 71 std::string output; |
72 for (size_t i = 0; i < list->GetSize(); i++) { | 72 for (size_t i = 0; i < list->GetSize(); i++) { |
(...skipping 26 matching lines...) Expand all Loading... |
99 PP_Instance instance, | 99 PP_Instance instance, |
100 PP_Resource resource) | 100 PP_Resource resource) |
101 : ResourceHost(host->GetPpapiHost(), instance, resource) { | 101 : ResourceHost(host->GetPpapiHost(), instance, resource) { |
102 AddFilter(scoped_refptr<ppapi::host::ResourceMessageFilter>( | 102 AddFilter(scoped_refptr<ppapi::host::ResourceMessageFilter>( |
103 new FontMessageFilter())); | 103 new FontMessageFilter())); |
104 } | 104 } |
105 | 105 |
106 PepperBrowserFontSingletonHost::~PepperBrowserFontSingletonHost() {} | 106 PepperBrowserFontSingletonHost::~PepperBrowserFontSingletonHost() {} |
107 | 107 |
108 } // namespace content | 108 } // namespace content |
OLD | NEW |