• 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=9975067d09206080d5237a7d1e8dd70155deb554$
13 //
14 
15 #include "libcef_dll/cpptoc/thread_cpptoc.h"
16 #include "libcef_dll/cpptoc/task_runner_cpptoc.h"
17 #include "libcef_dll/shutdown_checker.h"
18 
19 // GLOBAL FUNCTIONS - Body may be edited by hand.
20 
cef_thread_create(const cef_string_t * display_name,cef_thread_priority_t priority,cef_message_loop_type_t message_loop_type,int stoppable,cef_com_init_mode_t com_init_mode)21 CEF_EXPORT cef_thread_t* cef_thread_create(
22     const cef_string_t* display_name,
23     cef_thread_priority_t priority,
24     cef_message_loop_type_t message_loop_type,
25     int stoppable,
26     cef_com_init_mode_t com_init_mode) {
27   shutdown_checker::AssertNotShutdown();
28 
29   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30 
31   // Unverified params: display_name
32 
33   // Execute
34   CefRefPtr<CefThread> _retval = CefThread::CreateThread(
35       CefString(display_name), priority, message_loop_type,
36       stoppable ? true : false, com_init_mode);
37 
38   // Return type: refptr_same
39   return CefThreadCppToC::Wrap(_retval);
40 }
41 
42 namespace {
43 
44 // MEMBER FUNCTIONS - Body may be edited by hand.
45 
46 cef_task_runner_t* CEF_CALLBACK
thread_get_task_runner(struct _cef_thread_t * self)47 thread_get_task_runner(struct _cef_thread_t* self) {
48   shutdown_checker::AssertNotShutdown();
49 
50   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
51 
52   DCHECK(self);
53   if (!self)
54     return NULL;
55 
56   // Execute
57   CefRefPtr<CefTaskRunner> _retval =
58       CefThreadCppToC::Get(self)->GetTaskRunner();
59 
60   // Return type: refptr_same
61   return CefTaskRunnerCppToC::Wrap(_retval);
62 }
63 
64 cef_platform_thread_id_t CEF_CALLBACK
thread_get_platform_thread_id(struct _cef_thread_t * self)65 thread_get_platform_thread_id(struct _cef_thread_t* self) {
66   shutdown_checker::AssertNotShutdown();
67 
68   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
69 
70   DCHECK(self);
71   if (!self)
72     return kInvalidPlatformThreadId;
73 
74   // Execute
75   cef_platform_thread_id_t _retval =
76       CefThreadCppToC::Get(self)->GetPlatformThreadId();
77 
78   // Return type: simple
79   return _retval;
80 }
81 
thread_stop(struct _cef_thread_t * self)82 void CEF_CALLBACK thread_stop(struct _cef_thread_t* self) {
83   shutdown_checker::AssertNotShutdown();
84 
85   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
86 
87   DCHECK(self);
88   if (!self)
89     return;
90 
91   // Execute
92   CefThreadCppToC::Get(self)->Stop();
93 }
94 
thread_is_running(struct _cef_thread_t * self)95 int CEF_CALLBACK thread_is_running(struct _cef_thread_t* self) {
96   shutdown_checker::AssertNotShutdown();
97 
98   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
99 
100   DCHECK(self);
101   if (!self)
102     return 0;
103 
104   // Execute
105   bool _retval = CefThreadCppToC::Get(self)->IsRunning();
106 
107   // Return type: bool
108   return _retval;
109 }
110 
111 }  // namespace
112 
113 // CONSTRUCTOR - Do not edit by hand.
114 
CefThreadCppToC()115 CefThreadCppToC::CefThreadCppToC() {
116   GetStruct()->get_task_runner = thread_get_task_runner;
117   GetStruct()->get_platform_thread_id = thread_get_platform_thread_id;
118   GetStruct()->stop = thread_stop;
119   GetStruct()->is_running = thread_is_running;
120 }
121 
122 // DESTRUCTOR - Do not edit by hand.
123 
~CefThreadCppToC()124 CefThreadCppToC::~CefThreadCppToC() {
125   shutdown_checker::AssertNotShutdown();
126 }
127 
128 template <>
129 CefRefPtr<CefThread>
UnwrapDerived(CefWrapperType type,cef_thread_t * s)130 CefCppToCRefCounted<CefThreadCppToC, CefThread, cef_thread_t>::UnwrapDerived(
131     CefWrapperType type,
132     cef_thread_t* s) {
133   NOTREACHED() << "Unexpected class type: " << type;
134   return nullptr;
135 }
136 
137 template <>
138 CefWrapperType CefCppToCRefCounted<CefThreadCppToC, CefThread, cef_thread_t>::
139     kWrapperType = WT_THREAD;
140