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

Issue 2624583002: Remove redundant c_str() calls. (Closed)

Created:
3 years, 11 months ago by Andrey Kraynov
Modified:
3 years, 8 months ago
CC:
chromium-reviews, extensions-reviews_chromium.org, vmpstr+watch_chromium.org, wfh+watch_chromium.org, donnd+watch_chromium.org, Randy Smith (Not in Mondays), loading-reviews_chromium.org, twellington+watch_chromium.org, pfeldman, devtools-reviews_chromium.org, tracing+reviews_chromium.org, chromium-apps-reviews_chromium.org, jshin+watch_chromium.org, Mark Larson
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Remove redundant c_str() calls. It seems, there are lot of redundant calls to std::basic_string<>::c_str() or base::StringPiece::c_str() when passing parameters to different functions. When a result of |string.c_str()| expression is passed to a function that takes a StringPiece, it will measure the length of the string using strlen() function. This is useless operation because we know the length already. Even worse, if target function takes a |std::string| then passing c_str() to it will lead to copying the string and wasting memory. No behaviour changes. BUG=679479 Review-Url: https://codereview.chromium.org/2624583002 Cr-Commit-Position: refs/heads/master@{#460066} Committed: https://chromium.googlesource.com/chromium/src/+/4b80ef168dc0dbeef5acf70771884678ce65fe00

Patch Set 1 #

Total comments: 6

Patch Set 2 : Replace host() with host_piece() call #

Patch Set 3 : Rebase #

Patch Set 4 : Revert some changes #

