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

Side by Side Diff: content/public/child/fixed_received_data.cc

Issue 2540023003: Dispatch encoded_data_length separately in content/child (Closed)
Patch Set: rebase Created 4 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/public/child/fixed_received_data.h" 5 #include "content/public/child/fixed_received_data.h"
6 6
7 namespace content { 7 namespace content {
8 8
9 FixedReceivedData::FixedReceivedData(const char* data, 9 FixedReceivedData::FixedReceivedData(const char* data, size_t length)
10 size_t length, 10 : data_(data, data + length) {}
11 int encoded_data_length)
12 : data_(data, data + length), encoded_data_length_(encoded_data_length) {}
13 11
14 FixedReceivedData::FixedReceivedData(ReceivedData* data) 12 FixedReceivedData::FixedReceivedData(ReceivedData* data)
15 : FixedReceivedData(data->payload(), 13 : FixedReceivedData(data->payload(), data->length()) {}
16 data->length(),
17 data->encoded_data_length()) {}
18 14
19 FixedReceivedData::FixedReceivedData(const std::vector<char>& data, 15 FixedReceivedData::FixedReceivedData(const std::vector<char>& data)
20 int encoded_data_length) 16 : data_(data) {}
21 : data_(data), encoded_data_length_(encoded_data_length) {}
22 17
23 FixedReceivedData::~FixedReceivedData() { 18 FixedReceivedData::~FixedReceivedData() {
24 } 19 }
25 20
26 const char* FixedReceivedData::payload() const { 21 const char* FixedReceivedData::payload() const {
27 return data_.empty() ? nullptr : &data_[0]; 22 return data_.empty() ? nullptr : &data_[0];
28 } 23 }
29 24
30 int FixedReceivedData::length() const { 25 int FixedReceivedData::length() const {
31 return static_cast<int>(data_.size()); 26 return static_cast<int>(data_.size());
32 } 27 }
33 28
34 int FixedReceivedData::encoded_data_length() const {
35 return encoded_data_length_;
36 }
37
38 } // namespace content 29 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698