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

Unified Diff: net/websockets/websocket_frame_parser.h

Issue 10824081: Add WebSocketError to indicate decoding failure reason (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed, ready for commit Created 8 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
« no previous file with comments | « net/websockets/websocket_errors.cc ('k') | net/websockets/websocket_frame_parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/websockets/websocket_frame_parser.h
diff --git a/net/websockets/websocket_frame_parser.h b/net/websockets/websocket_frame_parser.h
index a6d55ea16355429dd65d8d04115298b3bb1b22d1..8f5c3ff2a2b05ff5278938e8ad192a6606092a10 100644
--- a/net/websockets/websocket_frame_parser.h
+++ b/net/websockets/websocket_frame_parser.h
@@ -12,6 +12,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "net/base/net_export.h"
+#include "net/websockets/websocket_errors.h"
#include "net/websockets/websocket_frame.h"
namespace net {
@@ -39,9 +40,11 @@ class NET_EXPORT_PRIVATE WebSocketFrameParser {
size_t length,
ScopedVector<WebSocketFrameChunk>* frame_chunks);
- // Returns true if the parser has ever failed to decode a WebSocket frame.
- // TODO(yutak): Provide human-readable description of failure.
- bool failed() const { return failed_; }
+ // Returns WEB_SOCKET_OK if the parser has not failed to decode WebSocket
+ // frames. Otherwise returns WebSocketError which is defined in
+ // websocket_errors.h. We can convert net::WebSocketError to net::Error by
+ // using WebSocketErrorToNetError().
+ WebSocketError websocket_error() const { return websocket_error_; }
private:
// Tries to decode a frame header from |current_read_pos_|.
@@ -74,7 +77,7 @@ class NET_EXPORT_PRIVATE WebSocketFrameParser {
// Amount of payload data read so far for the current frame.
uint64 frame_offset_;
- bool failed_;
+ WebSocketError websocket_error_;
DISALLOW_COPY_AND_ASSIGN(WebSocketFrameParser);
};
« no previous file with comments | « net/websockets/websocket_errors.cc ('k') | net/websockets/websocket_frame_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698