Path: blob/master/thirdparty/brotli/common/static_init.h
14710 views
/* Copyright 2025 Google Inc. All Rights Reserved.12Distributed under MIT license.3See file LICENSE for detail or copy at https://opensource.org/licenses/MIT4*/56/*7Central point for static initialization.89In case of "lazy" mode `BrotliXxxLazyStaticInit` is not provided by the10library. Embedder is responsible for providing it. This function should call11`BrotliXxxLazyStaticInitInner` on the first invocation. This function should12not return until execution of `BrotliXxxLazyStaticInitInner` is finished.13In C or before C++11 it is possible to call `BrotliXxxLazyStaticInitInner`14on start-up path and then `BrotliEncoderLazyStaticInit` is could be no-op;15another option is to use available thread execution controls to meet the16requirements. For possible C++11 implementation see static_init_lazy.cc.17*/1819#ifndef THIRD_PARTY_BROTLI_COMMON_STATIC_INIT_H_20#define THIRD_PARTY_BROTLI_COMMON_STATIC_INIT_H_2122#if defined(__cplusplus) || defined(c_plusplus)23extern "C" {24#endif2526/* Static data is "initialized" in compile time. */27#define BROTLI_STATIC_INIT_NONE 028/* Static data is initialized before "main". */29#define BROTLI_STATIC_INIT_EARLY 130/* Static data is initialized when first encoder is created. */31#define BROTLI_STATIC_INIT_LAZY 23233#define BROTLI_STATIC_INIT_DEFAULT BROTLI_STATIC_INIT_NONE3435#if !defined(BROTLI_STATIC_INIT)36#define BROTLI_STATIC_INIT BROTLI_STATIC_INIT_DEFAULT37#endif3839#if (BROTLI_STATIC_INIT != BROTLI_STATIC_INIT_NONE) && \40(BROTLI_STATIC_INIT != BROTLI_STATIC_INIT_EARLY) && \41(BROTLI_STATIC_INIT != BROTLI_STATIC_INIT_LAZY)42#error Invalid value for BROTLI_STATIC_INIT43#endif4445#if (BROTLI_STATIC_INIT == BROTLI_STATIC_INIT_EARLY)46#if defined(BROTLI_EXTERNAL_DICTIONARY_DATA)47#error BROTLI_STATIC_INIT_EARLY will fail with BROTLI_EXTERNAL_DICTIONARY_DATA48#endif49#endif /* BROTLI_STATIC_INIT */5051#if defined(__cplusplus) || defined(c_plusplus)52} /* extern "C" */53#endif5455#endif // THIRD_PARTY_BROTLI_COMMON_STATIC_INIT_H_565758