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

Unified Diff: courgette/streams.cc

Issue 6677141: Switch out use of std::string and std::vector for large allocations for a buffer class that doesn... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: fix linux build error. remove unnecessary call Created 9 years, 8 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 | « courgette/streams.h ('k') | courgette/win32_x86_generator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: courgette/streams.cc
===================================================================
--- courgette/streams.cc (revision 80344)
+++ courgette/streams.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -182,9 +182,7 @@
}
CheckBool SinkStream::Write(const void* data, size_t byte_count) {
- buffer_.append(static_cast<const char*>(data), byte_count);
- //TODO(tommi): return error on failure.
- return true;
+ return buffer_.append(static_cast<const char*>(data), byte_count);
}
CheckBool SinkStream::WriteVarint32(uint32 value) {
@@ -214,7 +212,7 @@
}
CheckBool SinkStream::Append(SinkStream* other) {
- bool ret = Write(other->buffer_.c_str(), other->buffer_.size());
+ bool ret = Write(other->buffer_.data(), other->buffer_.size());
if (ret)
other->Retire();
return ret;
@@ -222,7 +220,6 @@
void SinkStream::Retire() {
buffer_.clear();
- buffer_.reserve(0); // Non-binding request to reduce storage.
}
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « courgette/streams.h ('k') | courgette/win32_x86_generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698