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=7c1bd7fe9f9c91bc488299a2278f83a0850befe7$
13 //
14
15 #include "libcef_dll/cpptoc/task_runner_cpptoc.h"
16 #include "libcef_dll/ctocpp/task_ctocpp.h"
17 #include "libcef_dll/shutdown_checker.h"
18
19 // GLOBAL FUNCTIONS - Body may be edited by hand.
20
cef_task_runner_get_for_current_thread()21 CEF_EXPORT cef_task_runner_t* cef_task_runner_get_for_current_thread() {
22 shutdown_checker::AssertNotShutdown();
23
24 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
25
26 // Execute
27 CefRefPtr<CefTaskRunner> _retval = CefTaskRunner::GetForCurrentThread();
28
29 // Return type: refptr_same
30 return CefTaskRunnerCppToC::Wrap(_retval);
31 }
32
cef_task_runner_get_for_thread(cef_thread_id_t threadId)33 CEF_EXPORT cef_task_runner_t* cef_task_runner_get_for_thread(
34 cef_thread_id_t threadId) {
35 shutdown_checker::AssertNotShutdown();
36
37 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
38
39 // Execute
40 CefRefPtr<CefTaskRunner> _retval = CefTaskRunner::GetForThread(threadId);
41
42 // Return type: refptr_same
43 return CefTaskRunnerCppToC::Wrap(_retval);
44 }
45
46 namespace {
47
48 // MEMBER FUNCTIONS - Body may be edited by hand.
49
task_runner_is_same(struct _cef_task_runner_t * self,struct _cef_task_runner_t * that)50 int CEF_CALLBACK task_runner_is_same(struct _cef_task_runner_t* self,
51 struct _cef_task_runner_t* that) {
52 shutdown_checker::AssertNotShutdown();
53
54 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
55
56 DCHECK(self);
57 if (!self)
58 return 0;
59 // Verify param: that; type: refptr_same
60 DCHECK(that);
61 if (!that)
62 return 0;
63
64 // Execute
65 bool _retval =
66 CefTaskRunnerCppToC::Get(self)->IsSame(CefTaskRunnerCppToC::Unwrap(that));
67
68 // Return type: bool
69 return _retval;
70 }
71
72 int CEF_CALLBACK
task_runner_belongs_to_current_thread(struct _cef_task_runner_t * self)73 task_runner_belongs_to_current_thread(struct _cef_task_runner_t* self) {
74 shutdown_checker::AssertNotShutdown();
75
76 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
77
78 DCHECK(self);
79 if (!self)
80 return 0;
81
82 // Execute
83 bool _retval = CefTaskRunnerCppToC::Get(self)->BelongsToCurrentThread();
84
85 // Return type: bool
86 return _retval;
87 }
88
task_runner_belongs_to_thread(struct _cef_task_runner_t * self,cef_thread_id_t threadId)89 int CEF_CALLBACK task_runner_belongs_to_thread(struct _cef_task_runner_t* self,
90 cef_thread_id_t threadId) {
91 shutdown_checker::AssertNotShutdown();
92
93 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
94
95 DCHECK(self);
96 if (!self)
97 return 0;
98
99 // Execute
100 bool _retval = CefTaskRunnerCppToC::Get(self)->BelongsToThread(threadId);
101
102 // Return type: bool
103 return _retval;
104 }
105
task_runner_post_task(struct _cef_task_runner_t * self,cef_task_t * task)106 int CEF_CALLBACK task_runner_post_task(struct _cef_task_runner_t* self,
107 cef_task_t* task) {
108 shutdown_checker::AssertNotShutdown();
109
110 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
111
112 DCHECK(self);
113 if (!self)
114 return 0;
115 // Verify param: task; type: refptr_diff
116 DCHECK(task);
117 if (!task)
118 return 0;
119
120 // Execute
121 bool _retval =
122 CefTaskRunnerCppToC::Get(self)->PostTask(CefTaskCToCpp::Wrap(task));
123
124 // Return type: bool
125 return _retval;
126 }
127
task_runner_post_delayed_task(struct _cef_task_runner_t * self,cef_task_t * task,int64 delay_ms)128 int CEF_CALLBACK task_runner_post_delayed_task(struct _cef_task_runner_t* self,
129 cef_task_t* task,
130 int64 delay_ms) {
131 shutdown_checker::AssertNotShutdown();
132
133 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
134
135 DCHECK(self);
136 if (!self)
137 return 0;
138 // Verify param: task; type: refptr_diff
139 DCHECK(task);
140 if (!task)
141 return 0;
142
143 // Execute
144 bool _retval = CefTaskRunnerCppToC::Get(self)->PostDelayedTask(
145 CefTaskCToCpp::Wrap(task), delay_ms);
146
147 // Return type: bool
148 return _retval;
149 }
150
151 } // namespace
152
153 // CONSTRUCTOR - Do not edit by hand.
154
CefTaskRunnerCppToC()155 CefTaskRunnerCppToC::CefTaskRunnerCppToC() {
156 GetStruct()->is_same = task_runner_is_same;
157 GetStruct()->belongs_to_current_thread =
158 task_runner_belongs_to_current_thread;
159 GetStruct()->belongs_to_thread = task_runner_belongs_to_thread;
160 GetStruct()->post_task = task_runner_post_task;
161 GetStruct()->post_delayed_task = task_runner_post_delayed_task;
162 }
163
164 // DESTRUCTOR - Do not edit by hand.
165
~CefTaskRunnerCppToC()166 CefTaskRunnerCppToC::~CefTaskRunnerCppToC() {
167 shutdown_checker::AssertNotShutdown();
168 }
169
170 template <>
171 CefRefPtr<CefTaskRunner>
172 CefCppToCRefCounted<CefTaskRunnerCppToC, CefTaskRunner, cef_task_runner_t>::
UnwrapDerived(CefWrapperType type,cef_task_runner_t * s)173 UnwrapDerived(CefWrapperType type, cef_task_runner_t* s) {
174 NOTREACHED() << "Unexpected class type: " << type;
175 return nullptr;
176 }
177
178 template <>
179 CefWrapperType CefCppToCRefCounted<CefTaskRunnerCppToC,
180 CefTaskRunner,
181 cef_task_runner_t>::kWrapperType =
182 WT_TASK_RUNNER;
183