| OLD | NEW |
| (Empty) |
| 1 // Protocol Buffers - Google's data interchange format | |
| 2 // Copyright 2017 Google Inc. All rights reserved. | |
| 3 // https://developers.google.com/protocol-buffers/ | |
| 4 // | |
| 5 // Redistribution and use in source and binary forms, with or without | |
| 6 // modification, are permitted provided that the following conditions are | |
| 7 // met: | |
| 8 // | |
| 9 // * Redistributions of source code must retain the above copyright | |
| 10 // notice, this list of conditions and the following disclaimer. | |
| 11 // * Redistributions in binary form must reproduce the above | |
| 12 // copyright notice, this list of conditions and the following disclaimer | |
| 13 // in the documentation and/or other materials provided with the | |
| 14 // distribution. | |
| 15 // * Neither the name of Google Inc. nor the names of its | |
| 16 // contributors may be used to endorse or promote products derived from | |
| 17 // this software without specific prior written permission. | |
| 18 // | |
| 19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 30 | |
| 31 #include <google/protobuf/arena.h> | |
| 32 #include <google/protobuf/extension_set.h> | |
| 33 #include <google/protobuf/generated_message_util.h> | |
| 34 #include <google/protobuf/stubs/atomicops.h> | |
| 35 #include <google/protobuf/stubs/hash.h> | |
| 36 | |
| 37 namespace google { | |
| 38 namespace protobuf { | |
| 39 | |
| 40 #if !defined(GOOGLE_PROTOBUF_NO_THREADLOCAL) && defined(PROTOBUF_USE_DLLS) | |
| 41 Arena::ThreadCache& Arena::cr_thread_cache() { | |
| 42 static GOOGLE_THREAD_LOCAL ThreadCache cr_thread_cache_ = {-1, NULL}; | |
| 43 return cr_thread_cache_; | |
| 44 } | |
| 45 #endif | |
| 46 | |
| 47 namespace internal { | |
| 48 | |
| 49 SequenceNumber cr_lifecycle_id_generator_; | |
| 50 | |
| 51 const ::std::string* cr_empty_string_; | |
| 52 GOOGLE_PROTOBUF_DECLARE_ONCE(cr_empty_string_once_init_); | |
| 53 | |
| 54 const RepeatedField<int32>* | |
| 55 RepeatedPrimitiveGenericTypeTraits::cr_default_repeated_field_int32_ = NULL; | |
| 56 const RepeatedField<int64>* | |
| 57 RepeatedPrimitiveGenericTypeTraits::cr_default_repeated_field_int64_ = NULL; | |
| 58 const RepeatedField<uint32>* | |
| 59 RepeatedPrimitiveGenericTypeTraits::cr_default_repeated_field_uint32_ = | |
| 60 NULL; | |
| 61 const RepeatedField<uint64>* | |
| 62 RepeatedPrimitiveGenericTypeTraits::cr_default_repeated_field_uint64_ = | |
| 63 NULL; | |
| 64 const RepeatedField<double>* | |
| 65 RepeatedPrimitiveGenericTypeTraits::cr_default_repeated_field_double_ = | |
| 66 NULL; | |
| 67 const RepeatedField<float>* | |
| 68 RepeatedPrimitiveGenericTypeTraits::cr_default_repeated_field_float_ = NULL; | |
| 69 const RepeatedField<bool>* | |
| 70 RepeatedPrimitiveGenericTypeTraits::cr_default_repeated_field_bool_ = NULL; | |
| 71 const RepeatedStringTypeTraits::RepeatedFieldType* | |
| 72 RepeatedStringTypeTraits::cr_default_repeated_field_ = NULL; | |
| 73 const RepeatedMessageGenericTypeTraits::RepeatedFieldType* | |
| 74 RepeatedMessageGenericTypeTraits::cr_default_repeated_field_ = NULL; | |
| 75 | |
| 76 LIBPROTOBUF_EXPORT vector<void (*)()>* cr_shutdown_functions = NULL; | |
| 77 LIBPROTOBUF_EXPORT Mutex* cr_shutdown_functions_mutex = NULL; | |
| 78 LIBPROTOBUF_EXPORT GOOGLE_PROTOBUF_DECLARE_ONCE(cr_shutdown_functions_init); | |
| 79 | |
| 80 LIBPROTOBUF_EXPORT LogHandler* cr_log_handler_ = NULL; | |
| 81 LIBPROTOBUF_EXPORT int cr_log_silencer_count_ = 0; | |
| 82 | |
| 83 LIBPROTOBUF_EXPORT Mutex* cr_log_silencer_count_mutex_ = NULL; | |
| 84 LIBPROTOBUF_EXPORT GOOGLE_PROTOBUF_DECLARE_ONCE(cr_log_silencer_count_init_); | |
| 85 | |
| 86 GOOGLE_PROTOBUF_DECLARE_ONCE( | |
| 87 cr_repeated_primitive_generic_type_traits_once_init_); | |
| 88 GOOGLE_PROTOBUF_DECLARE_ONCE(cr_repeated_string_type_traits_once_init_); | |
| 89 GOOGLE_PROTOBUF_DECLARE_ONCE( | |
| 90 cr_repeated_message_generic_type_traits_once_init_); | |
| 91 | |
| 92 LIBPROTOBUF_EXPORT hash_map<pair<const MessageLite*, int>, ExtensionInfo>* | |
| 93 cr_registry_ = NULL; | |
| 94 LIBPROTOBUF_EXPORT GOOGLE_PROTOBUF_DECLARE_ONCE(cr_registry_init_); | |
| 95 | |
| 96 LIBPROTOBUF_EXPORT bool cr_module_initialized_ = false; | |
| 97 struct InitDetector { | |
| 98 InitDetector() { cr_module_initialized_ = true; } | |
| 99 }; | |
| 100 InitDetector cr_init_detector; | |
| 101 | |
| 102 #ifdef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_X86_GCC_H_ | |
| 103 // Set the flags so that code will run correctly and conservatively, so even | |
| 104 // if we haven't been initialized yet, we're probably single threaded, and our | |
| 105 // default values should hopefully be pretty safe. | |
| 106 LIBPROTOBUF_EXPORT struct AtomicOps_x86CPUFeatureStruct | |
| 107 cr_AtomicOps_Internalx86CPUFeatures = { | |
| 108 false, // bug can't exist before process spawns multiple threads | |
| 109 false, // no SSE2 | |
| 110 }; | |
| 111 | |
| 112 class AtomicOpsx86Initializer { | |
| 113 public: | |
| 114 AtomicOpsx86Initializer() { AtomicOps_Internalx86CPUFeaturesInit(); } | |
| 115 }; | |
| 116 | |
| 117 AtomicOpsx86Initializer cr_g_initer; | |
| 118 #endif | |
| 119 | |
| 120 } // namespace internal | |
| 121 } // namespace protobuf | |
| 122 } // namespace google | |
| OLD | NEW |