OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_FRAMER_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_FRAMER_H_ |
6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_FRAMER_H_ | 6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_FRAMER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "extensions/common/api/cast_channel.h" | 9 #include "extensions/common/api/cast_channel.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 // Reads bytes from |input_buffer_| and returns a new CastMessage if one | 35 // Reads bytes from |input_buffer_| and returns a new CastMessage if one |
36 // is fully read. | 36 // is fully read. |
37 // | 37 // |
38 // |num_bytes| The number of bytes received by a read operation. | 38 // |num_bytes| The number of bytes received by a read operation. |
39 // Value must be <= BytesRequested(). | 39 // Value must be <= BytesRequested(). |
40 // |message_length| Size of the deserialized message object, in bytes. For | 40 // |message_length| Size of the deserialized message object, in bytes. For |
41 // logging purposes. Set to zero if no message was parsed. | 41 // logging purposes. Set to zero if no message was parsed. |
42 // |error| The result of the ingest operation. Set to CHANNEL_ERROR_NONE | 42 // |error| The result of the ingest operation. Set to CHANNEL_ERROR_NONE |
43 // if no error occurred. | 43 // if no error occurred. |
44 // Returns A pointer to a parsed CastMessage if a message was received | 44 // Returns A pointer to a parsed CastMessage if a message was received |
45 // in its entirety, NULL otherwise. | 45 // in its entirety, nullptr otherwise. |
46 scoped_ptr<CastMessage> Ingest(size_t num_bytes, | 46 scoped_ptr<CastMessage> Ingest(size_t num_bytes, |
47 size_t* message_length, | 47 size_t* message_length, |
48 ChannelError* error); | 48 ChannelError* error); |
49 | 49 |
50 // Message header struct. If fields are added, be sure to update | 50 // Message header struct. If fields are added, be sure to update |
51 // header_size(). Public to allow use of *_size() methods in unit tests. | 51 // header_size(). Public to allow use of *_size() methods in unit tests. |
52 struct MessageHeader { | 52 struct MessageHeader { |
53 MessageHeader(); | 53 MessageHeader(); |
54 // Sets the message size. | 54 // Sets the message size. |
55 void SetMessageSize(size_t message_size); | 55 void SetMessageSize(size_t message_size); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 // Disables Ingest functionality is the parser receives invalid data. | 89 // Disables Ingest functionality is the parser receives invalid data. |
90 bool error_; | 90 bool error_; |
91 | 91 |
92 DISALLOW_COPY_AND_ASSIGN(MessageFramer); | 92 DISALLOW_COPY_AND_ASSIGN(MessageFramer); |
93 }; | 93 }; |
94 } // namespace cast_channel | 94 } // namespace cast_channel |
95 } // namespace core_api | 95 } // namespace core_api |
96 } // namespace extensions | 96 } // namespace extensions |
97 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_FRAMER_H_ | 97 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_FRAMER_H_ |
OLD | NEW |