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

Unified Diff: content/public/child/fixed_received_data.cc

Issue 1103813002: Make WebURLLoader capable of retaining received buffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/child/fixed_received_data.h ('k') | content/public/child/request_peer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/child/fixed_received_data.cc
diff --git a/content/public/child/fixed_received_data.cc b/content/public/child/fixed_received_data.cc
new file mode 100644
index 0000000000000000000000000000000000000000..773a3fd9725d8c24e8430d1dcab15934287ea1e2
--- /dev/null
+++ b/content/public/child/fixed_received_data.cc
@@ -0,0 +1,41 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/public/child/fixed_received_data.h"
+
+namespace content {
+
+FixedReceivedData::FixedReceivedData(const char* data,
+ size_t length,
+ int encoded_length)
+ : data_(data, data + length), encoded_length_(encoded_length) {
+}
+
+FixedReceivedData::FixedReceivedData(scoped_ptr<ReceivedData> data)
+ : FixedReceivedData(data->payload(),
+ data->encoded_length(),
+ data->encoded_length()) {
+}
+
+FixedReceivedData::FixedReceivedData(const std::vector<char>& data,
+ int encoded_length)
+ : data_(data), encoded_length_(encoded_length) {
+}
+
+FixedReceivedData::~FixedReceivedData() {
+}
+
+const char* FixedReceivedData::payload() const {
+ return data_.empty() ? nullptr : &data_[0];
+}
+
+int FixedReceivedData::length() const {
+ return static_cast<int>(data_.size());
+}
+
+int FixedReceivedData::encoded_length() const {
+ return encoded_length_;
+}
+
+} // namespace content
« no previous file with comments | « content/public/child/fixed_received_data.h ('k') | content/public/child/request_peer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698