Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: third_party/protobuf/src/google/protobuf/generated_message_util.cc

Issue 2746493002: Reland of Statically link libprotobuf_lite on Linux (Closed)
Patch Set: Really fix Win dbg Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Protocol Buffers - Google's data interchange format 1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved. 2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/ 3 // https://developers.google.com/protocol-buffers/
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
(...skipping 30 matching lines...) Expand all
41 namespace protobuf { 41 namespace protobuf {
42 namespace internal { 42 namespace internal {
43 43
44 double Infinity() { 44 double Infinity() {
45 return std::numeric_limits<double>::infinity(); 45 return std::numeric_limits<double>::infinity();
46 } 46 }
47 double NaN() { 47 double NaN() {
48 return std::numeric_limits<double>::quiet_NaN(); 48 return std::numeric_limits<double>::quiet_NaN();
49 } 49 }
50 50
51 const ::std::string* empty_string_;
52 GOOGLE_PROTOBUF_DECLARE_ONCE(empty_string_once_init_);
53
54 void DeleteEmptyString() { 51 void DeleteEmptyString() {
55 delete empty_string_; 52 delete cr_empty_string_;
56 } 53 }
57 54
58 void InitEmptyString() { 55 void InitEmptyString() {
59 empty_string_ = new string; 56 cr_empty_string_ = new string;
60 OnShutdown(&DeleteEmptyString); 57 OnShutdown(&DeleteEmptyString);
61 } 58 }
62 59
63 const ::std::string& GetEmptyString() { 60 const ::std::string& GetEmptyString() {
64 ::google::protobuf::GoogleOnceInit(&empty_string_once_init_, &InitEmptyString) ; 61 ::google::protobuf::GoogleOnceInit(&cr_empty_string_once_init_,
62 &InitEmptyString);
65 return GetEmptyStringAlreadyInited(); 63 return GetEmptyStringAlreadyInited();
66 } 64 }
67 65
68 66
69 int StringSpaceUsedExcludingSelf(const string& str) { 67 int StringSpaceUsedExcludingSelf(const string& str) {
70 const void* start = &str; 68 const void* start = &str;
71 const void* end = &str + 1; 69 const void* end = &str + 1;
72 if (start <= str.data() && str.data() < end) { 70 if (start <= str.data() && str.data() < end) {
73 // The string's data is stored inside the string object itself. 71 // The string's data is stored inside the string object itself.
74 return 0; 72 return 0;
75 } else { 73 } else {
76 return str.capacity(); 74 return str.capacity();
77 } 75 }
78 } 76 }
79 77
80 78
81 79
82 } // namespace internal 80 } // namespace internal
83 } // namespace protobuf 81 } // namespace protobuf
84 } // namespace google 82 } // namespace google
OLDNEW
« no previous file with comments | « third_party/protobuf/src/google/protobuf/generated_message_util.h ('k') | third_party/protobuf/src/google/protobuf/globals.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698