github.com/ckxng/wakeup@v0.0.0-20190105202853-90356a5f5a15/include/capi/cef_base_capi.h (about) 1 // Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. 2 // 3 // Redistribution and use in source and binary forms, with or without 4 // modification, are permitted provided that the following conditions are 5 // met: 6 // 7 // * Redistributions of source code must retain the above copyright 8 // notice, this list of conditions and the following disclaimer. 9 // * Redistributions in binary form must reproduce the above 10 // copyright notice, this list of conditions and the following disclaimer 11 // in the documentation and/or other materials provided with the 12 // distribution. 13 // * Neither the name of Google Inc. nor the name Chromium Embedded 14 // Framework nor the names of its contributors may be used to endorse 15 // or promote products derived from this software without specific prior 16 // written permission. 17 // 18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 30 31 #ifndef CEF_INCLUDE_CAPI_CEF_BASE_CAPI_H_ 32 #define CEF_INCLUDE_CAPI_CEF_BASE_CAPI_H_ 33 34 #ifdef __cplusplus 35 extern "C" { 36 #endif 37 38 #include "include/internal/cef_export.h" 39 #include "include/internal/cef_string.h" 40 #include "include/internal/cef_string_list.h" 41 #include "include/internal/cef_string_map.h" 42 #include "include/internal/cef_string_multimap.h" 43 #include "include/internal/cef_types.h" 44 45 /// 46 // Structure defining the reference count implementation functions. All 47 // framework structures must include the cef_base_t structure first. 48 /// 49 typedef struct _cef_base_t { 50 /// 51 // Size of the data structure. 52 /// 53 size_t size; 54 55 /// 56 // Increment the reference count. 57 /// 58 int (CEF_CALLBACK *add_ref)(struct _cef_base_t* self); 59 60 /// 61 // Decrement the reference count. Delete this object when no references 62 // remain. 63 /// 64 int (CEF_CALLBACK *release)(struct _cef_base_t* self); 65 66 /// 67 // Returns the current number of references. 68 /// 69 int (CEF_CALLBACK *get_refct)(struct _cef_base_t* self); 70 } cef_base_t; 71 72 73 // Check that the structure |s|, which is defined with a cef_base_t member named 74 // |base|, is large enough to contain the specified member |f|. 75 #define CEF_MEMBER_EXISTS(s, f) \ 76 ((intptr_t)&((s)->f) - (intptr_t)(s) + sizeof((s)->f) <= (s)->base.size) 77 78 #define CEF_MEMBER_MISSING(s, f) (!CEF_MEMBER_EXISTS(s, f) || !((s)->f)) 79 80 81 #ifdef __cplusplus 82 } 83 #endif 84 85 #endif // CEF_INCLUDE_CAPI_CEF_BASE_CAPI_H_