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

Unified Diff: third_party/protobuf/src/google/protobuf/generated_message_util.cc

Issue 1322483002: Revert https://codereview.chromium.org/1291903002 (protobuf roll). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/protobuf/src/google/protobuf/generated_message_util.cc
diff --git a/third_party/protobuf/src/google/protobuf/generated_message_util.cc b/third_party/protobuf/src/google/protobuf/generated_message_util.cc
index 8b3d037097946231474cd1eff0928881f9410488..92882d79ce7ae63cbf1964fc20474a0db6115609 100644
--- a/third_party/protobuf/src/google/protobuf/generated_message_util.cc
+++ b/third_party/protobuf/src/google/protobuf/generated_message_util.cc
@@ -1,6 +1,6 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
+// http://code.google.com/p/protobuf/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -36,7 +36,6 @@
#include <limits>
-
namespace google {
namespace protobuf {
namespace internal {
@@ -49,32 +48,15 @@ double NaN() {
}
const ::std::string* empty_string_;
-GOOGLE_PROTOBUF_DECLARE_ONCE(empty_string_once_init_);
-
-void DeleteEmptyString() {
- delete empty_string_;
-}
+ProtobufOnceType empty_string_once_init_;
void InitEmptyString() {
- empty_string_ = new string;
- OnShutdown(&DeleteEmptyString);
+ empty_string_ = new std::string();
}
const ::std::string& GetEmptyString() {
- ::google::protobuf::GoogleOnceInit(&empty_string_once_init_, &InitEmptyString);
- return GetEmptyStringAlreadyInited();
-}
-
-int StringSpaceUsedExcludingSelf(const string& str) {
- const void* start = &str;
- const void* end = &str + 1;
-
- if (start <= str.data() && str.data() < end) {
- // The string's data is stored inside the string object itself.
- return 0;
- } else {
- return str.capacity();
- }
+ GoogleOnceInit(&empty_string_once_init_, &InitEmptyString);
+ return *empty_string_;
}
} // namespace internal

Powered by Google App Engine
This is Rietveld 408576698