| Index: net/websockets/websocket_extension_parser.h
|
| diff --git a/net/websockets/websocket_extension_parser.h b/net/websockets/websocket_extension_parser.h
|
| index 6b2e4dc629873b50348d221283fe49d2afca5cc8..007040de291408aa411fa24eb172a7db6c6246e7 100644
|
| --- a/net/websockets/websocket_extension_parser.h
|
| +++ b/net/websockets/websocket_extension_parser.h
|
| @@ -8,6 +8,7 @@
|
| #include <string>
|
| #include <vector>
|
|
|
| +#include "base/compiler_specific.h"
|
| #include "base/strings/string_piece.h"
|
| #include "net/base/net_export.h"
|
| #include "net/websockets/websocket_extension.h"
|
| @@ -23,28 +24,28 @@ class NET_EXPORT_PRIVATE WebSocketExtensionParser {
|
| //
|
| // There must be no newline characters in the input. LWS-concatenation must
|
| // have already been done before calling this method.
|
| - void Parse(const char* data, size_t size);
|
| - void Parse(const std::string& data) {
|
| - Parse(data.data(), data.size());
|
| + //
|
| + // Returns true if the method was successful (no syntax error was found).
|
| + bool Parse(const char* data, size_t size);
|
| + bool Parse(const std::string& data) {
|
| + return Parse(data.data(), data.size());
|
| }
|
|
|
| - // Returns true if the last Parse() method call encountered any syntax error.
|
| - bool has_error() const { return has_error_; }
|
| // Returns the result of the last Parse() method call.
|
| const std::vector<WebSocketExtension>& extensions() const {
|
| return extensions_;
|
| }
|
|
|
| private:
|
| - // TODO(tyoshino): Make the following methods return success/fail.
|
| - void Consume(char c);
|
| - void ConsumeExtension(WebSocketExtension* extension);
|
| - void ConsumeExtensionParameter(WebSocketExtension::Parameter* parameter);
|
| - void ConsumeToken(base::StringPiece* token);
|
| - void ConsumeQuotedToken(std::string* token);
|
| + WARN_UNUSED_RESULT bool Consume(char c);
|
| + WARN_UNUSED_RESULT bool ConsumeExtension(WebSocketExtension* extension);
|
| + WARN_UNUSED_RESULT bool ConsumeExtensionParameter(
|
| + WebSocketExtension::Parameter* parameter);
|
| + WARN_UNUSED_RESULT bool ConsumeToken(base::StringPiece* token);
|
| + WARN_UNUSED_RESULT bool ConsumeQuotedToken(std::string* token);
|
| void ConsumeSpaces();
|
| - bool Lookahead(char c);
|
| - bool ConsumeIfMatch(char c);
|
| + WARN_UNUSED_RESULT bool Lookahead(char c);
|
| + WARN_UNUSED_RESULT bool ConsumeIfMatch(char c);
|
| size_t UnconsumedBytes() const { return end_ - current_; }
|
|
|
| static bool IsControl(char c);
|
| @@ -54,7 +55,6 @@ class NET_EXPORT_PRIVATE WebSocketExtensionParser {
|
| const char* current_;
|
| // The pointer of the end of the input string.
|
| const char* end_;
|
| - bool has_error_;
|
| std::vector<WebSocketExtension> extensions_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(WebSocketExtensionParser);
|
|
|