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

Issue 776903002: Cleanup: Remove some unneeded string allocations. (Closed)

Created:
6 years ago by Lei Zhang
Modified:
6 years ago
Reviewers:
brettw
CC:
chromium-reviews, extensions-reviews_chromium.org, cbentzel+watch_chromium.org, James Su, grt+watch_chromium.org, browser-components-watch_chromium.org, dcheng, tfarina, chromium-apps-reviews_chromium.org, erikwright+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Cleanup: Remove some unneeded string allocations. The string conversion functions called all take StringPieces. Committed: https://crrev.com/75f873577a040fb0ed5c2e895a0650c62771662f Cr-Commit-Position: refs/heads/master@{#306679}

Patch Set 1 #

Patch Set 2 : fix win #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+33 lines, -32 lines) Patch
M base/logging.cc View 5 chunks +6 lines, -7 lines 0 comments Download
M chrome/browser/autocomplete/zero_suggest_provider_unittest.cc View 4 chunks +4 lines, -3 lines 0 comments Download
M chrome/browser/extensions/api/management/chrome_management_api_delegate.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/external_pref_loader.cc View 2 chunks +3 lines, -3 lines 0 comments Download
M chrome/browser/history/history_querying_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/rlz/rlz.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/safe_browsing/incident_reporting/environment_data_collection_win.cc View 1 chunk +1 line, -2 lines 1 comment Download
M chrome/browser/safe_browsing/incident_reporting/environment_data_collection_win_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/find_bar/find_bar_host_interactive_uitest.cc View 3 chunks +5 lines, -5 lines 0 comments Download
M chrome/utility/importer/ie_importer_win.cc View 1 3 chunks +3 lines, -3 lines 0 comments Download
M components/search_engines/template_url_parser.cc View 1 chunk +2 lines, -1 line 0 comments Download
M components/user_manager/empty_user_info.cc View 1 chunk +2 lines, -2 lines 1 comment Download
M net/base/mime_util_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M ui/base/clipboard/clipboard_aurax11.cc View 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 9 (2 generated)
Lei Zhang
6 years ago (2014-12-03 20:42:45 UTC) #2
brettw
lgtm https://codereview.chromium.org/776903002/diff/20001/chrome/browser/safe_browsing/incident_reporting/environment_data_collection_win.cc File chrome/browser/safe_browsing/incident_reporting/environment_data_collection_win.cc (right): https://codereview.chromium.org/776903002/diff/20001/chrome/browser/safe_browsing/incident_reporting/environment_data_collection_win.cc#newcode127 chrome/browser/safe_browsing/incident_reporting/environment_data_collection_win.cc:127: module_state->set_name(base::WideToUTF8(modules_to_verify[i])); Note that this is the same since ...
6 years ago (2014-12-03 21:12:21 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/776903002/20001
6 years ago (2014-12-03 21:39:20 UTC) #5
commit-bot: I haz the power
Committed patchset #2 (id:20001)
6 years ago (2014-12-03 21:42:35 UTC) #6
commit-bot: I haz the power
Patchset 2 (id:??) landed as https://crrev.com/75f873577a040fb0ed5c2e895a0650c62771662f Cr-Commit-Position: refs/heads/master@{#306679}
6 years ago (2014-12-03 21:43:31 UTC) #7
brucedawson
I'm looking at logging.cc where an explicit cast to std::wstring was removed by this code, ...
6 years ago (2014-12-17 00:37:16 UTC) #8
Lei Zhang
6 years ago (2014-12-17 01:01:16 UTC) #9
Message was sent while issue was closed.
On 2014/12/17 00:37:16, brucedawson wrote:
> I'm looking at logging.cc where an explicit cast to std::wstring was removed
by
> this code, but this does not actually change the generated code because
> base::WideToUTF8 does not actually have a StringPiece overload. All the change
> did (for this source file) was to change from an explicit conversion to an
> implicit conversion. Presumably this applies to the other nine places where a
> call to base::WideToUTF8 was changed.
> 
> If this was an important part of the optimization then adding a StringPiece
> overload would be worthwhile.

Yes, I realize there isn't a performance improvement there due to
base::WideToUTF8() not taking a StringPiece. I didn't see that until after the
fact, so the commit message should have said mostly instead of all. It's also to
simplify code, and to get rid of a bad pattern to prevent proliferation via
copy+pasting. In an extreme case, one bad pattern ended up in 10+ files because
people kept using the file and its copies as templates for other files in the
same directory.

Powered by Google App Engine
This is Rietveld 408576698