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

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/real_pepper_interface.cc

Issue 12194030: Rename mount (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix whitespace Created 7 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 | Annotate | Revision Log
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 5
6 #include "nacl_mounts/real_pepper_interface.h" 6 #include "nacl_io/real_pepper_interface.h"
7 #include <assert.h> 7 #include <assert.h>
8 #include <stdio.h> 8 #include <stdio.h>
9 9
10 #include <ppapi/c/pp_errors.h> 10 #include <ppapi/c/pp_errors.h>
11 11
12 12
13 #include "nacl_mounts/pepper/undef_macros.h" 13 #include "nacl_io/pepper/undef_macros.h"
14 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \ 14 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
15 class Real##BaseClass : public BaseClass { \ 15 class Real##BaseClass : public BaseClass { \
16 public: \ 16 public: \
17 explicit Real##BaseClass(const PPInterface* interface); 17 explicit Real##BaseClass(const PPInterface* interface);
18 #define END_INTERFACE(BaseClass, PPInterface) \ 18 #define END_INTERFACE(BaseClass, PPInterface) \
19 private: \ 19 private: \
20 const PPInterface* interface_; \ 20 const PPInterface* interface_; \
21 }; 21 };
22 #define METHOD1(Class, ReturnType, MethodName, Type0) \ 22 #define METHOD1(Class, ReturnType, MethodName, Type0) \
23 virtual ReturnType MethodName(Type0); 23 virtual ReturnType MethodName(Type0);
24 #define METHOD2(Class, ReturnType, MethodName, Type0, Type1) \ 24 #define METHOD2(Class, ReturnType, MethodName, Type0, Type1) \
25 virtual ReturnType MethodName(Type0, Type1); 25 virtual ReturnType MethodName(Type0, Type1);
26 #define METHOD3(Class, ReturnType, MethodName, Type0, Type1, Type2) \ 26 #define METHOD3(Class, ReturnType, MethodName, Type0, Type1, Type2) \
27 virtual ReturnType MethodName(Type0, Type1, Type2); 27 virtual ReturnType MethodName(Type0, Type1, Type2);
28 #define METHOD4(Class, ReturnType, MethodName, Type0, Type1, Type2, Type3) \ 28 #define METHOD4(Class, ReturnType, MethodName, Type0, Type1, Type2, Type3) \
29 virtual ReturnType MethodName(Type0, Type1, Type2, Type3); 29 virtual ReturnType MethodName(Type0, Type1, Type2, Type3);
30 #define METHOD5(Class, ReturnType, MethodName, Type0, Type1, Type2, Type3, \ 30 #define METHOD5(Class, ReturnType, MethodName, Type0, Type1, Type2, Type3, \
31 Type4) \ 31 Type4) \
32 virtual ReturnType MethodName(Type0, Type1, Type2, Type3, Type4); 32 virtual ReturnType MethodName(Type0, Type1, Type2, Type3, Type4);
33 #include "nacl_mounts/pepper/all_interfaces.h" 33 #include "nacl_io/pepper/all_interfaces.h"
34 34
35 35
36 #include "nacl_mounts/pepper/undef_macros.h" 36 #include "nacl_io/pepper/undef_macros.h"
37 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \ 37 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
38 Real##BaseClass::Real##BaseClass(const PPInterface* interface) \ 38 Real##BaseClass::Real##BaseClass(const PPInterface* interface) \
39 : interface_(interface) {} 39 : interface_(interface) {}
40 40
41 #define END_INTERFACE(BaseClass, PPInterface) 41 #define END_INTERFACE(BaseClass, PPInterface)
42 42
43 #define METHOD1(BaseClass, ReturnType, MethodName, Type0) \ 43 #define METHOD1(BaseClass, ReturnType, MethodName, Type0) \
44 ReturnType Real##BaseClass::MethodName(Type0 arg0) { \ 44 ReturnType Real##BaseClass::MethodName(Type0 arg0) { \
45 return interface_->MethodName(arg0); \ 45 return interface_->MethodName(arg0); \
46 } 46 }
(...skipping 10 matching lines...) Expand all
57 ReturnType Real##BaseClass::MethodName(Type0 arg0, Type1 arg1, Type2 arg2, \ 57 ReturnType Real##BaseClass::MethodName(Type0 arg0, Type1 arg1, Type2 arg2, \
58 Type3 arg3) { \ 58 Type3 arg3) { \
59 return interface_->MethodName(arg0, arg1, arg2, arg3); \ 59 return interface_->MethodName(arg0, arg1, arg2, arg3); \
60 } 60 }
61 #define METHOD5(BaseClass, ReturnType, MethodName, Type0, Type1, Type2, Type3, \ 61 #define METHOD5(BaseClass, ReturnType, MethodName, Type0, Type1, Type2, Type3, \
62 Type4) \ 62 Type4) \
63 ReturnType Real##BaseClass::MethodName(Type0 arg0, Type1 arg1, Type2 arg2, \ 63 ReturnType Real##BaseClass::MethodName(Type0 arg0, Type1 arg1, Type2 arg2, \
64 Type3 arg3, Type4 arg4) { \ 64 Type3 arg3, Type4 arg4) { \
65 return interface_->MethodName(arg0, arg1, arg2, arg3, arg4); \ 65 return interface_->MethodName(arg0, arg1, arg2, arg3, arg4); \
66 } 66 }
67 #include "nacl_mounts/pepper/all_interfaces.h" 67 #include "nacl_io/pepper/all_interfaces.h"
68 68
69 69
70 RealPepperInterface::RealPepperInterface(PP_Instance instance, 70 RealPepperInterface::RealPepperInterface(PP_Instance instance,
71 PPB_GetInterface get_browser_interface) 71 PPB_GetInterface get_browser_interface)
72 : instance_(instance), 72 : instance_(instance),
73 core_interface_(NULL), 73 core_interface_(NULL),
74 message_loop_interface_(NULL) { 74 message_loop_interface_(NULL) {
75 75
76 core_interface_ = static_cast<const PPB_Core*>( 76 core_interface_ = static_cast<const PPB_Core*>(
77 get_browser_interface(PPB_CORE_INTERFACE)); 77 get_browser_interface(PPB_CORE_INTERFACE));
78 message_loop_interface_ = static_cast<const PPB_MessageLoop*>( 78 message_loop_interface_ = static_cast<const PPB_MessageLoop*>(
79 get_browser_interface(PPB_MESSAGELOOP_INTERFACE)); 79 get_browser_interface(PPB_MESSAGELOOP_INTERFACE));
80 assert(core_interface_); 80 assert(core_interface_);
81 assert(message_loop_interface_); 81 assert(message_loop_interface_);
82 82
83 #include "nacl_mounts/pepper/undef_macros.h" 83 #include "nacl_io/pepper/undef_macros.h"
84 #include "nacl_mounts/pepper/define_empty_macros.h" 84 #include "nacl_io/pepper/define_empty_macros.h"
85 #undef BEGIN_INTERFACE 85 #undef BEGIN_INTERFACE
86 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \ 86 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
87 BaseClass##interface_ = new Real##BaseClass( \ 87 BaseClass##interface_ = new Real##BaseClass( \
88 static_cast<const PPInterface*>( \ 88 static_cast<const PPInterface*>( \
89 get_browser_interface(InterfaceString))); 89 get_browser_interface(InterfaceString)));
90 #include "nacl_mounts/pepper/all_interfaces.h" 90 #include "nacl_io/pepper/all_interfaces.h"
91 } 91 }
92 92
93 PP_Instance RealPepperInterface::GetInstance() { 93 PP_Instance RealPepperInterface::GetInstance() {
94 return instance_; 94 return instance_;
95 } 95 }
96 96
97 void RealPepperInterface::AddRefResource(PP_Resource resource) { 97 void RealPepperInterface::AddRefResource(PP_Resource resource) {
98 if (resource) 98 if (resource)
99 core_interface_->AddRefResource(resource); 99 core_interface_->AddRefResource(resource);
100 } 100 }
101 101
102 void RealPepperInterface::ReleaseResource(PP_Resource resource) { 102 void RealPepperInterface::ReleaseResource(PP_Resource resource) {
103 if (resource) 103 if (resource)
104 core_interface_->ReleaseResource(resource); 104 core_interface_->ReleaseResource(resource);
105 } 105 }
106 106
107 // Define getter function. 107 // Define getter function.
108 #include "nacl_mounts/pepper/undef_macros.h" 108 #include "nacl_io/pepper/undef_macros.h"
109 #include "nacl_mounts/pepper/define_empty_macros.h" 109 #include "nacl_io/pepper/define_empty_macros.h"
110 #undef BEGIN_INTERFACE 110 #undef BEGIN_INTERFACE
111 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \ 111 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
112 BaseClass* RealPepperInterface::Get##BaseClass() { \ 112 BaseClass* RealPepperInterface::Get##BaseClass() { \
113 return BaseClass##interface_; \ 113 return BaseClass##interface_; \
114 } 114 }
115 #include "nacl_mounts/pepper/all_interfaces.h" 115 #include "nacl_io/pepper/all_interfaces.h"
116 116
117 117
118 int32_t RealPepperInterface::InitializeMessageLoop() { 118 int32_t RealPepperInterface::InitializeMessageLoop() {
119 int32_t result; 119 int32_t result;
120 PP_Resource message_loop = 0; 120 PP_Resource message_loop = 0;
121 if (core_interface_->IsMainThread()) { 121 if (core_interface_->IsMainThread()) {
122 // TODO(binji): Spin up the main thread's ppapi work thread. 122 // TODO(binji): Spin up the main thread's ppapi work thread.
123 assert(0); 123 assert(0);
124 } else { 124 } else {
125 message_loop = message_loop_interface_->GetCurrent(); 125 message_loop = message_loop_interface_->GetCurrent();
126 if (!message_loop) { 126 if (!message_loop) {
127 message_loop = message_loop_interface_->Create(instance_); 127 message_loop = message_loop_interface_->Create(instance_);
128 result = message_loop_interface_->AttachToCurrentThread(message_loop); 128 result = message_loop_interface_->AttachToCurrentThread(message_loop);
129 assert(result == PP_OK); 129 assert(result == PP_OK);
130 } 130 }
131 } 131 }
132 132
133 return PP_OK; 133 return PP_OK;
134 } 134 }
OLDNEW
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/real_pepper_interface.h ('k') | native_client_sdk/src/libraries/nacl_io_test/Makefile » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698