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

Side by Side Diff: content/browser/download/save_item.cc

Issue 2168093002: Reorganizing few DCHECKs for better catching of failure. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/download/save_item.h" 5 #include "content/browser/download/save_item.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "content/browser/download/save_file.h" 9 #include "content/browser/download/save_file.h"
10 #include "content/browser/download/save_file_manager.h" 10 #include "content/browser/download/save_file_manager.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // Small downloads might be complete before method has a chance to run. 79 // Small downloads might be complete before method has a chance to run.
80 return; 80 return;
81 } 81 }
82 Finish(received_bytes_, false); 82 Finish(received_bytes_, false);
83 state_ = CANCELED; 83 state_ = CANCELED;
84 package_->SaveCanceled(this); 84 package_->SaveCanceled(this);
85 } 85 }
86 86
87 // Set finish state for a save item 87 // Set finish state for a save item
88 void SaveItem::Finish(int64_t size, bool is_success) { 88 void SaveItem::Finish(int64_t size, bool is_success) {
89 DCHECK(has_final_name() || !is_success_); 89 DCHECK(has_final_name());
90 DCHECK(!is_success_);
no sievers 2016/07/21 19:08:01 same here, cannot be split.
AKV 2016/07/22 14:26:13 Done.
90 state_ = COMPLETE; 91 state_ = COMPLETE;
91 is_success_ = is_success; 92 is_success_ = is_success;
92 UpdateSize(size); 93 UpdateSize(size);
93 } 94 }
94 95
95 void SaveItem::SetTargetPath(const base::FilePath& full_path) { 96 void SaveItem::SetTargetPath(const base::FilePath& full_path) {
96 DCHECK(!full_path.empty() && !has_final_name()); 97 DCHECK(!full_path.empty());
98 DCHECK(!has_final_name());
97 full_path_ = full_path; 99 full_path_ = full_path;
98 } 100 }
99 101
100 void SaveItem::SetTotalBytes(int64_t total_bytes) { 102 void SaveItem::SetTotalBytes(int64_t total_bytes) {
101 DCHECK_EQ(0, total_bytes_); 103 DCHECK_EQ(0, total_bytes_);
102 total_bytes_ = total_bytes; 104 total_bytes_ = total_bytes;
103 } 105 }
104 106
105 } // namespace content 107 } // namespace content
OLDNEW
« content/browser/browser_thread_impl.cc ('K') | « content/browser/browser_thread_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698