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

Side by Side Diff: chrome/browser/net/passive_log_collector.cc

Issue 9121053: Added net logging to DownloadItem. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changes to comments. 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
« no previous file with comments | « no previous file | chrome/browser/resources/net_internals/source_entry.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/net/passive_log_collector.h" 5 #include "chrome/browser/net/passive_log_collector.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 const size_t PassiveLogCollector::DownloadTracker::kMaxGraveyardSize = 50; 858 const size_t PassiveLogCollector::DownloadTracker::kMaxGraveyardSize = 50;
859 859
860 PassiveLogCollector::DownloadTracker::DownloadTracker() 860 PassiveLogCollector::DownloadTracker::DownloadTracker()
861 : SourceTracker(kMaxNumSources, kMaxGraveyardSize, NULL) { 861 : SourceTracker(kMaxNumSources, kMaxGraveyardSize, NULL) {
862 } 862 }
863 863
864 PassiveLogCollector::SourceTracker::Action 864 PassiveLogCollector::SourceTracker::Action
865 PassiveLogCollector::DownloadTracker::DoAddEntry( 865 PassiveLogCollector::DownloadTracker::DoAddEntry(
866 const ChromeNetLog::Entry& entry, 866 const ChromeNetLog::Entry& entry,
867 SourceInfo* out_info) { 867 SourceInfo* out_info) {
868 if (entry.type == net::NetLog::TYPE_DOWNLOAD_FILE_WRITTEN) 868 if ((entry.type == net::NetLog::TYPE_DOWNLOAD_FILE_WRITTEN) ||
869 (entry.type == net::NetLog::TYPE_DOWNLOAD_ITEM_UPDATED)) {
869 return ACTION_NONE; // Don't passively log these (too many). 870 return ACTION_NONE; // Don't passively log these (too many).
871 }
870 AddEntryToSourceInfo(entry, out_info); 872 AddEntryToSourceInfo(entry, out_info);
871 if (entry.type == net::NetLog::TYPE_DOWNLOAD_FILE_OPENED && 873 if (entry.type == net::NetLog::TYPE_DOWNLOAD_ITEM_ACTIVE &&
872 entry.phase == net::NetLog::PHASE_END) { 874 entry.phase == net::NetLog::PHASE_END) {
873 return ACTION_MOVE_TO_GRAVEYARD; 875 return ACTION_MOVE_TO_GRAVEYARD;
874 } 876 }
875 return ACTION_NONE; 877 return ACTION_NONE;
876 } 878 }
877 879
878 //---------------------------------------------------------------------------- 880 //----------------------------------------------------------------------------
879 // FileStreamTracker 881 // FileStreamTracker
880 //---------------------------------------------------------------------------- 882 //----------------------------------------------------------------------------
881 883
882 const size_t PassiveLogCollector::FileStreamTracker::kMaxNumSources = 100; 884 const size_t PassiveLogCollector::FileStreamTracker::kMaxNumSources = 100;
883 885
884 const size_t PassiveLogCollector::FileStreamTracker::kMaxGraveyardSize = 25; 886 const size_t PassiveLogCollector::FileStreamTracker::kMaxGraveyardSize = 25;
885 887
886 PassiveLogCollector::FileStreamTracker::FileStreamTracker() 888 PassiveLogCollector::FileStreamTracker::FileStreamTracker()
887 : SourceTracker(kMaxNumSources, kMaxGraveyardSize, NULL) { 889 : SourceTracker(kMaxNumSources, kMaxGraveyardSize, NULL) {
888 } 890 }
889 891
890 PassiveLogCollector::SourceTracker::Action 892 PassiveLogCollector::SourceTracker::Action
891 PassiveLogCollector::FileStreamTracker::DoAddEntry( 893 PassiveLogCollector::FileStreamTracker::DoAddEntry(
892 const ChromeNetLog::Entry& entry, 894 const ChromeNetLog::Entry& entry,
893 SourceInfo* out_info) { 895 SourceInfo* out_info) {
894 AddEntryToSourceInfo(entry, out_info); 896 AddEntryToSourceInfo(entry, out_info);
895 if (entry.type == net::NetLog::TYPE_FILE_STREAM_ALIVE && 897 if (entry.type == net::NetLog::TYPE_FILE_STREAM_ALIVE &&
896 entry.phase == net::NetLog::PHASE_END) { 898 entry.phase == net::NetLog::PHASE_END) {
897 return ACTION_MOVE_TO_GRAVEYARD; 899 return ACTION_MOVE_TO_GRAVEYARD;
898 } 900 }
899 return ACTION_NONE; 901 return ACTION_NONE;
900 } 902 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/net_internals/source_entry.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698