Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / tools / clang / blink_gc_plugin / NeedsTracing.h
blobcf4c2c1f70af54aaa0bee4814cb50045c8613ea0
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.
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.
8 #ifndef TOOLS_BLINK_GC_PLUGIN_NEEDS_TRACING_H_
9 #define TOOLS_BLINK_GC_PLUGIN_NEEDS_TRACING_H_
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_;
22 bool operator==(const NeedsTracing& other) {
23 return value_ == other.value_;
25 private:
26 enum Value { kUnneeded, kUnknown, kNeeded };
27 NeedsTracing(Value value) : value_(value) {}
28 Value value_;
31 #endif // TOOLS_BLINK_GC_PLUGIN_NEEDS_TRACING_H_