OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |