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 #include "extensions/browser/api/cast_channel/cast_framer.h" | 5 #include "extensions/browser/api/cast_channel/cast_framer.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include "base/numerics/safe_conversions.h" | 9 #include "base/numerics/safe_conversions.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
11 #include "base/sys_byteorder.h" | 11 #include "base/sys_byteorder.h" |
12 #include "extensions/common/api/cast_channel/cast_channel.pb.h" | 12 #include "extensions/common/api/cast_channel/cast_channel.pb.h" |
13 | 13 |
14 namespace extensions { | 14 namespace extensions { |
15 namespace core_api { | 15 namespace api { |
16 namespace cast_channel { | 16 namespace cast_channel { |
17 MessageFramer::MessageFramer(scoped_refptr<net::GrowableIOBuffer> input_buffer) | 17 MessageFramer::MessageFramer(scoped_refptr<net::GrowableIOBuffer> input_buffer) |
18 : input_buffer_(input_buffer), error_(false) { | 18 : input_buffer_(input_buffer), error_(false) { |
19 Reset(); | 19 Reset(); |
20 } | 20 } |
21 | 21 |
22 MessageFramer::~MessageFramer() { | 22 MessageFramer::~MessageFramer() { |
23 } | 23 } |
24 | 24 |
25 MessageFramer::MessageHeader::MessageHeader() : message_size(0) { | 25 MessageFramer::MessageHeader::MessageHeader() : message_size(0) { |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 168 } |
169 | 169 |
170 void MessageFramer::Reset() { | 170 void MessageFramer::Reset() { |
171 current_element_ = HEADER; | 171 current_element_ = HEADER; |
172 message_bytes_received_ = 0; | 172 message_bytes_received_ = 0; |
173 body_size_ = 0; | 173 body_size_ = 0; |
174 input_buffer_->set_offset(0); | 174 input_buffer_->set_offset(0); |
175 } | 175 } |
176 | 176 |
177 } // namespace cast_channel | 177 } // namespace cast_channel |
178 } // namespace core_api | 178 } // namespace api |
179 } // namespace extensions | 179 } // namespace extensions |
OLD | NEW |