• 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=b6721a12a6b018187b3ccc87557beb29be130100$
13 //
14 
15 #include "libcef_dll/cpptoc/response_filter_cpptoc.h"
16 #include "libcef_dll/shutdown_checker.h"
17 
18 namespace {
19 
20 // MEMBER FUNCTIONS - Body may be edited by hand.
21 
22 int CEF_CALLBACK
response_filter_init_filter(struct _cef_response_filter_t * self)23 response_filter_init_filter(struct _cef_response_filter_t* self) {
24   shutdown_checker::AssertNotShutdown();
25 
26   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27 
28   DCHECK(self);
29   if (!self)
30     return 0;
31 
32   // Execute
33   bool _retval = CefResponseFilterCppToC::Get(self)->InitFilter();
34 
35   // Return type: bool
36   return _retval;
37 }
38 
39 cef_response_filter_status_t CEF_CALLBACK
response_filter_filter(struct _cef_response_filter_t * self,void * data_in,size_t data_in_size,size_t * data_in_read,void * data_out,size_t data_out_size,size_t * data_out_written)40 response_filter_filter(struct _cef_response_filter_t* self,
41                        void* data_in,
42                        size_t data_in_size,
43                        size_t* data_in_read,
44                        void* data_out,
45                        size_t data_out_size,
46                        size_t* data_out_written) {
47   shutdown_checker::AssertNotShutdown();
48 
49   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
50 
51   DCHECK(self);
52   if (!self)
53     return RESPONSE_FILTER_ERROR;
54   // Verify param: data_in_read; type: simple_byref
55   DCHECK(data_in_read);
56   if (!data_in_read)
57     return RESPONSE_FILTER_ERROR;
58   // Verify param: data_out; type: simple_byaddr
59   DCHECK(data_out);
60   if (!data_out)
61     return RESPONSE_FILTER_ERROR;
62   // Verify param: data_out_written; type: simple_byref
63   DCHECK(data_out_written);
64   if (!data_out_written)
65     return RESPONSE_FILTER_ERROR;
66   // Unverified params: data_in
67 
68   // Translate param: data_in_read; type: simple_byref
69   size_t data_in_readVal = data_in_read ? *data_in_read : 0;
70   // Translate param: data_out_written; type: simple_byref
71   size_t data_out_writtenVal = data_out_written ? *data_out_written : 0;
72 
73   // Execute
74   cef_response_filter_status_t _retval =
75       CefResponseFilterCppToC::Get(self)->Filter(
76           data_in, data_in_size, data_in_readVal, data_out, data_out_size,
77           data_out_writtenVal);
78 
79   // Restore param: data_in_read; type: simple_byref
80   if (data_in_read)
81     *data_in_read = data_in_readVal;
82   // Restore param: data_out_written; type: simple_byref
83   if (data_out_written)
84     *data_out_written = data_out_writtenVal;
85 
86   // Return type: simple
87   return _retval;
88 }
89 
90 }  // namespace
91 
92 // CONSTRUCTOR - Do not edit by hand.
93 
CefResponseFilterCppToC()94 CefResponseFilterCppToC::CefResponseFilterCppToC() {
95   GetStruct()->init_filter = response_filter_init_filter;
96   GetStruct()->filter = response_filter_filter;
97 }
98 
99 // DESTRUCTOR - Do not edit by hand.
100 
~CefResponseFilterCppToC()101 CefResponseFilterCppToC::~CefResponseFilterCppToC() {
102   shutdown_checker::AssertNotShutdown();
103 }
104 
105 template <>
106 CefRefPtr<CefResponseFilter> CefCppToCRefCounted<
107     CefResponseFilterCppToC,
108     CefResponseFilter,
UnwrapDerived(CefWrapperType type,cef_response_filter_t * s)109     cef_response_filter_t>::UnwrapDerived(CefWrapperType type,
110                                           cef_response_filter_t* s) {
111   NOTREACHED() << "Unexpected class type: " << type;
112   return nullptr;
113 }
114 
115 template <>
116 CefWrapperType CefCppToCRefCounted<CefResponseFilterCppToC,
117                                    CefResponseFilter,
118                                    cef_response_filter_t>::kWrapperType =
119     WT_RESPONSE_FILTER;
120