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

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

Issue 1842653006: Update //third_party/protobuf to version 3. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 8 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/arenastring.cc
diff --git a/third_party/protobuf/python/google/protobuf/pyext/python_protobuf.cc b/third_party/protobuf/src/google/protobuf/arenastring.cc
similarity index 63%
rename from third_party/protobuf/python/google/protobuf/pyext/python_protobuf.cc
rename to third_party/protobuf/src/google/protobuf/arenastring.cc
index 1b1ab5d1dc7f4bf986884718c67d69a460232ada..5a22adabcfedd8be981358cb80f988fe7da1e31a 100644
--- a/third_party/protobuf/python/google/protobuf/pyext/python_protobuf.cc
+++ b/third_party/protobuf/src/google/protobuf/arenastring.cc
@@ -1,6 +1,6 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
+// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -28,36 +28,43 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Author: qrczak@google.com (Marcin Kowalczyk)
+// The ArenaString implementation is not included in the open-source release. Do
+// not include this file in the distribution.
-#include <google/protobuf/pyext/python_protobuf.h>
+#include <google/protobuf/arenastring.h>
namespace google {
namespace protobuf {
-namespace python {
+namespace internal {
-static const Message* GetCProtoInsidePyProtoStub(PyObject* msg) {
- return NULL;
+
+void ArenaStringPtr::AssignWithDefault(const ::std::string* default_value,
+ ArenaStringPtr value) {
+ const ::std::string* me = *UnsafeRawStringPointer();
+ const ::std::string* other = *value.UnsafeRawStringPointer();
+ // If the pointers are the same then do nothing.
+ if (me != other) {
+ SetNoArena(default_value, value.GetNoArena(default_value));
+ }
}
-static Message* MutableCProtoInsidePyProtoStub(PyObject* msg) {
- return NULL;
+
+::std::string* ArenaStringPtr::MutableNoArena(
+ const ::std::string* default_value) {
+ if (ptr_ == default_value) {
+ CreateInstanceNoArena(default_value);
+ }
+ return ptr_;
}
-// This is initialized with a default, stub implementation.
-// If python-google.protobuf.cc is loaded, the function pointer is overridden
-// with a full implementation.
-const Message* (*GetCProtoInsidePyProtoPtr)(PyObject* msg) =
- GetCProtoInsidePyProtoStub;
-Message* (*MutableCProtoInsidePyProtoPtr)(PyObject* msg) =
- MutableCProtoInsidePyProtoStub;
-const Message* GetCProtoInsidePyProto(PyObject* msg) {
- return GetCProtoInsidePyProtoPtr(msg);
-}
-Message* MutableCProtoInsidePyProto(PyObject* msg) {
- return MutableCProtoInsidePyProtoPtr(msg);
+void ArenaStringPtr::DestroyNoArena(const ::std::string* default_value) {
+ if (ptr_ != default_value) {
+ delete ptr_;
+ }
+ ptr_ = NULL;
}
-} // namespace python
+
+} // namespace internal
} // namespace protobuf
} // namespace google

Powered by Google App Engine
This is Rietveld 408576698