OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_memory.h" |
| 6 |
| 7 #include <cstdlib> |
| 8 |
| 9 #include "native_client/src/include/portability.h" |
| 10 #include "native_client/src/shared/ppapi_proxy/utility.h" |
| 11 #include "ppapi/c/dev/ppb_memory_dev.h" |
| 12 |
| 13 namespace ppapi_proxy { |
| 14 |
| 15 namespace { |
| 16 |
| 17 void* MemAlloc(uint32_t num_bytes) { |
| 18 DebugPrintf("PPB_Memory_Dev::MemAlloc(%"NACL_PRIu32")\n", num_bytes); |
| 19 return std::malloc(num_bytes); |
| 20 } |
| 21 |
| 22 void MemFree(void* ptr) { |
| 23 DebugPrintf("PPB_Memory_Dev::MemFree(%p)\n", ptr); |
| 24 std::free(ptr); |
| 25 } |
| 26 |
| 27 } // namespace |
| 28 |
| 29 const PPB_Memory_Dev* PluginMemory::GetInterface() { |
| 30 static const PPB_Memory_Dev memory_interface = { |
| 31 MemAlloc, |
| 32 MemFree |
| 33 }; |
| 34 return &memory_interface; |
| 35 } |
| 36 |
| 37 } // namespace ppapi_proxy |
OLD | NEW |