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=a0976edc09e822700d8f402b2dae7af4c434d86f$
13 //
14
15 #include "libcef_dll/cpptoc/read_handler_cpptoc.h"
16 #include "libcef_dll/shutdown_checker.h"
17
18 namespace {
19
20 // MEMBER FUNCTIONS - Body may be edited by hand.
21
read_handler_read(struct _cef_read_handler_t * self,void * ptr,size_t size,size_t n)22 size_t CEF_CALLBACK read_handler_read(struct _cef_read_handler_t* self,
23 void* ptr,
24 size_t size,
25 size_t n) {
26 shutdown_checker::AssertNotShutdown();
27
28 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
29
30 DCHECK(self);
31 if (!self)
32 return 0;
33 // Verify param: ptr; type: simple_byaddr
34 DCHECK(ptr);
35 if (!ptr)
36 return 0;
37
38 // Execute
39 size_t _retval = CefReadHandlerCppToC::Get(self)->Read(ptr, size, n);
40
41 // Return type: simple
42 return _retval;
43 }
44
read_handler_seek(struct _cef_read_handler_t * self,int64 offset,int whence)45 int CEF_CALLBACK read_handler_seek(struct _cef_read_handler_t* self,
46 int64 offset,
47 int whence) {
48 shutdown_checker::AssertNotShutdown();
49
50 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
51
52 DCHECK(self);
53 if (!self)
54 return 0;
55
56 // Execute
57 int _retval = CefReadHandlerCppToC::Get(self)->Seek(offset, whence);
58
59 // Return type: simple
60 return _retval;
61 }
62
read_handler_tell(struct _cef_read_handler_t * self)63 int64 CEF_CALLBACK read_handler_tell(struct _cef_read_handler_t* self) {
64 shutdown_checker::AssertNotShutdown();
65
66 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
67
68 DCHECK(self);
69 if (!self)
70 return 0;
71
72 // Execute
73 int64 _retval = CefReadHandlerCppToC::Get(self)->Tell();
74
75 // Return type: simple
76 return _retval;
77 }
78
read_handler_eof(struct _cef_read_handler_t * self)79 int CEF_CALLBACK read_handler_eof(struct _cef_read_handler_t* self) {
80 shutdown_checker::AssertNotShutdown();
81
82 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
83
84 DCHECK(self);
85 if (!self)
86 return 0;
87
88 // Execute
89 int _retval = CefReadHandlerCppToC::Get(self)->Eof();
90
91 // Return type: simple
92 return _retval;
93 }
94
read_handler_may_block(struct _cef_read_handler_t * self)95 int CEF_CALLBACK read_handler_may_block(struct _cef_read_handler_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 = CefReadHandlerCppToC::Get(self)->MayBlock();
106
107 // Return type: bool
108 return _retval;
109 }
110
111 } // namespace
112
113 // CONSTRUCTOR - Do not edit by hand.
114
CefReadHandlerCppToC()115 CefReadHandlerCppToC::CefReadHandlerCppToC() {
116 GetStruct()->read = read_handler_read;
117 GetStruct()->seek = read_handler_seek;
118 GetStruct()->tell = read_handler_tell;
119 GetStruct()->eof = read_handler_eof;
120 GetStruct()->may_block = read_handler_may_block;
121 }
122
123 // DESTRUCTOR - Do not edit by hand.
124
~CefReadHandlerCppToC()125 CefReadHandlerCppToC::~CefReadHandlerCppToC() {
126 shutdown_checker::AssertNotShutdown();
127 }
128
129 template <>
130 CefRefPtr<CefReadHandler>
131 CefCppToCRefCounted<CefReadHandlerCppToC, CefReadHandler, cef_read_handler_t>::
UnwrapDerived(CefWrapperType type,cef_read_handler_t * s)132 UnwrapDerived(CefWrapperType type, cef_read_handler_t* s) {
133 NOTREACHED() << "Unexpected class type: " << type;
134 return nullptr;
135 }
136
137 template <>
138 CefWrapperType CefCppToCRefCounted<CefReadHandlerCppToC,
139 CefReadHandler,
140 cef_read_handler_t>::kWrapperType =
141 WT_READ_HANDLER;
142