1 // Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
2 // reserved. Use of this source code is governed by a BSD-style license that
3 // can be found in the LICENSE file.
4 //
5 // ---------------------------------------------------------------------------
6 //
7 // This file was generated by the CEF translator tool. If making changes by
8 // hand only do so within the body of existing method and function
9 // implementations. See the translator.README.txt file in the tools directory
10 // for more information.
11 //
12 // $hash=fd651a7fef9dbbce9765c8200660c4057808e6cc$
13 //
14
15 #include "libcef_dll/cpptoc/v8interceptor_cpptoc.h"
16 #include "libcef_dll/ctocpp/v8value_ctocpp.h"
17
18 namespace {
19
20 // MEMBER FUNCTIONS - Body may be edited by hand.
21
v8interceptor_get_byname(struct _cef_v8interceptor_t * self,const cef_string_t * name,struct _cef_v8value_t * object,struct _cef_v8value_t ** retval,cef_string_t * exception)22 int CEF_CALLBACK v8interceptor_get_byname(struct _cef_v8interceptor_t* self,
23 const cef_string_t* name,
24 struct _cef_v8value_t* object,
25 struct _cef_v8value_t** retval,
26 cef_string_t* exception) {
27 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28
29 DCHECK(self);
30 if (!self)
31 return 0;
32 // Verify param: name; type: string_byref_const
33 DCHECK(name);
34 if (!name)
35 return 0;
36 // Verify param: object; type: refptr_diff
37 DCHECK(object);
38 if (!object)
39 return 0;
40 // Verify param: retval; type: refptr_diff_byref
41 DCHECK(retval);
42 if (!retval)
43 return 0;
44 // Verify param: exception; type: string_byref
45 DCHECK(exception);
46 if (!exception)
47 return 0;
48
49 // Translate param: retval; type: refptr_diff_byref
50 CefRefPtr<CefV8Value> retvalPtr;
51 if (retval && *retval)
52 retvalPtr = CefV8ValueCToCpp::Wrap(*retval);
53 CefV8Value* retvalOrig = retvalPtr.get();
54 // Translate param: exception; type: string_byref
55 CefString exceptionStr(exception);
56
57 // Execute
58 bool _retval = CefV8InterceptorCppToC::Get(self)->Get(
59 CefString(name), CefV8ValueCToCpp::Wrap(object), retvalPtr, exceptionStr);
60
61 // Restore param: retval; type: refptr_diff_byref
62 if (retval) {
63 if (retvalPtr.get()) {
64 if (retvalPtr.get() != retvalOrig) {
65 *retval = CefV8ValueCToCpp::Unwrap(retvalPtr);
66 }
67 } else {
68 *retval = nullptr;
69 }
70 }
71
72 // Return type: bool
73 return _retval;
74 }
75
v8interceptor_get_byindex(struct _cef_v8interceptor_t * self,int index,struct _cef_v8value_t * object,struct _cef_v8value_t ** retval,cef_string_t * exception)76 int CEF_CALLBACK v8interceptor_get_byindex(struct _cef_v8interceptor_t* self,
77 int index,
78 struct _cef_v8value_t* object,
79 struct _cef_v8value_t** retval,
80 cef_string_t* exception) {
81 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
82
83 DCHECK(self);
84 if (!self)
85 return 0;
86 // Verify param: index; type: simple_byval
87 DCHECK_GE(index, 0);
88 if (index < 0)
89 return 0;
90 // Verify param: object; type: refptr_diff
91 DCHECK(object);
92 if (!object)
93 return 0;
94 // Verify param: retval; type: refptr_diff_byref
95 DCHECK(retval);
96 if (!retval)
97 return 0;
98 // Verify param: exception; type: string_byref
99 DCHECK(exception);
100 if (!exception)
101 return 0;
102
103 // Translate param: retval; type: refptr_diff_byref
104 CefRefPtr<CefV8Value> retvalPtr;
105 if (retval && *retval)
106 retvalPtr = CefV8ValueCToCpp::Wrap(*retval);
107 CefV8Value* retvalOrig = retvalPtr.get();
108 // Translate param: exception; type: string_byref
109 CefString exceptionStr(exception);
110
111 // Execute
112 bool _retval = CefV8InterceptorCppToC::Get(self)->Get(
113 index, CefV8ValueCToCpp::Wrap(object), retvalPtr, exceptionStr);
114
115 // Restore param: retval; type: refptr_diff_byref
116 if (retval) {
117 if (retvalPtr.get()) {
118 if (retvalPtr.get() != retvalOrig) {
119 *retval = CefV8ValueCToCpp::Unwrap(retvalPtr);
120 }
121 } else {
122 *retval = nullptr;
123 }
124 }
125
126 // Return type: bool
127 return _retval;
128 }
129
v8interceptor_set_byname(struct _cef_v8interceptor_t * self,const cef_string_t * name,struct _cef_v8value_t * object,struct _cef_v8value_t * value,cef_string_t * exception)130 int CEF_CALLBACK v8interceptor_set_byname(struct _cef_v8interceptor_t* self,
131 const cef_string_t* name,
132 struct _cef_v8value_t* object,
133 struct _cef_v8value_t* value,
134 cef_string_t* exception) {
135 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
136
137 DCHECK(self);
138 if (!self)
139 return 0;
140 // Verify param: name; type: string_byref_const
141 DCHECK(name);
142 if (!name)
143 return 0;
144 // Verify param: object; type: refptr_diff
145 DCHECK(object);
146 if (!object)
147 return 0;
148 // Verify param: value; type: refptr_diff
149 DCHECK(value);
150 if (!value)
151 return 0;
152 // Verify param: exception; type: string_byref
153 DCHECK(exception);
154 if (!exception)
155 return 0;
156
157 // Translate param: exception; type: string_byref
158 CefString exceptionStr(exception);
159
160 // Execute
161 bool _retval = CefV8InterceptorCppToC::Get(self)->Set(
162 CefString(name), CefV8ValueCToCpp::Wrap(object),
163 CefV8ValueCToCpp::Wrap(value), exceptionStr);
164
165 // Return type: bool
166 return _retval;
167 }
168
v8interceptor_set_byindex(struct _cef_v8interceptor_t * self,int index,struct _cef_v8value_t * object,struct _cef_v8value_t * value,cef_string_t * exception)169 int CEF_CALLBACK v8interceptor_set_byindex(struct _cef_v8interceptor_t* self,
170 int index,
171 struct _cef_v8value_t* object,
172 struct _cef_v8value_t* value,
173 cef_string_t* exception) {
174 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
175
176 DCHECK(self);
177 if (!self)
178 return 0;
179 // Verify param: index; type: simple_byval
180 DCHECK_GE(index, 0);
181 if (index < 0)
182 return 0;
183 // Verify param: object; type: refptr_diff
184 DCHECK(object);
185 if (!object)
186 return 0;
187 // Verify param: value; type: refptr_diff
188 DCHECK(value);
189 if (!value)
190 return 0;
191 // Verify param: exception; type: string_byref
192 DCHECK(exception);
193 if (!exception)
194 return 0;
195
196 // Translate param: exception; type: string_byref
197 CefString exceptionStr(exception);
198
199 // Execute
200 bool _retval = CefV8InterceptorCppToC::Get(self)->Set(
201 index, CefV8ValueCToCpp::Wrap(object), CefV8ValueCToCpp::Wrap(value),
202 exceptionStr);
203
204 // Return type: bool
205 return _retval;
206 }
207
208 } // namespace
209
210 // CONSTRUCTOR - Do not edit by hand.
211
CefV8InterceptorCppToC()212 CefV8InterceptorCppToC::CefV8InterceptorCppToC() {
213 GetStruct()->get_byname = v8interceptor_get_byname;
214 GetStruct()->get_byindex = v8interceptor_get_byindex;
215 GetStruct()->set_byname = v8interceptor_set_byname;
216 GetStruct()->set_byindex = v8interceptor_set_byindex;
217 }
218
219 // DESTRUCTOR - Do not edit by hand.
220
~CefV8InterceptorCppToC()221 CefV8InterceptorCppToC::~CefV8InterceptorCppToC() {}
222
223 template <>
224 CefRefPtr<CefV8Interceptor> CefCppToCRefCounted<
225 CefV8InterceptorCppToC,
226 CefV8Interceptor,
UnwrapDerived(CefWrapperType type,cef_v8interceptor_t * s)227 cef_v8interceptor_t>::UnwrapDerived(CefWrapperType type,
228 cef_v8interceptor_t* s) {
229 NOTREACHED() << "Unexpected class type: " << type;
230 return nullptr;
231 }
232
233 template <>
234 CefWrapperType CefCppToCRefCounted<CefV8InterceptorCppToC,
235 CefV8Interceptor,
236 cef_v8interceptor_t>::kWrapperType =
237 WT_V8INTERCEPTOR;
238