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

Side by Side Diff: extensions/browser/api/cast_channel/cast_framer.cc

Issue 2137013005: [Extensions] Code Cleanup - Remove redundant smart-ptr get()s (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 unified diff | Download patch
OLDNEW
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 <limits> 9 #include <limits>
10 10
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 DCHECK_EQ(base::checked_cast<int32_t>(message_bytes_received_), 126 DCHECK_EQ(base::checked_cast<int32_t>(message_bytes_received_),
127 input_buffer_->offset()); 127 input_buffer_->offset());
128 CHECK_LE(num_bytes, BytesRequested()); 128 CHECK_LE(num_bytes, BytesRequested());
129 message_bytes_received_ += num_bytes; 129 message_bytes_received_ += num_bytes;
130 *error = CHANNEL_ERROR_NONE; 130 *error = CHANNEL_ERROR_NONE;
131 *message_length = 0; 131 *message_length = 0;
132 switch (current_element_) { 132 switch (current_element_) {
133 case HEADER: 133 case HEADER:
134 if (BytesRequested() == 0) { 134 if (BytesRequested() == 0) {
135 MessageHeader header; 135 MessageHeader header;
136 MessageHeader::Deserialize(input_buffer_.get()->StartOfBuffer(), 136 MessageHeader::Deserialize(input_buffer_->StartOfBuffer(), &header);
137 &header);
138 if (header.message_size > MessageHeader::max_message_size()) { 137 if (header.message_size > MessageHeader::max_message_size()) {
139 VLOG(1) << "Error parsing header (message size too large)."; 138 VLOG(1) << "Error parsing header (message size too large).";
140 *error = CHANNEL_ERROR_INVALID_MESSAGE; 139 *error = CHANNEL_ERROR_INVALID_MESSAGE;
141 error_ = true; 140 error_ = true;
142 return nullptr; 141 return nullptr;
143 } 142 }
144 current_element_ = BODY; 143 current_element_ = BODY;
145 body_size_ = header.message_size; 144 body_size_ = header.message_size;
146 } 145 }
147 break; 146 break;
(...skipping 25 matching lines...) Expand all
173 void MessageFramer::Reset() { 172 void MessageFramer::Reset() {
174 current_element_ = HEADER; 173 current_element_ = HEADER;
175 message_bytes_received_ = 0; 174 message_bytes_received_ = 0;
176 body_size_ = 0; 175 body_size_ = 0;
177 input_buffer_->set_offset(0); 176 input_buffer_->set_offset(0);
178 } 177 }
179 178
180 } // namespace cast_channel 179 } // namespace cast_channel
181 } // namespace api 180 } // namespace api
182 } // namespace extensions 181 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/cast_channel/cast_channel_api.cc ('k') | extensions/browser/api/device_permissions_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698