| 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 <setjmp.h> | 10 #include <setjmp.h> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 bool PortablePluginInterface::identifiers_initialized = false; | 28 bool PortablePluginInterface::identifiers_initialized = false; |
| 29 uintptr_t PortablePluginInterface::kConnectIdent; | 29 uintptr_t PortablePluginInterface::kConnectIdent; |
| 30 uintptr_t PortablePluginInterface::kHeightIdent; | 30 uintptr_t PortablePluginInterface::kHeightIdent; |
| 31 uintptr_t PortablePluginInterface::kHrefIdent; | 31 uintptr_t PortablePluginInterface::kHrefIdent; |
| 32 uintptr_t PortablePluginInterface::kLengthIdent; | 32 uintptr_t PortablePluginInterface::kLengthIdent; |
| 33 uintptr_t PortablePluginInterface::kLocationIdent; | 33 uintptr_t PortablePluginInterface::kLocationIdent; |
| 34 uintptr_t PortablePluginInterface::kMapIdent; | 34 uintptr_t PortablePluginInterface::kMapIdent; |
| 35 uintptr_t PortablePluginInterface::kModuleReadyIdent; | 35 uintptr_t PortablePluginInterface::kModuleReadyIdent; |
| 36 uintptr_t PortablePluginInterface::kNaClMultimediaBridgeIdent; | 36 uintptr_t PortablePluginInterface::kNaClMultimediaBridgeIdent; |
| 37 uintptr_t PortablePluginInterface::kNexeIdent; |
| 37 uintptr_t PortablePluginInterface::kNullNpapiMethodIdent; | 38 uintptr_t PortablePluginInterface::kNullNpapiMethodIdent; |
| 38 uintptr_t PortablePluginInterface::kOnfailIdent; | 39 uintptr_t PortablePluginInterface::kOnfailIdent; |
| 39 uintptr_t PortablePluginInterface::kOnloadIdent; | 40 uintptr_t PortablePluginInterface::kOnloadIdent; |
| 40 uintptr_t PortablePluginInterface::kReadIdent; | 41 uintptr_t PortablePluginInterface::kReadIdent; |
| 41 uintptr_t PortablePluginInterface::kSetCommandLogIdent; | 42 uintptr_t PortablePluginInterface::kSetCommandLogIdent; |
| 42 uintptr_t PortablePluginInterface::kShmFactoryIdent; | 43 uintptr_t PortablePluginInterface::kShmFactoryIdent; |
| 43 uintptr_t PortablePluginInterface::kSignaturesIdent; | 44 uintptr_t PortablePluginInterface::kSignaturesIdent; |
| 44 uintptr_t PortablePluginInterface::kSrcIdent; | |
| 45 uintptr_t PortablePluginInterface::kToStringIdent; | 45 uintptr_t PortablePluginInterface::kToStringIdent; |
| 46 uintptr_t PortablePluginInterface::kUrlAsNaClDescIdent; | 46 uintptr_t PortablePluginInterface::kUrlAsNaClDescIdent; |
| 47 uintptr_t PortablePluginInterface::kValueOfIdent; | 47 uintptr_t PortablePluginInterface::kValueOfIdent; |
| 48 uintptr_t PortablePluginInterface::kVideoUpdateModeIdent; | 48 uintptr_t PortablePluginInterface::kVideoUpdateModeIdent; |
| 49 uintptr_t PortablePluginInterface::kWidthIdent; | 49 uintptr_t PortablePluginInterface::kWidthIdent; |
| 50 uintptr_t PortablePluginInterface::kWriteIdent; | 50 uintptr_t PortablePluginInterface::kWriteIdent; |
| 51 | 51 |
| 52 uint8_t const PortablePluginInterface::kInvalidAbiVersion = UINT8_MAX; | 52 uint8_t const PortablePluginInterface::kInvalidAbiVersion = UINT8_MAX; |
| 53 | 53 |
| 54 // TODO(gregoryd): make sure that calls to AddMethodToMap use the same strings | 54 // TODO(gregoryd): make sure that calls to AddMethodToMap use the same strings |
| 55 // move the strings to a header file. | 55 // move the strings to a header file. |
| 56 void PortablePluginInterface::InitializeIdentifiers() { | 56 void PortablePluginInterface::InitializeIdentifiers() { |
| 57 if (!identifiers_initialized) { | 57 if (!identifiers_initialized) { |
| 58 kConnectIdent = GetStrIdentifierCallback("connect"); | 58 kConnectIdent = GetStrIdentifierCallback("connect"); |
| 59 kHeightIdent = GetStrIdentifierCallback("height"); | 59 kHeightIdent = GetStrIdentifierCallback("height"); |
| 60 kHrefIdent = GetStrIdentifierCallback("href"); | 60 kHrefIdent = GetStrIdentifierCallback("href"); |
| 61 kLengthIdent = GetStrIdentifierCallback("length"); | 61 kLengthIdent = GetStrIdentifierCallback("length"); |
| 62 kLocationIdent = GetStrIdentifierCallback("location"); | 62 kLocationIdent = GetStrIdentifierCallback("location"); |
| 63 kMapIdent = GetStrIdentifierCallback("map"); | 63 kMapIdent = GetStrIdentifierCallback("map"); |
| 64 kModuleReadyIdent = GetStrIdentifierCallback("__moduleReady"); | 64 kModuleReadyIdent = GetStrIdentifierCallback("__moduleReady"); |
| 65 kNaClMultimediaBridgeIdent = | 65 kNaClMultimediaBridgeIdent = |
| 66 GetStrIdentifierCallback("nacl_multimedia_bridge"); | 66 GetStrIdentifierCallback("nacl_multimedia_bridge"); |
| 67 kNullNpapiMethodIdent = GetStrIdentifierCallback("__nullNpapiMethod"); | 67 kNullNpapiMethodIdent = GetStrIdentifierCallback("__nullNpapiMethod"); |
| 68 kOnfailIdent = GetStrIdentifierCallback("onfail"); | 68 kOnfailIdent = GetStrIdentifierCallback("onfail"); |
| 69 kOnloadIdent = GetStrIdentifierCallback("onload"); | 69 kOnloadIdent = GetStrIdentifierCallback("onload"); |
| 70 kNexeIdent = GetStrIdentifierCallback("nexe"); |
| 70 kReadIdent = GetStrIdentifierCallback("read"); | 71 kReadIdent = GetStrIdentifierCallback("read"); |
| 71 kSetCommandLogIdent = GetStrIdentifierCallback("__setCommandLog"); | 72 kSetCommandLogIdent = GetStrIdentifierCallback("__setCommandLog"); |
| 72 kShmFactoryIdent = GetStrIdentifierCallback("__shmFactory"); | 73 kShmFactoryIdent = GetStrIdentifierCallback("__shmFactory"); |
| 73 kSignaturesIdent = GetStrIdentifierCallback("__signatures"); | 74 kSignaturesIdent = GetStrIdentifierCallback("__signatures"); |
| 74 kSrcIdent = GetStrIdentifierCallback("src"); | |
| 75 kToStringIdent = GetStrIdentifierCallback("toString"); | 75 kToStringIdent = GetStrIdentifierCallback("toString"); |
| 76 kUrlAsNaClDescIdent = GetStrIdentifierCallback("__urlAsNaClDesc"); | 76 kUrlAsNaClDescIdent = GetStrIdentifierCallback("__urlAsNaClDesc"); |
| 77 kValueOfIdent = GetStrIdentifierCallback("valueOf"); | 77 kValueOfIdent = GetStrIdentifierCallback("valueOf"); |
| 78 kVideoUpdateModeIdent = GetStrIdentifierCallback("videoUpdateMode"); | 78 kVideoUpdateModeIdent = GetStrIdentifierCallback("videoUpdateMode"); |
| 79 kWidthIdent = GetStrIdentifierCallback("width"); | 79 kWidthIdent = GetStrIdentifierCallback("width"); |
| 80 kWriteIdent = GetStrIdentifierCallback("write"); | 80 kWriteIdent = GetStrIdentifierCallback("write"); |
| 81 | 81 |
| 82 identifiers_initialized = true; | 82 identifiers_initialized = true; |
| 83 } | 83 } |
| 84 } | 84 } |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 | 336 |
| 337 char *PortablePluginInterface::MemAllocStrdup(const char *str) { | 337 char *PortablePluginInterface::MemAllocStrdup(const char *str) { |
| 338 size_t lenz = strlen(str) + 1; | 338 size_t lenz = strlen(str) + 1; |
| 339 char *dup = static_cast<char *>(malloc(lenz)); | 339 char *dup = static_cast<char *>(malloc(lenz)); |
| 340 if (NULL != dup) { | 340 if (NULL != dup) { |
| 341 strncpy(dup, str, lenz); | 341 strncpy(dup, str, lenz); |
| 342 } | 342 } |
| 343 // else abort(); | 343 // else abort(); |
| 344 return dup; | 344 return dup; |
| 345 } | 345 } |
| OLD | NEW |