summaryrefslogtreecommitdiffstats
path: root/net/base/io_buffer.cc
diff options
context:
space:
mode:
authorjkarlin <jkarlin@chromium.org>2014-08-25 20:59:29 -0700
committerCommit bot <commit-bot@chromium.org>2014-08-26 04:00:22 +0000
commitb5ca81a3262238668cc4e59a90f51d7e8f6360d4 (patch)
treefe98f98cebc404df3c882837bdb60c7f5d55af22 /net/base/io_buffer.cc
parent80bc5e3ce73e2a306bec3aca8aa4d54b66b95d04 (diff)
downloadchromium_src-b5ca81a3262238668cc4e59a90f51d7e8f6360d4.zip
chromium_src-b5ca81a3262238668cc4e59a90f51d7e8f6360d4.tar.gz
chromium_src-b5ca81a3262238668cc4e59a90f51d7e8f6360d4.tar.bz2
Initial implementation of ServiceWorkerCache Put and Match functions.
Note that the Match() function copies the data into a memory blob. This is of course only for demo purposes. This will soon be changed to use a streaming API. See bug 403493. BUG=392621 Review URL: https://codereview.chromium.org/465463002 Cr-Commit-Position: refs/heads/master@{#291834}
Diffstat (limited to 'net/base/io_buffer.cc')
-rw-r--r--net/base/io_buffer.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/base/io_buffer.cc b/net/base/io_buffer.cc
index dd1d451..a375381 100644
--- a/net/base/io_buffer.cc
+++ b/net/base/io_buffer.cc
@@ -46,6 +46,13 @@ StringIOBuffer::StringIOBuffer(const std::string& s)
data_ = const_cast<char*>(string_data_.data());
}
+StringIOBuffer::StringIOBuffer(scoped_ptr<std::string> s)
+ : IOBuffer(static_cast<char*>(NULL)) {
+ CHECK_LT(s->size(), static_cast<size_t>(INT_MAX));
+ string_data_.swap(*s.get());
+ data_ = const_cast<char*>(string_data_.data());
+}
+
StringIOBuffer::~StringIOBuffer() {
// We haven't allocated the buffer, so remove it before the base class
// destructor tries to delete[] it.