OLD | NEW |
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 #include "ppapi/proxy/ppb_font_proxy.h" | 5 #include "ppapi/proxy/ppb_font_proxy.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "ppapi/c/dev/ppb_font_dev.h" | 8 #include "ppapi/c/dev/ppb_font_dev.h" |
9 #include "ppapi/proxy/plugin_dispatcher.h" | 9 #include "ppapi/proxy/plugin_dispatcher.h" |
10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 static const Info info = { | 57 static const Info info = { |
58 ::ppapi::thunk::GetPPB_Font_Thunk(), | 58 ::ppapi::thunk::GetPPB_Font_Thunk(), |
59 PPB_FONT_DEV_INTERFACE, | 59 PPB_FONT_DEV_INTERFACE, |
60 INTERFACE_ID_PPB_FONT, | 60 INTERFACE_ID_PPB_FONT, |
61 false, | 61 false, |
62 &CreateFontProxy, | 62 &CreateFontProxy, |
63 }; | 63 }; |
64 return &info; | 64 return &info; |
65 } | 65 } |
66 | 66 |
67 ::ppapi::thunk::PPB_Font_FunctionAPI* PPB_Font_Proxy::AsFont_FunctionAPI() { | 67 ::ppapi::thunk::PPB_Font_FunctionAPI* PPB_Font_Proxy::AsPPB_Font_FunctionAPI() { |
68 return this; | 68 return this; |
69 } | 69 } |
70 | 70 |
71 PP_Var PPB_Font_Proxy::GetFontFamilies(PP_Instance instance) { | 71 PP_Var PPB_Font_Proxy::GetFontFamilies(PP_Instance instance) { |
72 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 72 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
73 if (!dispatcher) | 73 if (!dispatcher) |
74 return PP_MakeUndefined(); | 74 return PP_MakeUndefined(); |
75 | 75 |
76 // Assume the font families don't change, so we can cache the result globally. | 76 // Assume the font families don't change, so we can cache the result globally. |
77 static std::string families; | 77 static std::string families; |
(...skipping 29 matching lines...) Expand all Loading... |
107 &webkit_event_, desc, | 107 &webkit_event_, desc, |
108 face ? *face : std::string(), | 108 face ? *face : std::string(), |
109 GetDispatcher()->preferences(), | 109 GetDispatcher()->preferences(), |
110 &result)); | 110 &result)); |
111 font_forwarding_.reset(result); | 111 font_forwarding_.reset(result); |
112 } | 112 } |
113 | 113 |
114 Font::~Font() { | 114 Font::~Font() { |
115 } | 115 } |
116 | 116 |
117 ppapi::thunk::PPB_Font_API* Font::AsFont_API() { | 117 ppapi::thunk::PPB_Font_API* Font::AsPPB_Font_API() { |
118 return this; | 118 return this; |
119 } | 119 } |
120 | 120 |
121 Font* Font::AsFont() { | 121 Font* Font::AsFont() { |
122 return this; | 122 return this; |
123 } | 123 } |
124 | 124 |
125 PP_Bool Font::Describe(PP_FontDescription_Dev* description, | 125 PP_Bool Font::Describe(PP_FontDescription_Dev* description, |
126 PP_FontMetrics_Dev* metrics) { | 126 PP_FontMetrics_Dev* metrics) { |
127 std::string face; | 127 std::string face; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 return result; | 220 return result; |
221 } | 221 } |
222 | 222 |
223 void Font::RunOnWebKitThread(const base::Closure& task) { | 223 void Font::RunOnWebKitThread(const base::Closure& task) { |
224 GetDispatcher()->PostToWebKitThread(FROM_HERE, task); | 224 GetDispatcher()->PostToWebKitThread(FROM_HERE, task); |
225 webkit_event_.Wait(); | 225 webkit_event_.Wait(); |
226 } | 226 } |
227 | 227 |
228 } // namespace proxy | 228 } // namespace proxy |
229 } // namespace pp | 229 } // namespace pp |
OLD | NEW |