Index: cc/debug/latency_info.cc |
diff --git a/cc/debug/latency_info.cc b/cc/debug/latency_info.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e8b386816d154014912c13e6df38282124ff5b82 |
--- /dev/null |
+++ b/cc/debug/latency_info.cc |
@@ -0,0 +1,29 @@ |
+// Copyright (c) 2013 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 "cc/debug/latency_info.h" |
+ |
+#include <algorithm> |
+ |
+namespace cc { |
+ |
+void LatencyInfo::MergeWith(const LatencyInfo& other) { |
+ for (LatencyMap::const_iterator b = other.latency_numbers.begin(); |
+ b != other.latency_numbers.end(); ++b) { |
+ AddLatencyNumber(b->first.first, b->first.second, b->second); |
+ } |
+} |
+ |
+void LatencyInfo::AddLatencyNumber(LatencyComponent component, |
+ int64 id, int64 number) { |
nduca
2013/04/09 23:15:08
lgtm
numer-> component_sequence_number?
lets ev
|
+ LatencyMap::key_type key = std::make_pair(component, id); |
+ LatencyMap::iterator f = latency_numbers.find(key); |
+ if (f == latency_numbers.end()) |
+ latency_numbers[key] = number; |
+ else |
+ f->second = std::max(number, f->second); |
+} |
+ |
+} // namespace cc |
+ |