aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/arena.h
diff options
context:
space:
mode:
authorGravatar Feng Xiao <xfxyjwf@gmail.com>2014-12-09 17:05:10 -0800
committerGravatar Feng Xiao <xfxyjwf@gmail.com>2014-12-09 17:05:10 -0800
commit8d5d7cc6d03b00fcb7162525100fbd4cc0d1929d (patch)
tree8539b1dce0ae68029b7d74911acaec0ebad353e6 /src/google/protobuf/arena.h
parent496d47c27fd4301411156ebf108188b810f4e902 (diff)
Fix LIBPROTOBUF_PROTOBUF annotations for buliding protobuf as DLLs.
Diffstat (limited to 'src/google/protobuf/arena.h')
-rw-r--r--src/google/protobuf/arena.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/google/protobuf/arena.h b/src/google/protobuf/arena.h
index b5822bdb..d0cb163c 100644
--- a/src/google/protobuf/arena.h
+++ b/src/google/protobuf/arena.h
@@ -312,7 +312,12 @@ class LIBPROTOBUF_EXPORT Arena {
static const size_t kHeaderSize = sizeof(Block);
static google::protobuf::internal::SequenceNumber lifecycle_id_generator_;
+#ifdef PROTOBUF_USE_DLLS
+ static ThreadCache& thread_cache();
+#else
static GOOGLE_THREAD_LOCAL ThreadCache thread_cache_;
+ static ThreadCache& thread_cache() { return thread_cache_; }
+#endif
// SFINAE for skipping addition to delete list for a Type. This is mainly to
// skip proto2/proto1 message objects with cc_enable_arenas=true from being
@@ -434,8 +439,8 @@ class LIBPROTOBUF_EXPORT Arena {
void CleanupList();
inline void SetThreadCacheBlock(Block* block) {
- thread_cache_.last_block_used_ = block;
- thread_cache_.last_lifecycle_id_seen = lifecycle_id_;
+ thread_cache().last_block_used_ = block;
+ thread_cache().last_lifecycle_id_seen = lifecycle_id_;
}
int64 lifecycle_id_; // Unique for each arena. Changes on Reset().