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=365e5e2b4e3ced4e615fa504a0cb68c66854fc37$
13 //
14
15 #include "libcef_dll/ctocpp/v8handler_ctocpp.h"
16 #include "libcef_dll/cpptoc/v8value_cpptoc.h"
17
18 // VIRTUAL METHODS - Body may be edited by hand.
19
20 NO_SANITIZE("cfi-icall")
Execute(const CefString & name,CefRefPtr<CefV8Value> object,const CefV8ValueList & arguments,CefRefPtr<CefV8Value> & retval,CefString & exception)21 bool CefV8HandlerCToCpp::Execute(const CefString& name,
22 CefRefPtr<CefV8Value> object,
23 const CefV8ValueList& arguments,
24 CefRefPtr<CefV8Value>& retval,
25 CefString& exception) {
26 cef_v8handler_t* _struct = GetStruct();
27 if (CEF_MEMBER_MISSING(_struct, execute))
28 return false;
29
30 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31
32 // Verify param: name; type: string_byref_const
33 DCHECK(!name.empty());
34 if (name.empty())
35 return false;
36 // Verify param: object; type: refptr_diff
37 DCHECK(object.get());
38 if (!object.get())
39 return false;
40
41 // Translate param: arguments; type: refptr_vec_diff_byref_const
42 const size_t argumentsCount = arguments.size();
43 cef_v8value_t** argumentsList = NULL;
44 if (argumentsCount > 0) {
45 argumentsList = new cef_v8value_t*[argumentsCount];
46 DCHECK(argumentsList);
47 if (argumentsList) {
48 for (size_t i = 0; i < argumentsCount; ++i) {
49 argumentsList[i] = CefV8ValueCppToC::Wrap(arguments[i]);
50 }
51 }
52 }
53 // Translate param: retval; type: refptr_diff_byref
54 cef_v8value_t* retvalStruct = NULL;
55 if (retval.get())
56 retvalStruct = CefV8ValueCppToC::Wrap(retval);
57 cef_v8value_t* retvalOrig = retvalStruct;
58
59 // Execute
60 int _retval = _struct->execute(
61 _struct, name.GetStruct(), CefV8ValueCppToC::Wrap(object), argumentsCount,
62 argumentsList, &retvalStruct, exception.GetWritableStruct());
63
64 // Restore param:arguments; type: refptr_vec_diff_byref_const
65 if (argumentsList)
66 delete[] argumentsList;
67 // Restore param:retval; type: refptr_diff_byref
68 if (retvalStruct) {
69 if (retvalStruct != retvalOrig) {
70 retval = CefV8ValueCppToC::Unwrap(retvalStruct);
71 }
72 } else {
73 retval = nullptr;
74 }
75
76 // Return type: bool
77 return _retval ? true : false;
78 }
79
80 // CONSTRUCTOR - Do not edit by hand.
81
CefV8HandlerCToCpp()82 CefV8HandlerCToCpp::CefV8HandlerCToCpp() {}
83
84 // DESTRUCTOR - Do not edit by hand.
85
~CefV8HandlerCToCpp()86 CefV8HandlerCToCpp::~CefV8HandlerCToCpp() {}
87
88 template <>
89 cef_v8handler_t*
90 CefCToCppRefCounted<CefV8HandlerCToCpp, CefV8Handler, cef_v8handler_t>::
UnwrapDerived(CefWrapperType type,CefV8Handler * c)91 UnwrapDerived(CefWrapperType type, CefV8Handler* c) {
92 NOTREACHED() << "Unexpected class type: " << type;
93 return nullptr;
94 }
95
96 template <>
97 CefWrapperType CefCToCppRefCounted<CefV8HandlerCToCpp,
98 CefV8Handler,
99 cef_v8handler_t>::kWrapperType =
100 WT_V8HANDLER;
101