| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "native_client/src/shared/ppapi_proxy/plugin_ppb_var.h" | 5 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_var.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 return PP_TRUE; | 111 return PP_TRUE; |
| 112 } | 112 } |
| 113 return PP_FALSE; | 113 return PP_FALSE; |
| 114 } | 114 } |
| 115 | 115 |
| 116 void* Map(PP_Var var) { | 116 void* Map(PP_Var var) { |
| 117 DebugPrintf("PPB_VarArrayBuffer::Map: var=PPB_Var(%s)\n", | 117 DebugPrintf("PPB_VarArrayBuffer::Map: var=PPB_Var(%s)\n", |
| 118 PluginVar::DebugString(var).c_str()); | 118 PluginVar::DebugString(var).c_str()); |
| 119 SharedArrayBufferProxyVar buffer_var = ArrayBufferProxyVar::CastFromProxyVar( | 119 SharedArrayBufferProxyVar buffer_var = ArrayBufferProxyVar::CastFromProxyVar( |
| 120 ProxyVarCache::GetInstance().SharedProxyVarForVar(var)); | 120 ProxyVarCache::GetInstance().SharedProxyVarForVar(var)); |
| 121 if (!buffer_var) |
| 122 return NULL; |
| 121 void* data = buffer_var->buffer(); | 123 void* data = buffer_var->buffer(); |
| 122 DebugPrintf("PPB_VarArrayBuffer::Map: buffer=%p\n", data); | 124 DebugPrintf("PPB_VarArrayBuffer::Map: buffer=%p\n", data); |
| 123 return data; | 125 return data; |
| 124 } | 126 } |
| 125 | 127 |
| 126 void Unmap(PP_Var var) { | 128 void Unmap(PP_Var var) { |
| 127 DebugPrintf("PPB_VarArrayBuffer::Unap: var=PPB_Var(%s)\n", | 129 DebugPrintf("PPB_VarArrayBuffer::Unap: var=PPB_Var(%s)\n", |
| 128 PluginVar::DebugString(var).c_str()); | 130 PluginVar::DebugString(var).c_str()); |
| 129 // We don't use shared memory, so there's nothing to do. | 131 // We don't use shared memory, so there's nothing to do. |
| 130 } | 132 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 144 const PPB_Var_1_0* PluginVar::GetInterface1_0() { | 146 const PPB_Var_1_0* PluginVar::GetInterface1_0() { |
| 145 static const PPB_Var_1_0 var_interface = { | 147 static const PPB_Var_1_0 var_interface = { |
| 146 AddRef, | 148 AddRef, |
| 147 Release, | 149 Release, |
| 148 VarFromUtf8_1_0, | 150 VarFromUtf8_1_0, |
| 149 VarToUtf8 | 151 VarToUtf8 |
| 150 }; | 152 }; |
| 151 return &var_interface; | 153 return &var_interface; |
| 152 } | 154 } |
| 153 | 155 |
| 154 const PPB_VarArrayBuffer_Dev* PluginVar::GetArrayBufferInterface() { | 156 const PPB_VarArrayBuffer* PluginVar::GetArrayBufferInterface() { |
| 155 static const PPB_VarArrayBuffer_Dev interface = { | 157 static const PPB_VarArrayBuffer interface = { |
| 156 CreateArrayBuffer, | 158 CreateArrayBuffer, |
| 157 ByteLength, | 159 ByteLength, |
| 158 Map, | 160 Map, |
| 159 Unmap | 161 Unmap |
| 160 }; | 162 }; |
| 161 return &interface; | 163 return &interface; |
| 162 } | 164 } |
| 163 | 165 |
| 164 std::string PluginVar::DebugString(const PP_Var& var) { | 166 std::string PluginVar::DebugString(const PP_Var& var) { |
| 165 switch (var.type) { | 167 switch (var.type) { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 case PP_VARTYPE_ARRAY_BUFFER: | 270 case PP_VARTYPE_ARRAY_BUFFER: |
| 269 DebugPrintf("PP_Var(object: %"NACL_PRIu64")", GetVarId(var)); | 271 DebugPrintf("PP_Var(object: %"NACL_PRIu64")", GetVarId(var)); |
| 270 break; | 272 break; |
| 271 case PP_VARTYPE_ARRAY: | 273 case PP_VARTYPE_ARRAY: |
| 272 case PP_VARTYPE_DICTIONARY: | 274 case PP_VARTYPE_DICTIONARY: |
| 273 break; | 275 break; |
| 274 } | 276 } |
| 275 } | 277 } |
| 276 | 278 |
| 277 } // namespace ppapi_proxy | 279 } // namespace ppapi_proxy |
| OLD | NEW |