Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: ppapi/shared_impl/ppb_memory_shared.cc

Issue 174213003: PPAPI: Use clang-format on ppapi/shared_impl (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: remove DEPS Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ppapi/shared_impl/ppb_instance_shared.cc ('k') | ppapi/shared_impl/ppb_message_loop_shared.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stdlib.h> 5 #include <stdlib.h>
6 6
7 #include "ppapi/c/dev/ppb_memory_dev.h" 7 #include "ppapi/c/dev/ppb_memory_dev.h"
8 #include "ppapi/shared_impl/ppapi_shared_export.h" 8 #include "ppapi/shared_impl/ppapi_shared_export.h"
9 9
10 // The memory interface doesn't have a normal C -> C++ thunk since it doesn't 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 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 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. 13 // namespace so it magically gets hooked up in the proper places.
14 14
15 namespace ppapi { 15 namespace ppapi {
16 16
17 namespace { 17 namespace {
18 18
19 void* MemAlloc(uint32_t num_bytes) { 19 void* MemAlloc(uint32_t num_bytes) { return malloc(num_bytes); }
20 return malloc(num_bytes);
21 }
22 20
23 void MemFree(void* ptr) { 21 void MemFree(void* ptr) { free(ptr); }
24 free(ptr);
25 }
26 22
27 const PPB_Memory_Dev ppb_memory = { 23 const PPB_Memory_Dev ppb_memory = {&MemAlloc, &MemFree};
28 &MemAlloc,
29 &MemFree
30 };
31 24
32 } // namespace 25 } // namespace
33 26
34 namespace thunk { 27 namespace thunk {
35 28
36 // static 29 // static
37 PPAPI_SHARED_EXPORT const PPB_Memory_Dev_0_1* GetPPB_Memory_Dev_0_1_Thunk() { 30 PPAPI_SHARED_EXPORT const PPB_Memory_Dev_0_1* GetPPB_Memory_Dev_0_1_Thunk() {
38 return &ppb_memory; 31 return &ppb_memory;
39 } 32 }
40 33
41 } // namespace thunk 34 } // namespace thunk
42 35
43 } // namespace ppapi 36 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/ppb_instance_shared.cc ('k') | ppapi/shared_impl/ppb_message_loop_shared.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698