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

Unified Diff: net/quic/crypto/crypto_framer.cc

Issue 157803007: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win_x64 compiler error fix Created 6 years, 10 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
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender.cc ('k') | net/quic/crypto/strike_register.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/crypto/crypto_framer.cc
diff --git a/net/quic/crypto/crypto_framer.cc b/net/quic/crypto/crypto_framer.cc
index f2e76827e25f323f2e6449940beb6806a2caec40..5cb16743e6905ad927a14ad1944237985b67ee63 100644
--- a/net/quic/crypto/crypto_framer.cc
+++ b/net/quic/crypto/crypto_framer.cc
@@ -24,28 +24,22 @@ const size_t kNumEntriesSize = sizeof(uint16);
// OneShotVisitor is a framer visitor that records a single handshake message.
class OneShotVisitor : public CryptoFramerVisitorInterface {
public:
- explicit OneShotVisitor(CryptoHandshakeMessage* out)
- : out_(out),
- error_(false),
- done_(false) {
- }
+ OneShotVisitor() : error_(false) {}
virtual void OnError(CryptoFramer* framer) OVERRIDE { error_ = true; }
virtual void OnHandshakeMessage(
const CryptoHandshakeMessage& message) OVERRIDE {
- *out_ = message;
- done_ = true;
+ out_.reset(new CryptoHandshakeMessage(message));
}
bool error() const { return error_; }
- bool done() const { return done_; }
+ CryptoHandshakeMessage* release() { return out_.release(); }
private:
- CryptoHandshakeMessage* const out_;
+ scoped_ptr<CryptoHandshakeMessage> out_;
bool error_;
- bool done_;
};
} // namespace
@@ -61,17 +55,16 @@ CryptoFramer::~CryptoFramer() {}
// static
CryptoHandshakeMessage* CryptoFramer::ParseMessage(StringPiece in) {
- scoped_ptr<CryptoHandshakeMessage> msg(new CryptoHandshakeMessage);
- OneShotVisitor visitor(msg.get());
+ OneShotVisitor visitor;
CryptoFramer framer;
framer.set_visitor(&visitor);
- if (!framer.ProcessInput(in) || visitor.error() || !visitor.done() ||
+ if (!framer.ProcessInput(in) || visitor.error() ||
framer.InputBytesRemaining()) {
return NULL;
}
- return msg.release();
+ return visitor.release();
}
bool CryptoFramer::ProcessInput(StringPiece input) {
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender.cc ('k') | net/quic/crypto/strike_register.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698