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

Issue 725443003: Avoid a string copy in URLRequestResourceBundleJob::GetData(). (Closed)

Created:
6 years, 1 month ago by Jeffrey Yasskin
Modified:
6 years, 1 month ago
Reviewers:
*danakj, Devlin, *mmenke
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, cbentzel+watch_chromium.org, erikwright+watch_chromium.org, jshin+watch_chromium.org, extensions-reviews_chromium.org, vadimt
Base URL:
https://chromium.googlesource.com/chromium/src.git@lkcr
Project:
chromium
Visibility:
Public.

Description

Avoid a string copy in URLRequestResourceBundleJob::GetData(). This adds a URLRequestSimpleJob::GetStringPieceData method with which a subclass can provide its own storage for the result string, instead of having to copy the whole thing into the URLRequestSimpleJob. I also made base::IsStringUTF8 take a StringPiece to avoid a copy there. BUG=422489 Committed: https://crrev.com/3edf2fec6af00f9a3928edf5b67e77464c47819a Cr-Commit-Position: refs/heads/master@{#304445}

Patch Set 1 #

Patch Set 2 : Fix streaming_utf8_validator_perftest.cc for IsStringUTF8(StringPiece). #

Total comments: 2

Patch Set 3 : Switch to RefCountedMemory. #

Total comments: 8

Patch Set 4 : Fix mmenke's comments: LoadDataResourceBytes() and better comments. #

Patch Set 5 : Fix spelling of GetRefcountedData #

Total comments: 4

Patch Set 6 : Tidy up #

Unified diffs Side-by-side diffs Delta from patch set Stats (+64 lines, -41 lines) Patch
M base/i18n/streaming_utf8_validator_perftest.cc View 1 1 chunk +4 lines, -0 lines 0 comments Download
M base/strings/string_util.h View 1 chunk +1 line, -1 line 0 comments Download
M base/strings/string_util.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/chrome_url_request_util.cc View 1 2 3 6 chunks +15 lines, -28 lines 0 comments Download
M net/url_request/url_request_simple_job.h View 1 2 3 4 5 4 chunks +17 lines, -4 lines 0 comments Download
M net/url_request/url_request_simple_job.cc View 1 2 4 chunks +26 lines, -7 lines 0 comments Download

Messages

Total messages: 16 (3 generated)
Jeffrey Yasskin
Dana for base/strings. Devlin for extensions. Matt for net: This is just the quickest of ...
6 years, 1 month ago (2014-11-14 20:45:11 UTC) #3
danakj
base LGTM
6 years, 1 month ago (2014-11-14 20:50:06 UTC) #4
Devlin
extensions lgtm, assuming the net/ change works.
6 years, 1 month ago (2014-11-14 22:05:32 UTC) #5
mmenke
https://codereview.chromium.org/725443003/diff/20001/net/url_request/url_request_simple_job.h File net/url_request/url_request_simple_job.h (right): https://codereview.chromium.org/725443003/diff/20001/net/url_request/url_request_simple_job.h#newcode51 net/url_request/url_request_simple_job.h:51: const CompletionCallback& callback); Could be instead take a base::RefCountedMemory? ...
6 years, 1 month ago (2014-11-14 22:46:40 UTC) #6
mmenke
On 2014/11/14 22:46:40, mmenke wrote: > https://codereview.chromium.org/725443003/diff/20001/net/url_request/url_request_simple_job.h > File net/url_request/url_request_simple_job.h (right): > > https://codereview.chromium.org/725443003/diff/20001/net/url_request/url_request_simple_job.h#newcode51 > ...
6 years, 1 month ago (2014-11-14 22:47:11 UTC) #7
Jeffrey Yasskin
https://codereview.chromium.org/725443003/diff/20001/net/url_request/url_request_simple_job.h File net/url_request/url_request_simple_job.h (right): https://codereview.chromium.org/725443003/diff/20001/net/url_request/url_request_simple_job.h#newcode51 net/url_request/url_request_simple_job.h:51: const CompletionCallback& callback); On 2014/11/14 22:46:40, mmenke wrote: > ...
6 years, 1 month ago (2014-11-15 02:34:20 UTC) #8
mmenke
https://codereview.chromium.org/725443003/diff/40001/chrome/browser/extensions/chrome_url_request_util.cc File chrome/browser/extensions/chrome_url_request_util.cc (right): https://codereview.chromium.org/725443003/diff/40001/chrome/browser/extensions/chrome_url_request_util.cc#newcode80 chrome/browser/extensions/chrome_url_request_util.cc:80: rb.GetRawDataResource(resource_id_); Can't you just replace this with rb.LoadDataResourceBytes(resource_id_); which ...
6 years, 1 month ago (2014-11-17 15:54:10 UTC) #9
Jeffrey Yasskin
Thanks! https://codereview.chromium.org/725443003/diff/40001/chrome/browser/extensions/chrome_url_request_util.cc File chrome/browser/extensions/chrome_url_request_util.cc (right): https://codereview.chromium.org/725443003/diff/40001/chrome/browser/extensions/chrome_url_request_util.cc#newcode80 chrome/browser/extensions/chrome_url_request_util.cc:80: rb.GetRawDataResource(resource_id_); On 2014/11/17 15:54:10, mmenke wrote: > Can't ...
6 years, 1 month ago (2014-11-17 17:16:23 UTC) #10
mmenke
LGTM https://codereview.chromium.org/725443003/diff/80001/net/url_request/url_request_simple_job.h File net/url_request/url_request_simple_job.h (right): https://codereview.chromium.org/725443003/diff/80001/net/url_request/url_request_simple_job.h#newcode51 net/url_request/url_request_simple_job.h:51: const CompletionCallback& callback) const; nit: Should probably be ...
6 years, 1 month ago (2014-11-17 17:32:25 UTC) #11
Jeffrey Yasskin
https://codereview.chromium.org/725443003/diff/80001/net/url_request/url_request_simple_job.h File net/url_request/url_request_simple_job.h (right): https://codereview.chromium.org/725443003/diff/80001/net/url_request/url_request_simple_job.h#newcode51 net/url_request/url_request_simple_job.h:51: const CompletionCallback& callback) const; On 2014/11/17 17:32:25, mmenke wrote: ...
6 years, 1 month ago (2014-11-17 17:40:08 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/725443003/100001
6 years, 1 month ago (2014-11-17 17:41:01 UTC) #14
commit-bot: I haz the power
Committed patchset #6 (id:100001)
6 years, 1 month ago (2014-11-17 18:44:23 UTC) #15
commit-bot: I haz the power
6 years, 1 month ago (2014-11-17 18:45:07 UTC) #16
Message was sent while issue was closed.
Patchset 6 (id:??) landed as
https://crrev.com/3edf2fec6af00f9a3928edf5b67e77464c47819a
Cr-Commit-Position: refs/heads/master@{#304445}

Powered by Google App Engine
This is Rietveld 408576698