summaryrefslogtreecommitdiffstats
path: root/content/browser
diff options
context:
space:
mode:
authorlukasza <lukasza@chromium.org>2016-03-24 15:24:24 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-24 22:25:34 +0000
commit34f48dde1eb15cdf568cba166aaf7db7f71a679e (patch)
treee12d7a6d86dc7ddd283bbaed4a00ca5eaa7a9c0b /content/browser
parent4b66be4f38e85141ae28a4e6b9ef67574bebcdc7 (diff)
downloadchromium_src-34f48dde1eb15cdf568cba166aaf7db7f71a679e.zip
chromium_src-34f48dde1eb15cdf568cba166aaf7db7f71a679e.tar.gz
chromium_src-34f48dde1eb15cdf568cba166aaf7db7f71a679e.tar.bz2
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 Review URL: https://codereview.chromium.org/1833723002 Cr-Commit-Position: refs/heads/master@{#383163}
Diffstat (limited to 'content/browser')
-rw-r--r--content/browser/download/save_file_manager.cc4
1 files changed, 1 insertions, 3 deletions
diff --git a/content/browser/download/save_file_manager.cc b/content/browser/download/save_file_manager.cc
index 0c7130e..527a7a1 100644
--- a/content/browser/download/save_file_manager.cc
+++ b/content/browser/download/save_file_manager.cc
@@ -206,7 +206,7 @@ void SaveFileManager::SaveFinished(SaveItemId save_item_id,
<< " is_success = " << is_success;
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
- int64_t bytes_so_far;
+ int64_t bytes_so_far = 0;
SaveFile* save_file = LookupSaveFile(save_item_id);
if (save_file != nullptr) {
DCHECK(save_file->InProgress());
@@ -220,8 +220,6 @@ void SaveFileManager::SaveFinished(SaveItemId save_item_id,
// ResourceHandler failed before it got a chance to parse headers
// and metadata.
DCHECK(!is_success);
-
- bytes_so_far = 0;
}
BrowserThread::PostTask(