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 "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "ppapi/c/dev/ppb_font_dev.h" | 9 #include "ppapi/c/dev/ppb_font_dev.h" |
10 #include "ppapi/proxy/plugin_dispatcher.h" | 10 #include "ppapi/proxy/plugin_dispatcher.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 PPB_Font_FunctionAPI* PPB_Font_Proxy::AsPPB_Font_FunctionAPI() { | 52 PPB_Font_FunctionAPI* PPB_Font_Proxy::AsPPB_Font_FunctionAPI() { |
53 return this; | 53 return this; |
54 } | 54 } |
55 | 55 |
56 PP_Var PPB_Font_Proxy::GetFontFamilies(PP_Instance instance) { | 56 PP_Var PPB_Font_Proxy::GetFontFamilies(PP_Instance instance) { |
57 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 57 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
58 if (!dispatcher) | 58 if (!dispatcher) |
59 return PP_MakeUndefined(); | 59 return PP_MakeUndefined(); |
60 | 60 |
61 // Assume the font families don't change, so we can cache the result globally. | 61 // Assume the font families don't change, so we can cache the result globally. |
62 static std::string families; | 62 CR_DEFINE_STATIC_LOCAL(std::string, families, ()); |
63 if (families.empty()) { | 63 if (families.empty()) { |
64 dispatcher->SendToBrowser( | 64 dispatcher->SendToBrowser( |
65 new PpapiHostMsg_PPBFont_GetFontFamilies(&families)); | 65 new PpapiHostMsg_PPBFont_GetFontFamilies(&families)); |
66 } | 66 } |
67 | 67 |
68 return StringVar::StringToPPVar(0, families); | 68 return StringVar::StringToPPVar(0, families); |
69 } | 69 } |
70 | 70 |
71 bool PPB_Font_Proxy::OnMessageReceived(const IPC::Message& msg) { | 71 bool PPB_Font_Proxy::OnMessageReceived(const IPC::Message& msg) { |
72 // There aren't any font messages. | 72 // There aren't any font messages. |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 webkit_event_.Wait(); | 219 webkit_event_.Wait(); |
220 } | 220 } |
221 | 221 |
222 // static | 222 // static |
223 void Font::DeleteFontForwarding(WebKitForwarding::Font* font_forwarding) { | 223 void Font::DeleteFontForwarding(WebKitForwarding::Font* font_forwarding) { |
224 delete font_forwarding; | 224 delete font_forwarding; |
225 } | 225 } |
226 | 226 |
227 } // namespace proxy | 227 } // namespace proxy |
228 } // namespace ppapi | 228 } // namespace ppapi |
OLD | NEW |