| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2008 The Native Client Authors. All rights reserved. | 2 * Copyright 2008 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can | 3 * Use of this source code is governed by a BSD-style license that can |
| 4 * be found in the LICENSE file. | 4 * be found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 | 7 |
| 8 // Portable interface for browser interaction - NPAPI implementation | 8 // Portable interface for browser interaction - NPAPI implementation |
| 9 | 9 |
| 10 #include "native_client/src/trusted/plugin/npapi/browser_impl_npapi.h" | 10 #include "native_client/src/trusted/plugin/npapi/browser_impl_npapi.h" |
| 11 | 11 |
| 12 #include <setjmp.h> | 12 #include <setjmp.h> |
| 13 #include <stdio.h> | 13 #include <stdio.h> |
| 14 #include <string.h> | 14 #include <string.h> |
| 15 | 15 |
| 16 #include <map> | 16 #include <map> |
| 17 | 17 |
| 18 #include "native_client/src/include/checked_cast.h" | 18 #include "native_client/src/include/checked_cast.h" |
| 19 #include "native_client/src/include/nacl_elf.h" | 19 #include "native_client/src/include/nacl_elf.h" |
| 20 #include "native_client/src/include/nacl_string.h" | 20 #include "native_client/src/include/nacl_string.h" |
| 21 #include "native_client/src/include/portability_io.h" | 21 #include "native_client/src/include/portability_io.h" |
| 22 #include "native_client/src/shared/npruntime/nacl_npapi.h" | 22 #include "native_client/src/shared/npruntime/nacl_npapi.h" |
| 23 #include "native_client/src/trusted/plugin/npapi/plugin_npapi.h" | 23 #include "native_client/src/trusted/plugin/npapi/plugin_npapi.h" |
| 24 #include "native_client/src/trusted/plugin/npapi/scriptable_impl_npapi.h" | 24 #include "native_client/src/trusted/plugin/npapi/scriptable_impl_npapi.h" |
| 25 #include "native_client/src/trusted/plugin/srpc/utility.h" | 25 #include "native_client/src/trusted/plugin/utility.h" |
| 26 | 26 |
| 27 using nacl::assert_cast; | 27 using nacl::assert_cast; |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 // Create an NPString from a C string. | 31 // Create an NPString from a C string. |
| 32 bool CopyToNPString(const nacl::string& string, NPString* npstr) { | 32 bool CopyToNPString(const nacl::string& string, NPString* npstr) { |
| 33 // We have to create a copy of the string using NPN_MemAlloc, because the | 33 // We have to create a copy of the string using NPN_MemAlloc, because the |
| 34 // browser sometimes will free the string using NPN_MemFree. Strdup and | 34 // browser sometimes will free the string using NPN_MemFree. Strdup and |
| 35 // friends use malloc, which would mix the memory allocators. | 35 // friends use malloc, which would mix the memory allocators. |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 194 |
| 195 NPP InstanceIdentifierToNPP(InstanceIdentifier id) { | 195 NPP InstanceIdentifierToNPP(InstanceIdentifier id) { |
| 196 return reinterpret_cast<NPP>(assert_cast<intptr_t>(id)); | 196 return reinterpret_cast<NPP>(assert_cast<intptr_t>(id)); |
| 197 } | 197 } |
| 198 | 198 |
| 199 InstanceIdentifier NPPToInstanceIdentifier(NPP npp) { | 199 InstanceIdentifier NPPToInstanceIdentifier(NPP npp) { |
| 200 return assert_cast<InstanceIdentifier>(reinterpret_cast<intptr_t>(npp)); | 200 return assert_cast<InstanceIdentifier>(reinterpret_cast<intptr_t>(npp)); |
| 201 } | 201 } |
| 202 | 202 |
| 203 } // namespace plugin | 203 } // namespace plugin |
| OLD | NEW |