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

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

Issue 9426029: Test file errors in downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactored per Chris & Randy's comments. Created 8 years, 9 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/download_item_impl.h" 5 #include "content/browser/download/download_item_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 bound_net_log_.AddEvent( 563 bound_net_log_.AddEvent(
564 net::NetLog::TYPE_DOWNLOAD_ITEM_CANCELED, 564 net::NetLog::TYPE_DOWNLOAD_ITEM_CANCELED,
565 make_scoped_refptr( 565 make_scoped_refptr(
566 new download_net_logs::ItemCanceledParameters(received_bytes_, 566 new download_net_logs::ItemCanceledParameters(received_bytes_,
567 hash_state_))); 567 hash_state_)));
568 break; 568 break;
569 default: 569 default:
570 break; 570 break;
571 } 571 }
572 572
573 VLOG(20) << " " << __FUNCTION__ << "()" << " this = " << DebugString(true);
574
573 UpdateObservers(); 575 UpdateObservers();
574 576
575 bool is_done = (state_ != IN_PROGRESS); 577 bool is_done = (state_ != IN_PROGRESS);
576 bool was_done = (old_state != IN_PROGRESS); 578 bool was_done = (old_state != IN_PROGRESS);
577 if (is_done && !was_done) 579 if (is_done && !was_done)
578 bound_net_log_.EndEvent(net::NetLog::TYPE_DOWNLOAD_ITEM_ACTIVE, NULL); 580 bound_net_log_.EndEvent(net::NetLog::TYPE_DOWNLOAD_ITEM_ACTIVE, NULL);
579 } 581 }
580 582
581 void DownloadItemImpl::UpdateSafetyState() { 583 void DownloadItemImpl::UpdateSafetyState() {
582 SafetyState updated_value = state_info_.IsDangerous() ? 584 SafetyState updated_value = state_info_.IsDangerous() ?
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 for ( ; verbose && (iter != last); ++iter) { 991 for ( ; verbose && (iter != last); ++iter) {
990 url_list += " ->\n\t"; 992 url_list += " ->\n\t";
991 const GURL& next_url = *iter; 993 const GURL& next_url = *iter;
992 url_list += next_url.spec(); 994 url_list += next_url.spec();
993 } 995 }
994 } 996 }
995 997
996 if (verbose) { 998 if (verbose) {
997 description += base::StringPrintf( 999 description += base::StringPrintf(
998 " db_handle = %" PRId64 1000 " db_handle = %" PRId64
999 " total_bytes = %" PRId64 1001 " total = %" PRId64
1000 " received_bytes = %" PRId64 1002 " received = %" PRId64
1001 " is_paused = %c" 1003 " reason = %s"
1002 " is_otr = %c" 1004 " paused = %c"
1003 " safety_state = %s" 1005 " otr = %c"
1006 " safety = %s"
1004 " last_modified = '%s'" 1007 " last_modified = '%s'"
1005 " etag = '%s'" 1008 " etag = '%s'"
1006 " url_chain = \n\t\"%s\"\n\t" 1009 " url_chain = \n\t\"%s\"\n\t"
1007 " target_name = \"%" PRFilePath "\"" 1010 " target = \"%" PRFilePath "\""
1008 " full_path = \"%" PRFilePath "\"", 1011 " full_path = \"%" PRFilePath "\"",
1009 GetDbHandle(), 1012 GetDbHandle(),
1010 GetTotalBytes(), 1013 GetTotalBytes(),
1011 GetReceivedBytes(), 1014 GetReceivedBytes(),
1015 InterruptReasonDebugString(last_reason_).c_str(),
1012 IsPaused() ? 'T' : 'F', 1016 IsPaused() ? 'T' : 'F',
1013 IsOtr() ? 'T' : 'F', 1017 IsOtr() ? 'T' : 'F',
1014 DebugSafetyStateString(GetSafetyState()), 1018 DebugSafetyStateString(GetSafetyState()),
1015 GetLastModifiedTime().c_str(), 1019 GetLastModifiedTime().c_str(),
1016 GetETag().c_str(), 1020 GetETag().c_str(),
1017 url_list.c_str(), 1021 url_list.c_str(),
1018 state_info_.target_name.value().c_str(), 1022 state_info_.target_name.value().c_str(),
1019 GetFullPath().value().c_str()); 1023 GetFullPath().value().c_str());
1020 } else { 1024 } else {
1021 description += base::StringPrintf(" url = \"%s\"", url_list.c_str()); 1025 description += base::StringPrintf(" url = \"%s\"", url_list.c_str());
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 std::map<const void*, ExternalData*>::iterator it = 1153 std::map<const void*, ExternalData*>::iterator it =
1150 external_data_map_.find(key); 1154 external_data_map_.find(key);
1151 1155
1152 if (it == external_data_map_.end()) { 1156 if (it == external_data_map_.end()) {
1153 external_data_map_[key] = data; 1157 external_data_map_[key] = data;
1154 } else if (it->second != data) { 1158 } else if (it->second != data) {
1155 delete it->second; 1159 delete it->second;
1156 it->second = data; 1160 it->second = data;
1157 } 1161 }
1158 } 1162 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698