Unified diffs Side-by-side diffs Delta from patch set Stats (+23 lines, -27 lines) Patch
M base/environment.cc View 1 chunk +1 line, -1 line 0 comments Download
M base/i18n/file_util_icu.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/android/contextualsearch/contextual_search_manager.cc View 1 2 3 chunks +12 lines, -15 lines 0 comments Download
M chrome/browser/android/contextualsearch/ctr_suppression.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/android/history_report/delta_file_backend_leveldb.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/android/preferences/website_preference_bridge.cc View 1 2 1 chunk +1 line, -2 lines 0 comments Download
M chrome/browser/component_updater/pnacl_component_installer.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/component_updater/recovery_component_installer.cc View 1 2 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 41 (17 generated)
Andrey Kraynov
Hi! Here i tried to remove some redundant calls to c_str() function. Changes are pretty ...
3 years, 11 months ago (2017-01-09 21:50:45 UTC) #3
Primiano Tucci (use gerrit)
https://codereview.chromium.org/2624583002/diff/1/base/trace_event/trace_config.cc File base/trace_event/trace_config.cc (right): https://codereview.chromium.org/2624583002/diff/1/base/trace_event/trace_config.cc#newcode858 base/trace_event/trace_config.cc:858: bool TraceConfig::IsCategoryEnabled(StringPiece category_name) const { On 2017/01/09 21:50:45, Andrey ...
3 years, 11 months ago (2017-01-09 23:52:37 UTC) #6
Charlie Harrison
https://codereview.chromium.org/2624583002/diff/1/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc File chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc (right): https://codereview.chromium.org/2624583002/diff/1/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc#newcode777 chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc:777: request->url().DomainIs(webstore_url.host())) { Drive-by: this does a string copy. You ...
3 years, 11 months ago (2017-01-10 00:20:35 UTC) #8
Andrey Kraynov
https://codereview.chromium.org/2624583002/diff/1/base/trace_event/trace_config.cc File base/trace_event/trace_config.cc (right): https://codereview.chromium.org/2624583002/diff/1/base/trace_event/trace_config.cc#newcode858 base/trace_event/trace_config.cc:858: bool TraceConfig::IsCategoryEnabled(StringPiece category_name) const { On 2017/01/09 23:52:37, Primiano ...
3 years, 11 months ago (2017-01-10 06:24:53 UTC) #9
Primiano Tucci (use gerrit)
https://codereview.chromium.org/2624583002/diff/1/base/trace_event/trace_config.cc File base/trace_event/trace_config.cc (right): https://codereview.chromium.org/2624583002/diff/1/base/trace_event/trace_config.cc#newcode858 base/trace_event/trace_config.cc:858: bool TraceConfig::IsCategoryEnabled(StringPiece category_name) const { On 2017/01/10 06:24:53, Andrey ...
3 years, 11 months ago (2017-01-10 10:48:43 UTC) #10
Andrey Kraynov
https://codereview.chromium.org/2624583002/diff/1/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc File chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc (right): https://codereview.chromium.org/2624583002/diff/1/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc#newcode777 chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc:777: request->url().DomainIs(webstore_url.host())) { On 2017/01/10 00:20:35, Charlie Harrison wrote: > ...
3 years, 11 months ago (2017-01-10 11:15:18 UTC) #11
Charlie Harrison
chrome/browser/loader lgtm
3 years, 11 months ago (2017-01-10 13:10:39 UTC) #12
Primiano Tucci (use gerrit)
base/trace_event LGTM
3 years, 11 months ago (2017-01-10 14:44:00 UTC) #13
Andrey Kraynov
Added OWNERS reviewers for specific parts of this CL. Sorry if I did it wrong. ...
3 years, 11 months ago (2017-01-11 06:33:40 UTC) #15
Bernhard Bauer
android LGTM.
3 years, 11 months ago (2017-01-11 10:51:38 UTC) #16
Devlin
chrome/browser/extensions lgtm. Thanks for the patch!
3 years, 11 months ago (2017-01-11 14:50:57 UTC) #17
Andrey Kraynov
mal@, would you take a look at changes in chrome/browser/component_updater/ ? thakis@, will you have ...
3 years, 11 months ago (2017-01-13 06:51:00 UTC) #18
Bernhard Bauer
On 2017/01/13 06:51:00, Andrey Kraynov wrote: > mal@, would you take a look at changes ...
3 years, 11 months ago (2017-01-13 17:40:39 UTC) #20
mmenke
On 2017/01/13 17:40:39, Bernhard Bauer wrote: > On 2017/01/13 06:51:00, Andrey Kraynov wrote: > > ...
3 years, 11 months ago (2017-01-13 17:45:18 UTC) #21
Sorin Jianu
lgtm Thank you! component updater paths lgtm
3 years, 11 months ago (2017-01-13 17:46:35 UTC) #22
Sorin Jianu
lgtm Thank you! component updater paths lgtm
3 years, 11 months ago (2017-01-13 17:46:41 UTC) #23
Andrey Kraynov
I need a base/ OWNER review for the few lines of code in this CL. ...
3 years, 11 months ago (2017-01-16 17:45:58 UTC) #25
dcheng
//base changes lgtm, but please update the CL description (and the bug) to explain more ...
3 years, 11 months ago (2017-01-17 09:33:38 UTC) #26
Andrey Kraynov
On 2017/01/17 09:33:38, dcheng wrote: > //base changes lgtm, but please update the CL description ...
3 years, 11 months ago (2017-01-17 10:27:56 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2624583002/20001
3 years, 11 months ago (2017-01-18 06:31:51 UTC) #31
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/343936)
3 years, 11 months ago (2017-01-18 06:37:36 UTC) #33
Andrey Kraynov
On 2017/01/18 06:37:36, commit-bot: I haz the power wrote: > Try jobs failed on following ...
3 years, 9 months ago (2017-03-27 18:28:53 UTC) #35
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2624583002/80001
3 years, 8 months ago (2017-03-28 11:16:59 UTC) #38
commit-bot: I haz the power
3 years, 8 months ago (2017-03-28 12:34:09 UTC) #41
Message was sent while issue was closed.
Committed patchset #4 (id:80001) as
https://chromium.googlesource.com/chromium/src/+/4b80ef168dc0dbeef5acf7077188...

Powered by Google App Engine
This is Rietveld 408576698