• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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=8d8c4cf20f877a5eb60b47fb55d938940bb10c82$
13 //
14 
15 #include "libcef_dll/ctocpp/v8context_ctocpp.h"
16 #include "libcef_dll/ctocpp/browser_ctocpp.h"
17 #include "libcef_dll/ctocpp/frame_ctocpp.h"
18 #include "libcef_dll/ctocpp/task_runner_ctocpp.h"
19 #include "libcef_dll/ctocpp/v8exception_ctocpp.h"
20 #include "libcef_dll/ctocpp/v8value_ctocpp.h"
21 
22 // STATIC METHODS - Body may be edited by hand.
23 
24 NO_SANITIZE("cfi-icall")
GetCurrentContext()25 CefRefPtr<CefV8Context> CefV8Context::GetCurrentContext() {
26   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27 
28   // Execute
29   cef_v8context_t* _retval = cef_v8context_get_current_context();
30 
31   // Return type: refptr_same
32   return CefV8ContextCToCpp::Wrap(_retval);
33 }
34 
35 NO_SANITIZE("cfi-icall")
GetEnteredContext()36 CefRefPtr<CefV8Context> CefV8Context::GetEnteredContext() {
37   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
38 
39   // Execute
40   cef_v8context_t* _retval = cef_v8context_get_entered_context();
41 
42   // Return type: refptr_same
43   return CefV8ContextCToCpp::Wrap(_retval);
44 }
45 
InContext()46 NO_SANITIZE("cfi-icall") bool CefV8Context::InContext() {
47   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
48 
49   // Execute
50   int _retval = cef_v8context_in_context();
51 
52   // Return type: bool
53   return _retval ? true : false;
54 }
55 
56 // VIRTUAL METHODS - Body may be edited by hand.
57 
58 NO_SANITIZE("cfi-icall")
GetTaskRunner()59 CefRefPtr<CefTaskRunner> CefV8ContextCToCpp::GetTaskRunner() {
60   cef_v8context_t* _struct = GetStruct();
61   if (CEF_MEMBER_MISSING(_struct, get_task_runner))
62     return nullptr;
63 
64   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
65 
66   // Execute
67   cef_task_runner_t* _retval = _struct->get_task_runner(_struct);
68 
69   // Return type: refptr_same
70   return CefTaskRunnerCToCpp::Wrap(_retval);
71 }
72 
IsValid()73 NO_SANITIZE("cfi-icall") bool CefV8ContextCToCpp::IsValid() {
74   cef_v8context_t* _struct = GetStruct();
75   if (CEF_MEMBER_MISSING(_struct, is_valid))
76     return false;
77 
78   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
79 
80   // Execute
81   int _retval = _struct->is_valid(_struct);
82 
83   // Return type: bool
84   return _retval ? true : false;
85 }
86 
87 NO_SANITIZE("cfi-icall")
GetBrowser()88 CefRefPtr<CefBrowser> CefV8ContextCToCpp::GetBrowser() {
89   cef_v8context_t* _struct = GetStruct();
90   if (CEF_MEMBER_MISSING(_struct, get_browser))
91     return nullptr;
92 
93   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
94 
95   // Execute
96   cef_browser_t* _retval = _struct->get_browser(_struct);
97 
98   // Return type: refptr_same
99   return CefBrowserCToCpp::Wrap(_retval);
100 }
101 
GetFrame()102 NO_SANITIZE("cfi-icall") CefRefPtr<CefFrame> CefV8ContextCToCpp::GetFrame() {
103   cef_v8context_t* _struct = GetStruct();
104   if (CEF_MEMBER_MISSING(_struct, get_frame))
105     return nullptr;
106 
107   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
108 
109   // Execute
110   cef_frame_t* _retval = _struct->get_frame(_struct);
111 
112   // Return type: refptr_same
113   return CefFrameCToCpp::Wrap(_retval);
114 }
115 
GetGlobal()116 NO_SANITIZE("cfi-icall") CefRefPtr<CefV8Value> CefV8ContextCToCpp::GetGlobal() {
117   cef_v8context_t* _struct = GetStruct();
118   if (CEF_MEMBER_MISSING(_struct, get_global))
119     return nullptr;
120 
121   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
122 
123   // Execute
124   cef_v8value_t* _retval = _struct->get_global(_struct);
125 
126   // Return type: refptr_same
127   return CefV8ValueCToCpp::Wrap(_retval);
128 }
129 
Enter()130 NO_SANITIZE("cfi-icall") bool CefV8ContextCToCpp::Enter() {
131   cef_v8context_t* _struct = GetStruct();
132   if (CEF_MEMBER_MISSING(_struct, enter))
133     return false;
134 
135   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
136 
137   // Execute
138   int _retval = _struct->enter(_struct);
139 
140   // Return type: bool
141   return _retval ? true : false;
142 }
143 
Exit()144 NO_SANITIZE("cfi-icall") bool CefV8ContextCToCpp::Exit() {
145   cef_v8context_t* _struct = GetStruct();
146   if (CEF_MEMBER_MISSING(_struct, exit))
147     return false;
148 
149   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
150 
151   // Execute
152   int _retval = _struct->exit(_struct);
153 
154   // Return type: bool
155   return _retval ? true : false;
156 }
157 
158 NO_SANITIZE("cfi-icall")
IsSame(CefRefPtr<CefV8Context> that)159 bool CefV8ContextCToCpp::IsSame(CefRefPtr<CefV8Context> that) {
160   cef_v8context_t* _struct = GetStruct();
161   if (CEF_MEMBER_MISSING(_struct, is_same))
162     return false;
163 
164   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
165 
166   // Verify param: that; type: refptr_same
167   DCHECK(that.get());
168   if (!that.get())
169     return false;
170 
171   // Execute
172   int _retval = _struct->is_same(_struct, CefV8ContextCToCpp::Unwrap(that));
173 
174   // Return type: bool
175   return _retval ? true : false;
176 }
177 
178 NO_SANITIZE("cfi-icall")
Eval(const CefString & code,const CefString & script_url,int start_line,CefRefPtr<CefV8Value> & retval,CefRefPtr<CefV8Exception> & exception)179 bool CefV8ContextCToCpp::Eval(const CefString& code,
180                               const CefString& script_url,
181                               int start_line,
182                               CefRefPtr<CefV8Value>& retval,
183                               CefRefPtr<CefV8Exception>& exception) {
184   cef_v8context_t* _struct = GetStruct();
185   if (CEF_MEMBER_MISSING(_struct, eval))
186     return false;
187 
188   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
189 
190   // Verify param: code; type: string_byref_const
191   DCHECK(!code.empty());
192   if (code.empty())
193     return false;
194   // Unverified params: script_url
195 
196   // Translate param: retval; type: refptr_same_byref
197   cef_v8value_t* retvalStruct = NULL;
198   if (retval.get())
199     retvalStruct = CefV8ValueCToCpp::Unwrap(retval);
200   cef_v8value_t* retvalOrig = retvalStruct;
201   // Translate param: exception; type: refptr_same_byref
202   cef_v8exception_t* exceptionStruct = NULL;
203   if (exception.get())
204     exceptionStruct = CefV8ExceptionCToCpp::Unwrap(exception);
205   cef_v8exception_t* exceptionOrig = exceptionStruct;
206 
207   // Execute
208   int _retval = _struct->eval(_struct, code.GetStruct(), script_url.GetStruct(),
209                               start_line, &retvalStruct, &exceptionStruct);
210 
211   // Restore param:retval; type: refptr_same_byref
212   if (retvalStruct) {
213     if (retvalStruct != retvalOrig) {
214       retval = CefV8ValueCToCpp::Wrap(retvalStruct);
215     }
216   } else {
217     retval = nullptr;
218   }
219   // Restore param:exception; type: refptr_same_byref
220   if (exceptionStruct) {
221     if (exceptionStruct != exceptionOrig) {
222       exception = CefV8ExceptionCToCpp::Wrap(exceptionStruct);
223     }
224   } else {
225     exception = nullptr;
226   }
227 
228   // Return type: bool
229   return _retval ? true : false;
230 }
231 
232 // CONSTRUCTOR - Do not edit by hand.
233 
CefV8ContextCToCpp()234 CefV8ContextCToCpp::CefV8ContextCToCpp() {}
235 
236 // DESTRUCTOR - Do not edit by hand.
237 
~CefV8ContextCToCpp()238 CefV8ContextCToCpp::~CefV8ContextCToCpp() {}
239 
240 template <>
241 cef_v8context_t*
242 CefCToCppRefCounted<CefV8ContextCToCpp, CefV8Context, cef_v8context_t>::
UnwrapDerived(CefWrapperType type,CefV8Context * c)243     UnwrapDerived(CefWrapperType type, CefV8Context* c) {
244   NOTREACHED() << "Unexpected class type: " << type;
245   return nullptr;
246 }
247 
248 template <>
249 CefWrapperType CefCToCppRefCounted<CefV8ContextCToCpp,
250                                    CefV8Context,
251                                    cef_v8context_t>::kWrapperType =
252     WT_V8CONTEXT;
253