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

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/pepper_interface.h

Issue 13998024: [NaCl SDK] nacl_io: fix warning of macro redefinition on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | native_client_sdk/src/libraries/nacl_io/real_pepper_interface.h » ('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 #ifndef LIBRARIES_NACL_IO_PEPPER_INTERFACE_H_ 5 #ifndef LIBRARIES_NACL_IO_PEPPER_INTERFACE_H_
6 #define LIBRARIES_NACL_IO_PEPPER_INTERFACE_H_ 6 #define LIBRARIES_NACL_IO_PEPPER_INTERFACE_H_
7 7
8 #include <ppapi/c/dev/ppb_directory_reader_dev.h> 8 #include <ppapi/c/dev/ppb_directory_reader_dev.h>
9 #include <ppapi/c/pp_completion_callback.h> 9 #include <ppapi/c/pp_completion_callback.h>
10 #include <ppapi/c/pp_file_info.h> 10 #include <ppapi/c/pp_file_info.h>
(...skipping 15 matching lines...) Expand all
26 26
27 // Note: To add a new interface: 27 // Note: To add a new interface:
28 // 28 //
29 // 1. Using one of the other interfaces as a template, add your interface to 29 // 1. Using one of the other interfaces as a template, add your interface to
30 // all_interfaces.h. 30 // all_interfaces.h.
31 // 2. Add the necessary pepper header to the top of this file. 31 // 2. Add the necessary pepper header to the top of this file.
32 // 3. Compile and cross your fingers! 32 // 3. Compile and cross your fingers!
33 33
34 34
35 // Forward declare interface classes. 35 // Forward declare interface classes.
36 #include "nacl_io/pepper/undef_macros.h"
36 #include "nacl_io/pepper/define_empty_macros.h" 37 #include "nacl_io/pepper/define_empty_macros.h"
37 #undef BEGIN_INTERFACE 38 #undef BEGIN_INTERFACE
38 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \ 39 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
39 class BaseClass; 40 class BaseClass;
40 #include "nacl_io/pepper/all_interfaces.h" 41 #include "nacl_io/pepper/all_interfaces.h"
41 #include "nacl_io/pepper/undef_macros.h"
42 42
43 int PPErrorToErrno(int32_t err); 43 int PPErrorToErrno(int32_t err);
44 44
45 class PepperInterface { 45 class PepperInterface {
46 public: 46 public:
47 virtual ~PepperInterface() {} 47 virtual ~PepperInterface() {}
48 virtual PP_Instance GetInstance() = 0; 48 virtual PP_Instance GetInstance() = 0;
49 virtual void AddRefResource(PP_Resource) = 0; 49 virtual void AddRefResource(PP_Resource) = 0;
50 virtual void ReleaseResource(PP_Resource) = 0; 50 virtual void ReleaseResource(PP_Resource) = 0;
51 51
52 // Interface getters. 52 // Interface getters.
53 #include "nacl_io/pepper/undef_macros.h"
53 #include "nacl_io/pepper/define_empty_macros.h" 54 #include "nacl_io/pepper/define_empty_macros.h"
54 #undef BEGIN_INTERFACE 55 #undef BEGIN_INTERFACE
55 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \ 56 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
56 virtual BaseClass* Get##BaseClass() = 0; 57 virtual BaseClass* Get##BaseClass() = 0;
57 #include "nacl_io/pepper/all_interfaces.h" 58 #include "nacl_io/pepper/all_interfaces.h"
58 #include "nacl_io/pepper/undef_macros.h"
59 }; 59 };
60 60
61 // Interface class definitions. 61 // Interface class definitions.
62 #include "nacl_io/pepper/undef_macros.h"
62 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \ 63 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
63 class BaseClass { \ 64 class BaseClass { \
64 public: \ 65 public: \
65 virtual ~BaseClass() {} 66 virtual ~BaseClass() {}
66 #define END_INTERFACE(BaseClass, PPInterface) \ 67 #define END_INTERFACE(BaseClass, PPInterface) \
67 }; 68 };
68 #define METHOD1(Class, ReturnType, MethodName, Type0) \ 69 #define METHOD1(Class, ReturnType, MethodName, Type0) \
69 virtual ReturnType MethodName(Type0) = 0; 70 virtual ReturnType MethodName(Type0) = 0;
70 #define METHOD2(Class, ReturnType, MethodName, Type0, Type1) \ 71 #define METHOD2(Class, ReturnType, MethodName, Type0, Type1) \
71 virtual ReturnType MethodName(Type0, Type1) = 0; 72 virtual ReturnType MethodName(Type0, Type1) = 0;
72 #define METHOD3(Class, ReturnType, MethodName, Type0, Type1, Type2) \ 73 #define METHOD3(Class, ReturnType, MethodName, Type0, Type1, Type2) \
73 virtual ReturnType MethodName(Type0, Type1, Type2) = 0; 74 virtual ReturnType MethodName(Type0, Type1, Type2) = 0;
74 #define METHOD4(Class, ReturnType, MethodName, Type0, Type1, Type2, Type3) \ 75 #define METHOD4(Class, ReturnType, MethodName, Type0, Type1, Type2, Type3) \
75 virtual ReturnType MethodName(Type0, Type1, Type2, Type3) = 0; 76 virtual ReturnType MethodName(Type0, Type1, Type2, Type3) = 0;
76 #define METHOD5(Class, ReturnType, MethodName, Type0, Type1, Type2, Type3, \ 77 #define METHOD5(Class, ReturnType, MethodName, Type0, Type1, Type2, Type3, \
77 Type4) \ 78 Type4) \
78 virtual ReturnType MethodName(Type0, Type1, Type2, Type3, Type4) = 0; 79 virtual ReturnType MethodName(Type0, Type1, Type2, Type3, Type4) = 0;
79 #include "nacl_io/pepper/all_interfaces.h" 80 #include "nacl_io/pepper/all_interfaces.h"
80 #include "nacl_io/pepper/undef_macros.h"
81 81
82 82
83 class ScopedResource { 83 class ScopedResource {
84 public: 84 public:
85 // Does not AddRef by default. 85 // Does not AddRef by default.
86 ScopedResource(PepperInterface* ppapi, PP_Resource resource); 86 ScopedResource(PepperInterface* ppapi, PP_Resource resource);
87 ~ScopedResource(); 87 ~ScopedResource();
88 88
89 PP_Resource pp_resource() { return resource_; } 89 PP_Resource pp_resource() { return resource_; }
90 90
91 // Return the resource without decrementing its refcount. 91 // Return the resource without decrementing its refcount.
92 PP_Resource Release(); 92 PP_Resource Release();
93 93
94 private: 94 private:
95 PepperInterface* ppapi_; 95 PepperInterface* ppapi_;
96 PP_Resource resource_; 96 PP_Resource resource_;
97 97
98 DISALLOW_COPY_AND_ASSIGN(ScopedResource); 98 DISALLOW_COPY_AND_ASSIGN(ScopedResource);
99 }; 99 };
100 100
101 #endif // LIBRARIES_NACL_IO_PEPPER_INTERFACE_H_ 101 #endif // LIBRARIES_NACL_IO_PEPPER_INTERFACE_H_
OLDNEW
« no previous file with comments | « no previous file | native_client_sdk/src/libraries/nacl_io/real_pepper_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698