• 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=7a072d883f46856cf79bf868560689797b31e362$
13 //
14 
15 #include "libcef_dll/cpptoc/v8handler_cpptoc.h"
16 #include "libcef_dll/ctocpp/v8value_ctocpp.h"
17 
18 namespace {
19 
20 // MEMBER FUNCTIONS - Body may be edited by hand.
21 
v8handler_execute(struct _cef_v8handler_t * self,const cef_string_t * name,struct _cef_v8value_t * object,size_t argumentsCount,struct _cef_v8value_t * const * arguments,struct _cef_v8value_t ** retval,cef_string_t * exception)22 int CEF_CALLBACK v8handler_execute(struct _cef_v8handler_t* self,
23                                    const cef_string_t* name,
24                                    struct _cef_v8value_t* object,
25                                    size_t argumentsCount,
26                                    struct _cef_v8value_t* const* arguments,
27                                    struct _cef_v8value_t** retval,
28                                    cef_string_t* exception) {
29   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30 
31   DCHECK(self);
32   if (!self)
33     return 0;
34   // Verify param: name; type: string_byref_const
35   DCHECK(name);
36   if (!name)
37     return 0;
38   // Verify param: object; type: refptr_diff
39   DCHECK(object);
40   if (!object)
41     return 0;
42   // Verify param: arguments; type: refptr_vec_diff_byref_const
43   DCHECK(argumentsCount == 0 || arguments);
44   if (argumentsCount > 0 && !arguments)
45     return 0;
46   // Verify param: retval; type: refptr_diff_byref
47   DCHECK(retval);
48   if (!retval)
49     return 0;
50   // Verify param: exception; type: string_byref
51   DCHECK(exception);
52   if (!exception)
53     return 0;
54 
55   // Translate param: arguments; type: refptr_vec_diff_byref_const
56   std::vector<CefRefPtr<CefV8Value>> argumentsList;
57   if (argumentsCount > 0) {
58     for (size_t i = 0; i < argumentsCount; ++i) {
59       CefRefPtr<CefV8Value> argumentsVal = CefV8ValueCToCpp::Wrap(arguments[i]);
60       argumentsList.push_back(argumentsVal);
61     }
62   }
63   // Translate param: retval; type: refptr_diff_byref
64   CefRefPtr<CefV8Value> retvalPtr;
65   if (retval && *retval)
66     retvalPtr = CefV8ValueCToCpp::Wrap(*retval);
67   CefV8Value* retvalOrig = retvalPtr.get();
68   // Translate param: exception; type: string_byref
69   CefString exceptionStr(exception);
70 
71   // Execute
72   bool _retval = CefV8HandlerCppToC::Get(self)->Execute(
73       CefString(name), CefV8ValueCToCpp::Wrap(object), argumentsList, retvalPtr,
74       exceptionStr);
75 
76   // Restore param: retval; type: refptr_diff_byref
77   if (retval) {
78     if (retvalPtr.get()) {
79       if (retvalPtr.get() != retvalOrig) {
80         *retval = CefV8ValueCToCpp::Unwrap(retvalPtr);
81       }
82     } else {
83       *retval = nullptr;
84     }
85   }
86 
87   // Return type: bool
88   return _retval;
89 }
90 
91 }  // namespace
92 
93 // CONSTRUCTOR - Do not edit by hand.
94 
CefV8HandlerCppToC()95 CefV8HandlerCppToC::CefV8HandlerCppToC() {
96   GetStruct()->execute = v8handler_execute;
97 }
98 
99 // DESTRUCTOR - Do not edit by hand.
100 
~CefV8HandlerCppToC()101 CefV8HandlerCppToC::~CefV8HandlerCppToC() {}
102 
103 template <>
104 CefRefPtr<CefV8Handler>
105 CefCppToCRefCounted<CefV8HandlerCppToC, CefV8Handler, cef_v8handler_t>::
UnwrapDerived(CefWrapperType type,cef_v8handler_t * s)106     UnwrapDerived(CefWrapperType type, cef_v8handler_t* s) {
107   NOTREACHED() << "Unexpected class type: " << type;
108   return nullptr;
109 }
110 
111 template <>
112 CefWrapperType CefCppToCRefCounted<CefV8HandlerCppToC,
113                                    CefV8Handler,
114                                    cef_v8handler_t>::kWrapperType =
115     WT_V8HANDLER;
116