OLD | NEW |
| (Empty) |
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 */ | |
5 #ifndef LIBRARIES_NACL_MOUNTS_PEPPER_INTERFACE_H_ | |
6 #define LIBRARIES_NACL_MOUNTS_PEPPER_INTERFACE_H_ | |
7 | |
8 #include <ppapi/c/dev/ppb_directory_reader_dev.h> | |
9 #include <ppapi/c/pp_completion_callback.h> | |
10 #include <ppapi/c/pp_file_info.h> | |
11 #include <ppapi/c/pp_instance.h> | |
12 #include <ppapi/c/pp_resource.h> | |
13 #include <ppapi/c/pp_var.h> | |
14 #include <ppapi/c/ppb_console.h> | |
15 #include <ppapi/c/ppb_file_io.h> | |
16 #include <ppapi/c/ppb_file_ref.h> | |
17 #include <ppapi/c/ppb_file_system.h> | |
18 #include <ppapi/c/ppb_messaging.h> | |
19 #include <ppapi/c/ppb_messaging.h> | |
20 #include <ppapi/c/ppb_url_loader.h> | |
21 #include <ppapi/c/ppb_url_request_info.h> | |
22 #include <ppapi/c/ppb_url_response_info.h> | |
23 #include <ppapi/c/ppb_var.h> | |
24 | |
25 #include <utils/macros.h> | |
26 | |
27 // Note: To add a new interface: | |
28 // | |
29 // 1. Using one of the other interfaces as a template, add your interface to | |
30 // all_interfaces.h. | |
31 // 2. Add the necessary pepper header to the top of this file. | |
32 // 3. Compile and cross your fingers! | |
33 | |
34 | |
35 // Forward declare interface classes. | |
36 #include "nacl_mounts/pepper/define_empty_macros.h" | |
37 #undef BEGIN_INTERFACE | |
38 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \ | |
39 class BaseClass; | |
40 #include "nacl_mounts/pepper/all_interfaces.h" | |
41 #include "nacl_mounts/pepper/undef_macros.h" | |
42 | |
43 int PPErrorToErrno(int32_t err); | |
44 | |
45 class PepperInterface { | |
46 public: | |
47 virtual ~PepperInterface() {} | |
48 virtual PP_Instance GetInstance() = 0; | |
49 virtual void AddRefResource(PP_Resource) = 0; | |
50 virtual void ReleaseResource(PP_Resource) = 0; | |
51 | |
52 // Interface getters. | |
53 #include "nacl_mounts/pepper/define_empty_macros.h" | |
54 #undef BEGIN_INTERFACE | |
55 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \ | |
56 virtual BaseClass* Get##BaseClass() = 0; | |
57 #include "nacl_mounts/pepper/all_interfaces.h" | |
58 #include "nacl_mounts/pepper/undef_macros.h" | |
59 }; | |
60 | |
61 // Interface class definitions. | |
62 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \ | |
63 class BaseClass { \ | |
64 public: \ | |
65 virtual ~BaseClass() {} | |
66 #define END_INTERFACE(BaseClass, PPInterface) \ | |
67 }; | |
68 #define METHOD1(Class, ReturnType, MethodName, Type0) \ | |
69 virtual ReturnType MethodName(Type0) = 0; | |
70 #define METHOD2(Class, ReturnType, MethodName, Type0, Type1) \ | |
71 virtual ReturnType MethodName(Type0, Type1) = 0; | |
72 #define METHOD3(Class, ReturnType, MethodName, Type0, Type1, Type2) \ | |
73 virtual ReturnType MethodName(Type0, Type1, Type2) = 0; | |
74 #define METHOD4(Class, ReturnType, MethodName, Type0, Type1, Type2, Type3) \ | |
75 virtual ReturnType MethodName(Type0, Type1, Type2, Type3) = 0; | |
76 #define METHOD5(Class, ReturnType, MethodName, Type0, Type1, Type2, Type3, \ | |
77 Type4) \ | |
78 virtual ReturnType MethodName(Type0, Type1, Type2, Type3, Type4) = 0; | |
79 #include "nacl_mounts/pepper/all_interfaces.h" | |
80 #include "nacl_mounts/pepper/undef_macros.h" | |
81 | |
82 | |
83 class ScopedResource { | |
84 public: | |
85 // Does not AddRef by default. | |
86 ScopedResource(PepperInterface* ppapi, PP_Resource resource); | |
87 ~ScopedResource(); | |
88 | |
89 PP_Resource pp_resource() { return resource_; } | |
90 | |
91 // Return the resource without decrementing its refcount. | |
92 PP_Resource Release(); | |
93 | |
94 private: | |
95 PepperInterface* ppapi_; | |
96 PP_Resource resource_; | |
97 | |
98 DISALLOW_COPY_AND_ASSIGN(ScopedResource); | |
99 }; | |
100 | |
101 #endif // LIBRARIES_NACL_MOUNTS_PEPPER_INTERFACE_H_ | |
OLD | NEW |