| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/nacl/renderer/ppb_nacl_private_impl.h" | 5 #include "components/nacl/renderer/ppb_nacl_private_impl.h" |
| 6 | 6 |
| 7 #include <numeric> | 7 #include <numeric> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 *ld_tool_name = ppapi::StringVar::StringToPPVar(ld_tool_name_str); | 1155 *ld_tool_name = ppapi::StringVar::StringToPPVar(ld_tool_name_str); |
| 1156 } | 1156 } |
| 1157 } | 1157 } |
| 1158 return PP_TRUE; | 1158 return PP_TRUE; |
| 1159 } | 1159 } |
| 1160 | 1160 |
| 1161 PP_Var GetCpuFeatureAttrs() { | 1161 PP_Var GetCpuFeatureAttrs() { |
| 1162 return ppapi::StringVar::StringToPPVar(GetCpuFeatures()); | 1162 return ppapi::StringVar::StringToPPVar(GetCpuFeatures()); |
| 1163 } | 1163 } |
| 1164 | 1164 |
| 1165 void PostMessageToJavaScriptMainThread(PP_Instance instance, | |
| 1166 const std::string& message) { | |
| 1167 content::PepperPluginInstance* plugin_instance = | |
| 1168 content::PepperPluginInstance::Get(instance); | |
| 1169 if (plugin_instance) { | |
| 1170 PP_Var message_var = ppapi::StringVar::StringToPPVar(message); | |
| 1171 plugin_instance->PostMessageToJavaScript(message_var); | |
| 1172 ppapi::PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(message_var); | |
| 1173 } | |
| 1174 } | |
| 1175 | |
| 1176 void PostMessageToJavaScript(PP_Instance instance, const char* message) { | |
| 1177 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( | |
| 1178 FROM_HERE, | |
| 1179 base::Bind(&PostMessageToJavaScriptMainThread, | |
| 1180 instance, | |
| 1181 std::string(message))); | |
| 1182 } | |
| 1183 | |
| 1184 // Encapsulates some of the state for a call to DownloadNexe to prevent | 1165 // Encapsulates some of the state for a call to DownloadNexe to prevent |
| 1185 // argument lists from getting too long. | 1166 // argument lists from getting too long. |
| 1186 struct DownloadNexeRequest { | 1167 struct DownloadNexeRequest { |
| 1187 PP_Instance instance; | 1168 PP_Instance instance; |
| 1188 std::string url; | 1169 std::string url; |
| 1189 PP_CompletionCallback callback; | 1170 PP_CompletionCallback callback; |
| 1190 base::Time start_time; | 1171 base::Time start_time; |
| 1191 }; | 1172 }; |
| 1192 | 1173 |
| 1193 // A utility class to ensure that we don't send progress events more often than | 1174 // A utility class to ensure that we don't send progress events more often than |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1694 &Vlog, | 1675 &Vlog, |
| 1695 &InitializePlugin, | 1676 &InitializePlugin, |
| 1696 &GetNexeSize, | 1677 &GetNexeSize, |
| 1697 &RequestNaClManifest, | 1678 &RequestNaClManifest, |
| 1698 &GetManifestBaseURL, | 1679 &GetManifestBaseURL, |
| 1699 &ProcessNaClManifest, | 1680 &ProcessNaClManifest, |
| 1700 &DevInterfacesEnabled, | 1681 &DevInterfacesEnabled, |
| 1701 &ManifestGetProgramURL, | 1682 &ManifestGetProgramURL, |
| 1702 &GetPNaClResourceInfo, | 1683 &GetPNaClResourceInfo, |
| 1703 &GetCpuFeatureAttrs, | 1684 &GetCpuFeatureAttrs, |
| 1704 &PostMessageToJavaScript, | |
| 1705 &DownloadNexe, | 1685 &DownloadNexe, |
| 1706 &ReportSelLdrStatus, | 1686 &ReportSelLdrStatus, |
| 1707 &LogTranslateTime, | 1687 &LogTranslateTime, |
| 1708 &OpenManifestEntry, | 1688 &OpenManifestEntry, |
| 1709 &SetPNaClStartTime, | 1689 &SetPNaClStartTime, |
| 1710 &StreamPexe | 1690 &StreamPexe |
| 1711 }; | 1691 }; |
| 1712 | 1692 |
| 1713 } // namespace | 1693 } // namespace |
| 1714 | 1694 |
| 1715 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 1695 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
| 1716 return &nacl_interface; | 1696 return &nacl_interface; |
| 1717 } | 1697 } |
| 1718 | 1698 |
| 1719 } // namespace nacl | 1699 } // namespace nacl |
| OLD | NEW |