summaryrefslogtreecommitdiffstats
path: root/net/base/capturing_net_log.cc
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-28 19:28:09 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-28 19:28:09 +0000
commitec11be60eaf6e832219328ea18656c558dec3040 (patch)
tree1d8a6710f277a55b4743fbc54c8554abf3164669 /net/base/capturing_net_log.cc
parent9bb75ccc56cdb94a9778dcef26be3de97808f3ce (diff)
downloadchromium_src-ec11be60eaf6e832219328ea18656c558dec3040.zip
chromium_src-ec11be60eaf6e832219328ea18656c558dec3040.tar.gz
chromium_src-ec11be60eaf6e832219328ea18656c558dec3040.tar.bz2
More cleanup to address TODOs in net_log.h.
* Removes 9 methods: AddEventWithParameters, BeginEventWithParameters, EndEventWithParameters, BeginEventWithString, BeginEventWithInteger, AddEventWithString, AddEventWithInteger, EndEventWithParameters, EndEventWithInteger. This was becoming ridiculous, instead made the EventParameters* a required parameter. * Moves CapturingBoundNetLog / CapturingNetLog to its own file. BUG=37421 Review URL: http://codereview.chromium.org/1746012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45843 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/capturing_net_log.cc')
-rw-r--r--net/base/capturing_net_log.cc43
1 files changed, 43 insertions, 0 deletions
diff --git a/net/base/capturing_net_log.cc b/net/base/capturing_net_log.cc
new file mode 100644
index 0000000..08f3b8d
--- /dev/null
+++ b/net/base/capturing_net_log.cc
@@ -0,0 +1,43 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/base/capturing_net_log.h"
+
+namespace net {
+
+CapturingNetLog::CapturingNetLog(size_t max_num_entries)
+ : next_id_(0), max_num_entries_(max_num_entries) {
+}
+
+void CapturingNetLog::AddEntry(EventType type,
+ const base::TimeTicks& time,
+ const Source& source,
+ EventPhase phase,
+ EventParameters* extra_parameters) {
+ Entry entry(type, time, source, phase, extra_parameters);
+ if (entries_.size() + 1 < max_num_entries_)
+ entries_.push_back(entry);
+}
+
+uint32 CapturingNetLog::NextID() {
+ return next_id_++;
+}
+
+void CapturingNetLog::Clear() {
+ entries_.clear();
+}
+
+void CapturingBoundNetLog::Clear() {
+ capturing_net_log_->Clear();
+}
+
+void CapturingBoundNetLog::AppendTo(const BoundNetLog& net_log) const {
+ for (size_t i = 0; i < entries().size(); ++i) {
+ const CapturingNetLog::Entry& entry = entries()[i];
+ net_log.AddEntryWithTime(entry.type, entry.time, entry.phase,
+ entry.extra_parameters);
+ }
+}
+
+} // namespace net