diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-22 21:57:00 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-22 21:57:00 +0000 |
commit | de14f58d3647435e7377630d44c53ef0c7ed20af (patch) | |
tree | aa235857ddcba6bb62a9d0933b46c955d9ac28f1 /webkit/glue/multipart_response_delegate.cc | |
parent | 6f13eb60c3d3e6f1d4027a58608538dfcf733d3d (diff) | |
download | chromium_src-de14f58d3647435e7377630d44c53ef0c7ed20af.zip chromium_src-de14f58d3647435e7377630d44c53ef0c7ed20af.tar.gz chromium_src-de14f58d3647435e7377630d44c53ef0c7ed20af.tar.bz2 |
Optimize memory usage in MultipartResponseDelegate by not using
std::string::substr so much.
TEST=Covered by existing tests.
Review URL: http://codereview.chromium.org/322007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29825 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/multipart_response_delegate.cc')
-rw-r--r-- | webkit/glue/multipart_response_delegate.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/webkit/glue/multipart_response_delegate.cc b/webkit/glue/multipart_response_delegate.cc index 2000b61..8870de9 100644 --- a/webkit/glue/multipart_response_delegate.cc +++ b/webkit/glue/multipart_response_delegate.cc @@ -103,7 +103,7 @@ void MultipartResponseDelegate::OnReceivedData(const char* data, return; } - if (data_.substr(0, boundary_.length()) != boundary_) { + if (0 != data_.compare(0, boundary_.length(), boundary_)) { data_ = boundary_ + "\n" + data_; } } @@ -131,7 +131,7 @@ void MultipartResponseDelegate::OnReceivedData(const char* data, if (boundary_pos > 0) { // Send the last data chunk. client_->didReceiveData(loader_, - data_.substr(0, boundary_pos).data(), + data_.data(), static_cast<int>(boundary_pos), length_received); } @@ -209,7 +209,7 @@ bool MultipartResponseDelegate::ParseHeaders() { // Eat headers std::string headers("\n"); - headers.append(data_.substr(0, line_end_pos)); + headers.append(data_, 0, line_end_pos); data_ = data_.substr(line_end_pos); // Create a WebURLResponse based on the original set of headers + the |