summaryrefslogtreecommitdiffstats
path: root/net/websockets/websocket_frame_parser.h
diff options
context:
space:
mode:
authortoyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-06 15:36:10 +0000
committertoyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-06 15:36:10 +0000
commitbe5a782e3d14f4019b18d1dfcf91d7e20f3d0e57 (patch)
tree8f5010aa6132ffbfdc73d5c522dbc7ca30165fac /net/websockets/websocket_frame_parser.h
parent8fef7430a5222bc786c669945d97139794618f54 (diff)
downloadchromium_src-be5a782e3d14f4019b18d1dfcf91d7e20f3d0e57.zip
chromium_src-be5a782e3d14f4019b18d1dfcf91d7e20f3d0e57.tar.gz
chromium_src-be5a782e3d14f4019b18d1dfcf91d7e20f3d0e57.tar.bz2
Add WebSocketError to indicate decoding failure reason
BUG=none TEST=net_unittests Review URL: https://chromiumcodereview.appspot.com/10824081 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150095 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/websockets/websocket_frame_parser.h')
-rw-r--r--net/websockets/websocket_frame_parser.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/net/websockets/websocket_frame_parser.h b/net/websockets/websocket_frame_parser.h
index a6d55ea..8f5c3ff 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);
};