diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-05-03 13:42:47 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-05-15 10:27:51 +0000 |
commit | 8c5c43c7b138c9b4b0bf56d946e61d3bbc111bec (patch) | |
tree | d29d987c4d7b173cf853279b79a51598f104b403 /chromium/cc/layers/deadline_policy.h | |
parent | 830c9e163d31a9180fadca926b3e1d7dfffb5021 (diff) |
BASELINE: Update Chromium to 66.0.3359.156
Change-Id: I0c9831ad39911a086b6377b16f995ad75a51e441
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'chromium/cc/layers/deadline_policy.h')
-rw-r--r-- | chromium/cc/layers/deadline_policy.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/chromium/cc/layers/deadline_policy.h b/chromium/cc/layers/deadline_policy.h new file mode 100644 index 00000000000..a5dd80311fb --- /dev/null +++ b/chromium/cc/layers/deadline_policy.h @@ -0,0 +1,68 @@ +// Copyright 2018 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_LAYERS_DEADLINE_POLICY_H_ +#define CC_LAYERS_DEADLINE_POLICY_H_ + +#include <cstdint> + +#include "base/macros.h" +#include "base/optional.h" +#include "cc/cc_export.h" + +namespace cc { + +class CC_EXPORT DeadlinePolicy { + public: + enum Type { + kUseExistingDeadline, + kUseDefaultDeadline, + kUseSpecifiedDeadline + }; + + static DeadlinePolicy UseExistingDeadline(); + + static DeadlinePolicy UseDefaultDeadline(); + + static DeadlinePolicy UseSpecifiedDeadline(uint32_t deadline_in_frames); + + DeadlinePolicy(const DeadlinePolicy& other); + + DeadlinePolicy& operator=(const DeadlinePolicy& other) = default; + + ~DeadlinePolicy() = default; + + bool use_existing_deadline() const { + return policy_type_ == DeadlinePolicy::kUseExistingDeadline; + } + + base::Optional<uint32_t> deadline_in_frames() const { + DCHECK(policy_type_ == Type::kUseDefaultDeadline || + policy_type_ == Type::kUseSpecifiedDeadline); + return deadline_in_frames_; + } + + Type policy_type() const { return policy_type_; } + + bool operator==(const DeadlinePolicy& other) const { + return other.policy_type_ == policy_type_ && + other.deadline_in_frames_ == deadline_in_frames_; + } + + bool operator!=(const DeadlinePolicy& other) const { + return !(*this == other); + } + + private: + explicit DeadlinePolicy(Type policy_type); + + explicit DeadlinePolicy(uint32_t deadline_in_frames); + + Type policy_type_; + base::Optional<uint32_t> deadline_in_frames_; +}; + +} // namespace cc + +#endif // CC_LAYERS_DEADLINE_POLICY_H_ |