Fix race in WebRTC logging.
[chromium-blink-merge.git] / ppapi / shared_impl / ppb_memory_shared.cc
blobaaf5f368126e3c33f03e7d9ef71246f2735f8310
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
3 // found in the LICENSE file.
5 #include <stdlib.h>
7 #include "ppapi/c/dev/ppb_memory_dev.h"
8 #include "ppapi/shared_impl/ppapi_shared_export.h"
10 // The memory interface doesn't have a normal C -> C++ thunk since it doesn't
11 // actually have any proxy wrapping or associated objects; it's just a call
12 // into base. So we implement the entire interface here, using the thunk
13 // namespace so it magically gets hooked up in the proper places.
15 namespace ppapi {
17 namespace {
19 void* MemAlloc(uint32_t num_bytes) { return malloc(num_bytes); }
21 void MemFree(void* ptr) { free(ptr); }
23 const PPB_Memory_Dev ppb_memory = {&MemAlloc, &MemFree};
25 } // namespace
27 namespace thunk {
29 // static
30 PPAPI_SHARED_EXPORT const PPB_Memory_Dev_0_1* GetPPB_Memory_Dev_0_1_Thunk() {
31 return &ppb_memory;
34 } // namespace thunk
36 } // namespace ppapi