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

Unified Diff: third_party/protobuf/src/google/protobuf/message_lite.h

Issue 2600753002: Reverts third_party/protobuf: Update to HEAD (f52e188fe4) (Closed)
Patch Set: Created 4 years 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/message_lite.h
diff --git a/third_party/protobuf/src/google/protobuf/message_lite.h b/third_party/protobuf/src/google/protobuf/message_lite.h
index 5e5ed306810a7b8ee758b37273b368cf06a14d03..4c16f4c0572be88df0a702e8a5455d0ec78fc385 100644
--- a/third_party/protobuf/src/google/protobuf/message_lite.h
+++ b/third_party/protobuf/src/google/protobuf/message_lite.h
@@ -39,9 +39,7 @@
#ifndef GOOGLE_PROTOBUF_MESSAGE_LITE_H__
#define GOOGLE_PROTOBUF_MESSAGE_LITE_H__
-#include <climits>
#include <google/protobuf/stubs/common.h>
-#include <google/protobuf/stubs/logging.h>
namespace google {
@@ -53,9 +51,6 @@ namespace io {
class ZeroCopyInputStream;
class ZeroCopyOutputStream;
}
-namespace internal {
- class WireFormatLite;
-}
// Interface to light weight protocol messages.
//
@@ -83,7 +78,7 @@ namespace internal {
class LIBPROTOBUF_EXPORT MessageLite {
public:
inline MessageLite() {}
- virtual ~MessageLite() {}
+ virtual ~MessageLite();
// Basic Operations ------------------------------------------------
@@ -241,30 +236,23 @@ class LIBPROTOBUF_EXPORT MessageLite {
bool AppendPartialToString(string* output) const;
// Computes the serialized size of the message. This recursively calls
- // ByteSizeLong() on all embedded messages.
+ // ByteSize() on all embedded messages. If a subclass does not override
+ // this, it MUST override SetCachedSize().
//
- // ByteSizeLong() is generally linear in the number of fields defined for the
+ // ByteSize() is generally linear in the number of fields defined for the
// proto.
- virtual size_t ByteSizeLong() const = 0;
-
- // Legacy ByteSize() API.
- int ByteSize() const {
- size_t result = ByteSizeLong();
- GOOGLE_DCHECK_LE(result, static_cast<size_t>(INT_MAX));
- return static_cast<int>(result);
- }
-
- // Serializes the message without recomputing the size. The message must not
- // have changed since the last call to ByteSize(), and the value returned by
- // ByteSize must be non-negative. Otherwise the results are undefined.
+ virtual int ByteSize() const = 0;
+
+ // Serializes the message without recomputing the size. The message must
+ // not have changed since the last call to ByteSize(); if it has, the results
+ // are undefined.
virtual void SerializeWithCachedSizes(
io::CodedOutputStream* output) const = 0;
- // A version of SerializeWithCachedSizesToArray, below, that does
- // not guarantee deterministic serialization.
- virtual uint8* SerializeWithCachedSizesToArray(uint8* target) const {
- return InternalSerializeWithCachedSizesToArray(false, target);
- }
+ // Like SerializeWithCachedSizes, but writes directly to *target, returning
+ // a pointer to the byte immediately after the last byte written. "target"
+ // must point at a byte array of at least ByteSize() bytes.
+ virtual uint8* SerializeWithCachedSizesToArray(uint8* target) const;
// Returns the result of the last call to ByteSize(). An embedded message's
// size is needed both to serialize it (because embedded messages are
@@ -279,22 +267,7 @@ class LIBPROTOBUF_EXPORT MessageLite {
// method.)
virtual int GetCachedSize() const = 0;
- // Functions below here are not part of the public interface. It isn't
- // enforced, but they should be treated as private, and will be private
- // at some future time. Unfortunately the implementation of the "friend"
- // keyword in GCC is broken at the moment, but we expect it will be fixed.
-
- // Like SerializeWithCachedSizes, but writes directly to *target, returning
- // a pointer to the byte immediately after the last byte written. "target"
- // must point at a byte array of at least ByteSize() bytes. If deterministic
- // is true then we use deterministic serialization, e.g., map keys are sorted.
- // FOR INTERNAL USE ONLY!
- virtual uint8* InternalSerializeWithCachedSizesToArray(bool deterministic,
- uint8* target) const;
-
private:
- friend class internal::WireFormatLite;
-
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageLite);
};
« no previous file with comments | « third_party/protobuf/src/google/protobuf/message.cc ('k') | third_party/protobuf/src/google/protobuf/message_lite.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698