Ben Murdoch | ca12bfa | 2013-07-23 11:17:05 +0100 | [diff] [blame] | 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. |
| 4 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 5 | |
| 6 | /* Given an interface like this: |
| 7 | * |
| 8 | * struct PPB_Frob { |
| 9 | * void (*Flange)(int32_t param1, char* param2); |
| 10 | * int32_t (*Shlep)(PP_CompletionCallback); |
| 11 | * }; |
| 12 | * |
| 13 | * Write a set of macros like this: |
| 14 | * |
| 15 | * BEGIN_INTERFACE(FrobInterface, PPB_Frob, PPB_FROB_INTERFACE) |
| 16 | * METHOD2(FrobInterface, void, Flange, int32_t, char*) |
| 17 | * METHOD1(FrobInterface, int32_t, Shlep, PP_CompletionCallback) |
| 18 | * END_INTERFACE(FrobInterface, PPB_Frob) |
| 19 | */ |
| 20 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 21 | BEGIN_INTERFACE(ConsoleInterface, PPB_Console, PPB_CONSOLE_INTERFACE_1_0) |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 22 | METHOD3(ConsoleInterface, void, Log, PP_Instance, PP_LogLevel, struct PP_Var) |
| 23 | END_INTERFACE(ConsoleInterface, PPB_Console) |
| 24 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 25 | BEGIN_INTERFACE(FileIoInterface, PPB_FileIO, PPB_FILEIO_INTERFACE_1_0) |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 26 | METHOD1(FileIoInterface, void, Close, PP_Resource) |
| 27 | METHOD1(FileIoInterface, PP_Resource, Create, PP_Resource) |
| 28 | METHOD2(FileIoInterface, int32_t, Flush, PP_Resource, |
| 29 | PP_CompletionCallback) |
| 30 | METHOD4(FileIoInterface, int32_t, Open, PP_Resource, PP_Resource, int32_t, |
| 31 | PP_CompletionCallback) |
| 32 | METHOD3(FileIoInterface, int32_t, Query, PP_Resource, PP_FileInfo*, |
| 33 | PP_CompletionCallback) |
| 34 | METHOD5(FileIoInterface, int32_t, Read, PP_Resource, int64_t, char*, |
| 35 | int32_t, PP_CompletionCallback) |
| 36 | METHOD3(FileIoInterface, int32_t, SetLength, PP_Resource, int64_t, |
| 37 | PP_CompletionCallback) |
| 38 | METHOD5(FileIoInterface, int32_t, Write, PP_Resource, int64_t, |
| 39 | const char*, int32_t, PP_CompletionCallback) |
| 40 | END_INTERFACE(FileIoInterface, PPB_FileIO) |
| 41 | |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 42 | BEGIN_INTERFACE(FileRefInterface, PPB_FileRef, PPB_FILEREF_INTERFACE_1_1) |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 43 | METHOD2(FileRefInterface, PP_Resource, Create, PP_Resource, const char*) |
| 44 | METHOD2(FileRefInterface, int32_t, Delete, PP_Resource, PP_CompletionCallback) |
| 45 | METHOD1(FileRefInterface, PP_Var, GetName, PP_Resource) |
| 46 | METHOD3(FileRefInterface, int32_t, MakeDirectory, PP_Resource, PP_Bool, |
| 47 | PP_CompletionCallback) |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 48 | METHOD3(FileRefInterface, int32_t, Query, PP_Resource, PP_FileInfo*, |
| 49 | PP_CompletionCallback) |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 50 | METHOD3(FileRefInterface, int32_t, ReadDirectoryEntries, PP_Resource, |
| 51 | const PP_ArrayOutput&, PP_CompletionCallback) |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 52 | END_INTERFACE(FileRefInterface, PPB_FileRef) |
| 53 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 54 | BEGIN_INTERFACE(FileSystemInterface, PPB_FileSystem, |
| 55 | PPB_FILESYSTEM_INTERFACE_1_0) |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 56 | METHOD2(FileSystemInterface, PP_Resource, Create, PP_Instance, |
| 57 | PP_FileSystemType) |
| 58 | METHOD3(FileSystemInterface, int32_t, Open, PP_Resource, int64_t, |
| 59 | PP_CompletionCallback) |
| 60 | END_INTERFACE(FileSystemInterface, PPB_FileSystem) |
| 61 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 62 | BEGIN_INTERFACE(MessagingInterface, PPB_Messaging, PPB_MESSAGING_INTERFACE_1_0) |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 63 | METHOD2(MessagingInterface, void, PostMessage, PP_Instance, struct PP_Var) |
| 64 | END_INTERFACE(MessagingInterface, PPB_Messaging) |
| 65 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 66 | BEGIN_INTERFACE(VarInterface, PPB_Var, PPB_VAR_INTERFACE_1_1) |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 67 | METHOD2(VarInterface, struct PP_Var, VarFromUtf8, const char *, uint32_t) |
| 68 | METHOD2(VarInterface, const char*, VarToUtf8, PP_Var, uint32_t*) |
| 69 | END_INTERFACE(VarInterface, PPB_Var) |
| 70 | |
Ben Murdoch | bb1529c | 2013-08-08 10:24:53 +0100 | [diff] [blame^] | 71 | BEGIN_INTERFACE(HostResolverInterface, PPB_HostResolver, |
| 72 | PPB_HOSTRESOLVER_INTERFACE_1_0) |
| 73 | METHOD1(HostResolverInterface, PP_Resource, Create, PP_Instance) |
| 74 | METHOD5(HostResolverInterface, int32_t, Resolve, PP_Resource, const char*, |
| 75 | uint16_t, const struct PP_HostResolver_Hint*, |
| 76 | struct PP_CompletionCallback) |
| 77 | METHOD1(HostResolverInterface, PP_Var, GetCanonicalName, PP_Resource) |
| 78 | METHOD1(HostResolverInterface, uint32_t, GetNetAddressCount, PP_Resource) |
| 79 | METHOD2(HostResolverInterface, PP_Resource, GetNetAddress, |
| 80 | PP_Resource, uint32_t) |
| 81 | END_INTERFACE(HostResolverInterface, PPB_HostResolver) |
| 82 | |
| 83 | BEGIN_INTERFACE(NetAddressInterface, PPB_NetAddress, |
| 84 | PPB_NETADDRESS_INTERFACE_1_0) |
| 85 | METHOD1(NetAddressInterface, PP_Bool, IsNetAddress, PP_Resource) |
| 86 | METHOD1(NetAddressInterface, PP_NetAddress_Family, GetFamily, PP_Resource) |
| 87 | METHOD2(NetAddressInterface, PP_Bool, DescribeAsIPv4Address, PP_Resource, |
| 88 | struct PP_NetAddress_IPv4*) |
| 89 | METHOD2(NetAddressInterface, PP_Bool, DescribeAsIPv6Address, PP_Resource, |
| 90 | struct PP_NetAddress_IPv6*) |
| 91 | END_INTERFACE(NetAddressInterface, PPB_NetAddress) |
| 92 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 93 | BEGIN_INTERFACE(URLLoaderInterface, PPB_URLLoader, PPB_URLLOADER_INTERFACE_1_0) |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 94 | METHOD1(URLLoaderInterface, PP_Resource, Create, PP_Instance) |
| 95 | METHOD3(URLLoaderInterface, int32_t, Open, PP_Resource, PP_Resource, |
| 96 | PP_CompletionCallback) |
| 97 | METHOD1(URLLoaderInterface, PP_Resource, GetResponseInfo, PP_Resource) |
| 98 | METHOD4(URLLoaderInterface, int32_t, ReadResponseBody, PP_Resource, void*, |
| 99 | int32_t, PP_CompletionCallback) |
| 100 | METHOD1(URLLoaderInterface, void, Close, PP_Resource) |
| 101 | END_INTERFACE(URLLoaderInterface, PPB_URLLoader) |
| 102 | |
| 103 | BEGIN_INTERFACE(URLRequestInfoInterface, PPB_URLRequestInfo, |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 104 | PPB_URLREQUESTINFO_INTERFACE_1_0) |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 105 | METHOD1(URLRequestInfoInterface, PP_Resource, Create, PP_Instance) |
| 106 | METHOD3(URLRequestInfoInterface, PP_Bool, SetProperty, PP_Resource, |
| 107 | PP_URLRequestProperty, PP_Var) |
| 108 | END_INTERFACE(URLRequestInfoInterface, PPB_URLRequestInfo) |
| 109 | |
| 110 | BEGIN_INTERFACE(URLResponseInfoInterface, PPB_URLResponseInfo, |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 111 | PPB_URLRESPONSEINFO_INTERFACE_1_0) |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 112 | METHOD2(URLResponseInfoInterface, PP_Var, GetProperty, PP_Resource, |
| 113 | PP_URLResponseProperty) |
| 114 | END_INTERFACE(URLResponseInfoInterface, PPB_URLResponseInfo) |