| Index: cc/animation/element_id.h
|
| diff --git a/cc/animation/element_id.h b/cc/animation/element_id.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..069e3bc1fe396aaaf8fe12f5e3e58656a9482dcf
|
| --- /dev/null
|
| +++ b/cc/animation/element_id.h
|
| @@ -0,0 +1,64 @@
|
| +// Copyright 2016 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.
|
| +
|
| +#ifndef CC_ANIMATION_ELEMENT_ID_H_
|
| +#define CC_ANIMATION_ELEMENT_ID_H_
|
| +
|
| +#include <cstdint>
|
| +#include <functional>
|
| +#include <iosfwd>
|
| +#include <memory>
|
| +#include <stddef.h>
|
| +
|
| +#include "cc/base/cc_export.h"
|
| +
|
| +namespace base {
|
| +class Value;
|
| +namespace trace_event {
|
| +class TracedValue;
|
| +} // namespace trace_event
|
| +} // namespace base
|
| +
|
| +namespace cc {
|
| +
|
| +namespace proto {
|
| +class ElementId;
|
| +} // namespace proto
|
| +
|
| +// ------------------------------*IMPORTANT*---------------------------------
|
| +// ElementId has a corresponding proto defined in cc/proto/element_id.proto.
|
| +// When making any changes here, but sure to update the proto.
|
| +
|
| +struct CC_EXPORT ElementId {
|
| + explicit ElementId(uint64_t value) : value(value) {}
|
| + ElementId() : value(0ul) {}
|
| +
|
| + inline bool operator==(const ElementId& o) const { return o.value == value; }
|
| + inline bool operator!=(const ElementId& o) const { return o.value != value; }
|
| + inline bool operator<(const ElementId& o) const { return value < o.value; }
|
| + inline explicit operator bool() const { return !!value; }
|
| +
|
| + void AddToTracedValue(base::trace_event::TracedValue* res) const;
|
| + std::unique_ptr<base::Value> AsValue() const;
|
| +
|
| + void ToProtobuf(proto::ElementId* proto) const;
|
| + void FromProtobuf(const proto::ElementId& proto);
|
| +
|
| + uint64_t value;
|
| +};
|
| +
|
| +ElementId CC_EXPORT LayerIdToElementIdForTesting(int layer_id);
|
| +
|
| +struct ElementIdHash {
|
| + size_t operator()(ElementId key) const {
|
| + return std::hash<uint64_t>()(key.value);
|
| + }
|
| +};
|
| +
|
| +// Stream operator so ElementId can be used in assertion statements.
|
| +CC_EXPORT std::ostream& operator<<(std::ostream& out, const ElementId& id);
|
| +
|
| +} // namespace cc
|
| +
|
| +#endif // CC_ANIMATION_ELEMENT_ID_H_
|
|
|