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/extension_set.h> |
| 32 #include <google/protobuf/generated_message_util.h> |
| 33 #include <google/protobuf/stubs/atomicops.h> |
| 34 #include <google/protobuf/stubs/hash.h> |
| 35 |
| 36 namespace google { |
| 37 namespace protobuf { |
| 38 namespace internal { |
| 39 |
| 40 SequenceNumber cr_lifecycle_id_generator_; |
| 41 |
| 42 const ::std::string* cr_empty_string_; |
| 43 GOOGLE_PROTOBUF_DECLARE_ONCE(cr_empty_string_once_init_); |
| 44 |
| 45 const RepeatedField<int32>* |
| 46 RepeatedPrimitiveGenericTypeTraits::cr_default_repeated_field_int32_ = NULL; |
| 47 const RepeatedField<int64>* |
| 48 RepeatedPrimitiveGenericTypeTraits::cr_default_repeated_field_int64_ = NULL; |
| 49 const RepeatedField<uint32>* |
| 50 RepeatedPrimitiveGenericTypeTraits::cr_default_repeated_field_uint32_ = |
| 51 NULL; |
| 52 const RepeatedField<uint64>* |
| 53 RepeatedPrimitiveGenericTypeTraits::cr_default_repeated_field_uint64_ = |
| 54 NULL; |
| 55 const RepeatedField<double>* |
| 56 RepeatedPrimitiveGenericTypeTraits::cr_default_repeated_field_double_ = |
| 57 NULL; |
| 58 const RepeatedField<float>* |
| 59 RepeatedPrimitiveGenericTypeTraits::cr_default_repeated_field_float_ = NULL; |
| 60 const RepeatedField<bool>* |
| 61 RepeatedPrimitiveGenericTypeTraits::cr_default_repeated_field_bool_ = NULL; |
| 62 const RepeatedStringTypeTraits::RepeatedFieldType* |
| 63 RepeatedStringTypeTraits::cr_default_repeated_field_ = NULL; |
| 64 const RepeatedMessageGenericTypeTraits::RepeatedFieldType* |
| 65 RepeatedMessageGenericTypeTraits::cr_default_repeated_field_ = NULL; |
| 66 |
| 67 LIBPROTOBUF_EXPORT vector<void (*)()>* cr_shutdown_functions = NULL; |
| 68 LIBPROTOBUF_EXPORT Mutex* cr_shutdown_functions_mutex = NULL; |
| 69 LIBPROTOBUF_EXPORT GOOGLE_PROTOBUF_DECLARE_ONCE(cr_shutdown_functions_init); |
| 70 |
| 71 LIBPROTOBUF_EXPORT LogHandler* cr_log_handler_ = NULL; |
| 72 LIBPROTOBUF_EXPORT int cr_log_silencer_count_ = 0; |
| 73 |
| 74 LIBPROTOBUF_EXPORT Mutex* cr_log_silencer_count_mutex_ = NULL; |
| 75 LIBPROTOBUF_EXPORT GOOGLE_PROTOBUF_DECLARE_ONCE(cr_log_silencer_count_init_); |
| 76 |
| 77 GOOGLE_PROTOBUF_DECLARE_ONCE( |
| 78 cr_repeated_primitive_generic_type_traits_once_init_); |
| 79 GOOGLE_PROTOBUF_DECLARE_ONCE(cr_repeated_string_type_traits_once_init_); |
| 80 GOOGLE_PROTOBUF_DECLARE_ONCE( |
| 81 cr_repeated_message_generic_type_traits_once_init_); |
| 82 |
| 83 LIBPROTOBUF_EXPORT hash_map<pair<const MessageLite*, int>, ExtensionInfo>* |
| 84 cr_registry_ = NULL; |
| 85 LIBPROTOBUF_EXPORT GOOGLE_PROTOBUF_DECLARE_ONCE(cr_registry_init_); |
| 86 |
| 87 LIBPROTOBUF_EXPORT bool cr_module_initialized_ = false; |
| 88 struct InitDetector { |
| 89 InitDetector() { cr_module_initialized_ = true; } |
| 90 }; |
| 91 InitDetector cr_init_detector; |
| 92 |
| 93 #ifdef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_X86_GCC_H_ |
| 94 // Set the flags so that code will run correctly and conservatively, so even |
| 95 // if we haven't been initialized yet, we're probably single threaded, and our |
| 96 // default values should hopefully be pretty safe. |
| 97 LIBPROTOBUF_EXPORT struct AtomicOps_x86CPUFeatureStruct |
| 98 cr_AtomicOps_Internalx86CPUFeatures = { |
| 99 false, // bug can't exist before process spawns multiple threads |
| 100 false, // no SSE2 |
| 101 }; |
| 102 |
| 103 class AtomicOpsx86Initializer { |
| 104 public: |
| 105 AtomicOpsx86Initializer() { AtomicOps_Internalx86CPUFeaturesInit(); } |
| 106 }; |
| 107 |
| 108 AtomicOpsx86Initializer cr_g_initer; |
| 109 #endif |
| 110 |
| 111 } // namespace internal |
| 112 } // namespace protobuf |
| 113 } // namespace google |
OLD | NEW |