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

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

Issue 9288084: Added Net logging to FileStream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with trunk Created 8 years, 10 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 | Annotate | Revision Log
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/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/pickle.h" 10 #include "base/pickle.h"
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 UTF8ToWide(source_url_.spec())); 442 UTF8ToWide(source_url_.spec()));
443 #elif defined(OS_MACOSX) 443 #elif defined(OS_MACOSX)
444 file_metadata::AddQuarantineMetadataToFile(full_path_, source_url_, 444 file_metadata::AddQuarantineMetadataToFile(full_path_, source_url_,
445 referrer_url_); 445 referrer_url_);
446 file_metadata::AddOriginMetadataToFile(full_path_, source_url_, 446 file_metadata::AddOriginMetadataToFile(full_path_, source_url_,
447 referrer_url_); 447 referrer_url_);
448 #endif 448 #endif
449 } 449 }
450 450
451 void BaseFile::CreateFileStream() { 451 void BaseFile::CreateFileStream() {
452 file_stream_.reset(new net::FileStream); 452 file_stream_.reset(new net::FileStream(NULL));
453 } 453 }
454 454
455 net::Error BaseFile::Open() { 455 net::Error BaseFile::Open() {
456 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 456 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
457 DCHECK(!detached_); 457 DCHECK(!detached_);
458 DCHECK(!full_path_.empty()); 458 DCHECK(!full_path_.empty());
459 459
460 // Create a new file stream if it is not provided. 460 // Create a new file stream if it is not provided.
461 if (!file_stream_.get()) { 461 if (!file_stream_.get()) {
462 CreateFileStream(); 462 CreateFileStream();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 int64 BaseFile::CurrentSpeedAtTime(base::TimeTicks current_time) const { 511 int64 BaseFile::CurrentSpeedAtTime(base::TimeTicks current_time) const {
512 base::TimeDelta diff = current_time - start_tick_; 512 base::TimeDelta diff = current_time - start_tick_;
513 int64 diff_ms = diff.InMilliseconds(); 513 int64 diff_ms = diff.InMilliseconds();
514 return diff_ms == 0 ? 0 : bytes_so_far() * 1000 / diff_ms; 514 return diff_ms == 0 ? 0 : bytes_so_far() * 1000 / diff_ms;
515 } 515 }
516 516
517 int64 BaseFile::CurrentSpeed() const { 517 int64 BaseFile::CurrentSpeed() const {
518 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 518 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
519 return CurrentSpeedAtTime(base::TimeTicks::Now()); 519 return CurrentSpeedAtTime(base::TimeTicks::Now());
520 } 520 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698