diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-08-30 10:22:43 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-08-30 12:36:28 +0000 |
commit | 271a6c3487a14599023a9106329505597638d793 (patch) | |
tree | e040d58ffc86c1480b79ca8528020ca9ec919bf8 /chromium/cc/paint/element_id.cc | |
parent | 7b2ffa587235a47d4094787d72f38102089f402a (diff) |
BASELINE: Update Chromium to 77.0.3865.59
Change-Id: I1e89a5f3b009a9519a6705102ad65c92fe736f21
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/cc/paint/element_id.cc')
-rw-r--r-- | chromium/cc/paint/element_id.cc | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/chromium/cc/paint/element_id.cc b/chromium/cc/paint/element_id.cc new file mode 100644 index 00000000000..15d78835bca --- /dev/null +++ b/chromium/cc/paint/element_id.cc @@ -0,0 +1,51 @@ +// Copyright 2019 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/paint/element_id.h" + +#include <inttypes.h> +#include <limits> +#include <ostream> + +#include "base/strings/stringprintf.h" +#include "base/trace_event/traced_value.h" +#include "base/values.h" + +namespace cc { + +const ElementIdType ElementId::kInvalidElementId = 0; + +ElementId LayerIdToElementIdForTesting(int layer_id) { + return ElementId(std::numeric_limits<int>::max() - layer_id); +} + +void ElementId::AddToTracedValue(base::trace_event::TracedValue* res) const { + res->BeginDictionary("element_id"); + res->SetInteger("id_", id_); + res->EndDictionary(); +} + +ElementIdType ElementId::GetInternalValue() const { + return id_; +} + +std::string ElementId::ToString() const { + return base::StringPrintf("(%" PRIu64 ")", id_); +} + +std::unique_ptr<base::Value> ElementId::AsValue() const { + std::unique_ptr<base::DictionaryValue> res(new base::DictionaryValue()); + res->SetInteger("id_", id_); + return std::move(res); +} + +size_t ElementIdHash::operator()(ElementId key) const { + return std::hash<int>()(key.id_); +} + +std::ostream& operator<<(std::ostream& out, const ElementId& id) { + return out << id.ToString(); +} + +} // namespace cc |