OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 EntryList* out) const { | 234 EntryList* out) const { |
235 // Append all of the entries for each of the sources. | 235 // Append all of the entries for each of the sources. |
236 for (SourceIDToInfoMap::const_iterator it = sources_.begin(); | 236 for (SourceIDToInfoMap::const_iterator it = sources_.begin(); |
237 it != sources_.end(); | 237 it != sources_.end(); |
238 ++it) { | 238 ++it) { |
239 const SourceInfo& info = it->second; | 239 const SourceInfo& info = it->second; |
240 out->insert(out->end(), info.entries.begin(), info.entries.end()); | 240 out->insert(out->end(), info.entries.begin(), info.entries.end()); |
241 } | 241 } |
242 } | 242 } |
243 | 243 |
244 PassiveLogCollector::SourceInfo* | |
245 PassiveLogCollector::SourceTracker::GetSourceInfo(uint32 source_id) { | |
246 SourceIDToInfoMap::iterator it = sources_.find(source_id); | |
247 if (it != sources_.end()) | |
248 return &(it->second); | |
249 return NULL; | |
250 } | |
251 | |
252 void PassiveLogCollector::SourceTracker::AddToDeletionQueue( | 244 void PassiveLogCollector::SourceTracker::AddToDeletionQueue( |
253 uint32 source_id) { | 245 uint32 source_id) { |
254 DCHECK(sources_.find(source_id) != sources_.end()); | 246 DCHECK(sources_.find(source_id) != sources_.end()); |
255 DCHECK(!sources_.find(source_id)->second.is_alive); | 247 DCHECK(!sources_.find(source_id)->second.is_alive); |
256 DCHECK_GE(sources_.find(source_id)->second.reference_count, 0); | 248 DCHECK_GE(sources_.find(source_id)->second.reference_count, 0); |
257 DCHECK_LE(deletion_queue_.size(), max_graveyard_size_); | 249 DCHECK_LE(deletion_queue_.size(), max_graveyard_size_); |
258 | 250 |
259 deletion_queue_.push_back(source_id); | 251 deletion_queue_.push_back(source_id); |
260 | 252 |
261 // After the deletion queue has reached its maximum size, start | 253 // After the deletion queue has reached its maximum size, start |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 PassiveLogCollector::SpdySessionTracker::DoAddEntry(const Entry& entry, | 478 PassiveLogCollector::SpdySessionTracker::DoAddEntry(const Entry& entry, |
487 SourceInfo* out_info) { | 479 SourceInfo* out_info) { |
488 AddEntryToSourceInfo(entry, out_info); | 480 AddEntryToSourceInfo(entry, out_info); |
489 if (entry.type == net::NetLog::TYPE_SPDY_SESSION && | 481 if (entry.type == net::NetLog::TYPE_SPDY_SESSION && |
490 entry.phase == net::NetLog::PHASE_END) { | 482 entry.phase == net::NetLog::PHASE_END) { |
491 return ACTION_MOVE_TO_GRAVEYARD; | 483 return ACTION_MOVE_TO_GRAVEYARD; |
492 } else { | 484 } else { |
493 return ACTION_NONE; | 485 return ACTION_NONE; |
494 } | 486 } |
495 } | 487 } |
OLD | NEW |