Chromium Code Reviews| Index: components/metrics/leak_detector/leak_detector_value_type.cc |
| diff --git a/components/metrics/leak_detector/leak_detector_value_type.cc b/components/metrics/leak_detector/leak_detector_value_type.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c4a7872e128eee74b172c70e5ca897b6bed095f9 |
| --- /dev/null |
| +++ b/components/metrics/leak_detector/leak_detector_value_type.cc |
| @@ -0,0 +1,43 @@ |
| +// Copyright 2015 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 "components/metrics/leak_detector/leak_detector_value_type.h" |
| + |
| +#include <stdio.h> |
| + |
| +namespace metrics { |
| +namespace leak_detector { |
| + |
| +bool LeakDetectorValueType::operator== ( |
| + const LeakDetectorValueType& other) const { |
| + if (type_ != other.type_) |
| + return false; |
| + |
| + switch(type_) { |
| + case kSize: |
| + return size_ == other.size_; |
| + case kCallStack: |
| + return call_stack_ == other.call_stack_; |
| + default: |
| + return false; |
| + } |
| +} |
| + |
| +bool LeakDetectorValueType::operator< ( |
| + const LeakDetectorValueType& other) const { |
| + if (type_ != other.type_) |
| + return type_ < other.type_; |
| + |
| + switch(type_) { |
|
Alexei Svitkine (slow)
2015/11/13 20:51:27
Nit: Missing space after switch. Suggest running "
Simon Que
2015/11/13 23:44:57
Done.
|
| + case kSize: |
| + return size_ < other.size_; |
| + case kCallStack: |
| + return call_stack_ < other.call_stack_; |
| + default: |
|
Alexei Svitkine (slow)
2015/11/13 20:51:27
Nit: It's best not to have default: cases in switc
Simon Que
2015/11/13 23:44:57
Done.
|
| + return false; |
| + } |
| +} |
| + |
| +} // namespace leak_detector |
| +} // namespace metrics |