OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // NeedsTracing is a three-point value ordered by unneeded < unknown < needed. |
| 6 // Unneeded means that the point definitively does not need to be traced. |
| 7 |
| 8 #ifndef TOOLS_BLINK_GC_PLUGIN_NEEDS_TRACING_H_ |
| 9 #define TOOLS_BLINK_GC_PLUGIN_NEEDS_TRACING_H_ |
| 10 |
| 11 class NeedsTracing { |
| 12 public: |
| 13 static NeedsTracing Unneeded() { return kUnneeded; } |
| 14 static NeedsTracing Unknown() { return kUnknown; } |
| 15 static NeedsTracing Needed() { return kNeeded; } |
| 16 bool IsUnneeded() { return value_ == kUnneeded; } |
| 17 bool IsUnknown() { return value_ == kUnknown; } |
| 18 bool IsNeeded() { return value_ == kNeeded; } |
| 19 NeedsTracing LUB(const NeedsTracing& other) { |
| 20 return value_ > other.value_ ? value_ : other.value_; |
| 21 } |
| 22 bool operator==(const NeedsTracing& other) { |
| 23 return value_ == other.value_; |
| 24 } |
| 25 private: |
| 26 enum Value { kUnneeded, kUnknown, kNeeded }; |
| 27 NeedsTracing(Value value) : value_(value) {} |
| 28 Value value_; |
| 29 }; |
| 30 |
| 31 #endif // TOOLS_BLINK_GC_PLUGIN_NEEDS_TRACING_H_ |
OLD | NEW |