Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit adc0aeca authored by Yi Jin's avatar Yi Jin Committed by Android (Google) Code Review
Browse files

Merge "Expose how many bytes are written in ProtoOutputStream"

parents 87c58f95 0abdfb08
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -109,6 +109,12 @@ public:
    long long start(uint64_t fieldId);
    void end(long long token);

    /**
     * Returns how many bytes are buffered in ProtoOutputStream.
     * Notice, this is not the actual(compact) size of the output data.
     */
    size_t bytesWritten();

    /**
     * Flushes the protobuf data out to given fd. When the following functions are called,
     * it is not able to write to ProtoOutputStream any more since the data is compact.
+6 −0
Original line number Diff line number Diff line
@@ -295,6 +295,12 @@ ProtoOutputStream::end(long long token)
    }
}

size_t
ProtoOutputStream::bytesWritten()
{
    return mBuffer.size();
}

bool
ProtoOutputStream::compact() {
    if (mCompact) return true;