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=35161ccb0b72898e250d905b4b245b4839fe7ecc$
13 //
14
15 #include "libcef_dll/cpptoc/v8accessor_cpptoc.h"
16 #include "libcef_dll/ctocpp/v8value_ctocpp.h"
17
18 namespace {
19
20 // MEMBER FUNCTIONS - Body may be edited by hand.
21
v8accessor_get(struct _cef_v8accessor_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 v8accessor_get(struct _cef_v8accessor_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 = CefV8AccessorCppToC::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
v8accessor_set(struct _cef_v8accessor_t * self,const cef_string_t * name,struct _cef_v8value_t * object,struct _cef_v8value_t * value,cef_string_t * exception)76 int CEF_CALLBACK v8accessor_set(struct _cef_v8accessor_t* self,
77 const cef_string_t* name,
78 struct _cef_v8value_t* object,
79 struct _cef_v8value_t* value,
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: name; type: string_byref_const
87 DCHECK(name);
88 if (!name)
89 return 0;
90 // Verify param: object; type: refptr_diff
91 DCHECK(object);
92 if (!object)
93 return 0;
94 // Verify param: value; type: refptr_diff
95 DCHECK(value);
96 if (!value)
97 return 0;
98 // Verify param: exception; type: string_byref
99 DCHECK(exception);
100 if (!exception)
101 return 0;
102
103 // Translate param: exception; type: string_byref
104 CefString exceptionStr(exception);
105
106 // Execute
107 bool _retval = CefV8AccessorCppToC::Get(self)->Set(
108 CefString(name), CefV8ValueCToCpp::Wrap(object),
109 CefV8ValueCToCpp::Wrap(value), exceptionStr);
110
111 // Return type: bool
112 return _retval;
113 }
114
115 } // namespace
116
117 // CONSTRUCTOR - Do not edit by hand.
118
CefV8AccessorCppToC()119 CefV8AccessorCppToC::CefV8AccessorCppToC() {
120 GetStruct()->get = v8accessor_get;
121 GetStruct()->set = v8accessor_set;
122 }
123
124 // DESTRUCTOR - Do not edit by hand.
125
~CefV8AccessorCppToC()126 CefV8AccessorCppToC::~CefV8AccessorCppToC() {}
127
128 template <>
129 CefRefPtr<CefV8Accessor>
130 CefCppToCRefCounted<CefV8AccessorCppToC, CefV8Accessor, cef_v8accessor_t>::
UnwrapDerived(CefWrapperType type,cef_v8accessor_t * s)131 UnwrapDerived(CefWrapperType type, cef_v8accessor_t* s) {
132 NOTREACHED() << "Unexpected class type: " << type;
133 return nullptr;
134 }
135
136 template <>
137 CefWrapperType CefCppToCRefCounted<CefV8AccessorCppToC,
138 CefV8Accessor,
139 cef_v8accessor_t>::kWrapperType =
140 WT_V8ACCESSOR;
141