OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/base_file.h" | 5 #include "content/browser/download/base_file.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 BaseFile::BaseFile(const FilePath& full_path, | 187 BaseFile::BaseFile(const FilePath& full_path, |
188 const GURL& source_url, | 188 const GURL& source_url, |
189 const GURL& referrer_url, | 189 const GURL& referrer_url, |
190 int64 received_bytes, | 190 int64 received_bytes, |
191 const linked_ptr<net::FileStream>& file_stream) | 191 const linked_ptr<net::FileStream>& file_stream) |
192 : full_path_(full_path), | 192 : full_path_(full_path), |
193 source_url_(source_url), | 193 source_url_(source_url), |
194 referrer_url_(referrer_url), | 194 referrer_url_(referrer_url), |
195 file_stream_(file_stream), | 195 file_stream_(file_stream), |
196 bytes_so_far_(received_bytes), | 196 bytes_so_far_(received_bytes), |
197 power_save_blocker_(true), | 197 power_save_blocker_(PowerSaveBlocker::kPowerSaveBlockPreventSystemSleep), |
198 calculate_hash_(false), | 198 calculate_hash_(false), |
199 detached_(false) { | 199 detached_(false) { |
200 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 200 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
201 memset(sha256_hash_, 0, sizeof(sha256_hash_)); | 201 memset(sha256_hash_, 0, sizeof(sha256_hash_)); |
202 if (file_stream_.get()) | 202 if (file_stream_.get()) |
203 file_stream_->EnableErrorStatistics(); | 203 file_stream_->EnableErrorStatistics(); |
204 } | 204 } |
205 | 205 |
206 BaseFile::~BaseFile() { | 206 BaseFile::~BaseFile() { |
207 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 207 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 std::string BaseFile::DebugString() const { | 453 std::string BaseFile::DebugString() const { |
454 return base::StringPrintf("{ source_url_ = \"%s\"" | 454 return base::StringPrintf("{ source_url_ = \"%s\"" |
455 " full_path_ = \"%" PRFilePath "\"" | 455 " full_path_ = \"%" PRFilePath "\"" |
456 " bytes_so_far_ = %" PRId64 | 456 " bytes_so_far_ = %" PRId64 |
457 " detached_ = %c }", | 457 " detached_ = %c }", |
458 source_url_.spec().c_str(), | 458 source_url_.spec().c_str(), |
459 full_path_.value().c_str(), | 459 full_path_.value().c_str(), |
460 bytes_so_far_, | 460 bytes_so_far_, |
461 detached_ ? 'T' : 'F'); | 461 detached_ ? 'T' : 'F'); |
462 } | 462 } |
OLD | NEW |