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

Issue 1833723002: Initialize |bytes_so_far| local variable in SaveFileManager::SaveFinished. (Closed)

Created:
4 years, 9 months ago by Łukasz Anforowicz
Modified:
4 years, 9 months ago
CC:
chromium-reviews, asanka, darin-cc_chromium.org, rginda+watch_chromium.org, jam, daph_mail.ru
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Initialize |bytes_so_far| local variable in SaveFileManager::SaveFinished. As pointed out in https://crbug.com/594219#c29 the local variable |bytes_so_far| is not initialized at the point of declaration. This is okay in the current code (this variable *does* get intialized in all the possible code flows), but the lack of initialization violates the style guide [1] and is an unnecessary refactoring risk. [1] https://google.github.io/styleguide/cppguide.html#Local_Variables says: Place a function's variables in the narrowest scope possible, and initialize variables in the declaration. BUG=594219 Committed: https://crrev.com/34f48dde1eb15cdf568cba166aaf7db7f71a679e Cr-Commit-Position: refs/heads/master@{#383163}

Patch Set 1 #

Total comments: 3

Patch Set 2 : Remove re-initialization of |bytes_so_far|. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1 line, -3 lines) Patch
M content/browser/download/save_file_manager.cc View 1 2 chunks +1 line, -3 lines 0 comments Download

Messages

Total messages: 17 (9 generated)
Łukasz Anforowicz
rdsmith@, could you please take a look? daph@, thanks for pointing out this issue. https://codereview.chromium.org/1833723002/diff/1/content/browser/download/save_file_manager.cc ...
4 years, 9 months ago (2016-03-24 18:23:28 UTC) #4
Randy Smith (Not in Mondays)
I leave towards the rewrite I suggest below a bit more than "just an idea" ...
4 years, 9 months ago (2016-03-24 19:17:49 UTC) #5
Łukasz Anforowicz
Thanks for reviewing. https://codereview.chromium.org/1833723002/diff/1/content/browser/download/save_file_manager.cc File content/browser/download/save_file_manager.cc (right): https://codereview.chromium.org/1833723002/diff/1/content/browser/download/save_file_manager.cc#newcode209 content/browser/download/save_file_manager.cc:209: int64_t bytes_so_far = 0; On 2016/03/24 ...
4 years, 9 months ago (2016-03-24 19:25:58 UTC) #6
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1833723002/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1833723002/20001
4 years, 9 months ago (2016-03-24 19:26:43 UTC) #8
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 9 months ago (2016-03-24 20:33:06 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1833723002/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1833723002/20001
4 years, 9 months ago (2016-03-24 22:14:42 UTC) #13
commit-bot: I haz the power
Committed patchset #2 (id:20001)
4 years, 9 months ago (2016-03-24 22:24:35 UTC) #15
commit-bot: I haz the power
4 years, 9 months ago (2016-03-24 22:25:44 UTC) #17
Message was sent while issue was closed.
Patchset 2 (id:??) landed as
https://crrev.com/34f48dde1eb15cdf568cba166aaf7db7f71a679e
Cr-Commit-Position: refs/heads/master@{#383163}

Powered by Google App Engine
This is Rietveld 408576698