Rename {absl => std}::optional in //cc/
Automated patch, intended to be effectively a no-op.
Context:
https://groups.google.com/a/chromium.org/g/cxx/c/nBD_1LaanTc/m/ghh-ZZhWAwAJ?utm_medium=email&utm_source=footer
As of https://crrev.com/1204351, absl::optional is now a type alias for
std::optional. We should migrate toward it.
Script:
```
function replace {
echo "Replacing $1 by $2"
git grep -l "$1" \
| cut -f1 -d: \
| sort \
| uniq \
| grep "^ui/" \
| grep \
-e "\.h" \
-e "\.cc" \
-e "\.mm" \
-e "\.py" \
| xargs sed -i "s/$1/$2/g"
}
replace "absl::optional" "std::optional"
replace "absl::make_optional" "std::make_optional"
replace "absl::nullopt" "std::nullopt"
replace "absl::in_place" "std::in_place"
replace "absl::in_place_t" "std::in_place_t"
replace "\"third_party\/abseil-cpp\/absl\/types\/optional.h\"" "<optional>"
git cl format
```
CQ_INCLUDE_TRYBOTS=luci.chrome.try:chromeos-betty-pi-arc-chrome
Bug: chromium:1500249
Change-Id: I36e4279361285f70033f829773ceb691910e1b39
AX-Relnotes: n/a.
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5010774
Auto-Submit: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Jonathan Ross <jonross@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1222904}
diff --git a/cc/animation/animation.cc b/cc/animation/animation.cc
index 5904101..4e56002 100644
--- a/cc/animation/animation.cc
+++ b/cc/animation/animation.cc
@@ -139,7 +139,7 @@
}
void Animation::PushPropertiesTo(Animation* animation_impl) {
- absl::optional<base::TimeTicks> impl_start_time;
+ std::optional<base::TimeTicks> impl_start_time;
if (use_start_time_from_impl_ && !GetStartTime()) {
// If this animation is replacing an existing one before having received a
// start time, try to get the start from the animation being replaced.
@@ -246,11 +246,11 @@
animation_host()->SetNeedsCommit();
}
-absl::optional<base::TimeTicks> Animation::GetStartTime() const {
+std::optional<base::TimeTicks> Animation::GetStartTime() const {
CHECK(keyframe_effect());
if (!keyframe_effect()->keyframe_models().size()) {
- return absl::nullopt;
+ return std::nullopt;
}
// KeyframeModels should all share the same start time so just use the first
@@ -258,7 +258,7 @@
gfx::KeyframeModel& km = *keyframe_effect()->keyframe_models().front();
if (!km.has_set_start_time()) {
- return absl::nullopt;
+ return std::nullopt;
}
return km.start_time();
diff --git a/cc/animation/animation.h b/cc/animation/animation.h
index 96f631d..3a53f803 100644
--- a/cc/animation/animation.h
+++ b/cc/animation/animation.h
@@ -150,7 +150,7 @@
void set_use_start_time_from_impl() { use_start_time_from_impl_ = true; }
- absl::optional<base::TimeTicks> GetStartTime() const;
+ std::optional<base::TimeTicks> GetStartTime() const;
virtual bool IsWorkletAnimation() const;
diff --git a/cc/animation/animation_delegate.h b/cc/animation/animation_delegate.h
index a566f33a..6400635a 100644
--- a/cc/animation/animation_delegate.h
+++ b/cc/animation/animation_delegate.h
@@ -7,9 +7,9 @@
#include <memory>
+#include <optional>
#include "base/time/time.h"
#include "cc/animation/animation_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/animation/keyframe/animation_curve.h"
namespace cc {
@@ -33,7 +33,7 @@
base::TimeTicks animation_start_time,
std::unique_ptr<gfx::AnimationCurve> curve) = 0;
virtual void NotifyLocalTimeUpdated(
- absl::optional<base::TimeDelta> local_time) = 0;
+ std::optional<base::TimeDelta> local_time) = 0;
protected:
virtual ~AnimationDelegate() {}
diff --git a/cc/animation/animation_events.cc b/cc/animation/animation_events.cc
index 00038a4..0334f0922 100644
--- a/cc/animation/animation_events.cc
+++ b/cc/animation/animation_events.cc
@@ -21,7 +21,7 @@
AnimationEvent::AnimationEvent(int timeline_id,
int animation_id,
- absl::optional<base::TimeDelta> local_time)
+ std::optional<base::TimeDelta> local_time)
: type(Type::kTimeUpdated),
// Initializing model_id with an invalid value (0).
// Also initializing keyframe_id with 0 which in its case is a valid
diff --git a/cc/animation/animation_events.h b/cc/animation/animation_events.h
index 8d29e98..db688df5 100644
--- a/cc/animation/animation_events.h
+++ b/cc/animation/animation_events.h
@@ -34,7 +34,7 @@
// Constructs AnimationEvent of TIME_UPDATED type.
AnimationEvent(int timeline_id,
int animation_id,
- absl::optional<base::TimeDelta> local_time);
+ std::optional<base::TimeDelta> local_time);
AnimationEvent(const AnimationEvent& other);
AnimationEvent& operator=(const AnimationEvent& other);
@@ -55,7 +55,7 @@
std::unique_ptr<gfx::AnimationCurve> curve;
// Set for TIME_UPDATED events.
- absl::optional<base::TimeDelta> local_time;
+ std::optional<base::TimeDelta> local_time;
};
class CC_ANIMATION_EXPORT AnimationEvents : public MutatorEvents {
diff --git a/cc/animation/animation_host_unittest.cc b/cc/animation/animation_host_unittest.cc
index 369791d..096144a 100644
--- a/cc/animation/animation_host_unittest.cc
+++ b/cc/animation/animation_host_unittest.cc
@@ -34,7 +34,7 @@
// Helper method to convert base::TimeTicks to double.
// Returns double milliseconds if the input value is resolved or
// std::numeric_limits<double>::quiet_NaN() otherwise.
-double ToMilliseconds(absl::optional<base::TimeTicks> time_ticks) {
+double ToMilliseconds(std::optional<base::TimeTicks> time_ticks) {
if (!time_ticks) {
return std::numeric_limits<double>::quiet_NaN();
}
diff --git a/cc/animation/element_animations.cc b/cc/animation/element_animations.cc
index 249d1ad..49ba144 100644
--- a/cc/animation/element_animations.cc
+++ b/cc/animation/element_animations.cc
@@ -540,11 +540,10 @@
target_element_id, list_type, scroll_offset);
}
-absl::optional<gfx::PointF> ElementAnimations::ScrollOffsetForAnimation()
- const {
+std::optional<gfx::PointF> ElementAnimations::ScrollOffsetForAnimation() const {
if (animation_host_)
return animation_host_->GetScrollOffsetForAnimation(element_id());
- return absl::nullopt;
+ return std::nullopt;
}
PropertyToElementIdMap ElementAnimations::GetPropertyToElementIdMap() const {
diff --git a/cc/animation/element_animations.h b/cc/animation/element_animations.h
index d74d363..38d43982 100644
--- a/cc/animation/element_animations.h
+++ b/cc/animation/element_animations.h
@@ -136,7 +136,7 @@
int target_property_id,
gfx::KeyframeModel* keyframe_model) override;
- absl::optional<gfx::PointF> ScrollOffsetForAnimation() const;
+ std::optional<gfx::PointF> ScrollOffsetForAnimation() const;
// Returns a map of target property to the ElementId for that property, for
// KeyframeEffects associated with this ElementAnimations.
diff --git a/cc/animation/keyframe_effect.cc b/cc/animation/keyframe_effect.cc
index 29920e2b..1526bf40 100644
--- a/cc/animation/keyframe_effect.cc
+++ b/cc/animation/keyframe_effect.cc
@@ -141,7 +141,7 @@
is_ticking_ = false;
// Resetting last_tick_time_ here ensures that calling ::UpdateState
// before ::Animate doesn't start a keyframe model.
- last_tick_time_ = absl::nullopt;
+ last_tick_time_ = std::nullopt;
animation_->RemoveFromTicking();
}
@@ -151,7 +151,7 @@
// Animate hasn't been called, this happens if an element has been added
// between the Commit and Draw phases.
- if (last_tick_time_ == absl::nullopt || awaiting_deletion_) {
+ if (last_tick_time_ == std::nullopt || awaiting_deletion_) {
start_ready_keyframe_models = false;
}
@@ -655,7 +655,7 @@
!ScrollOffsetAnimationCurve::ToScrollOffsetAnimationCurve(
keyframe_model->curve())
->HasSetInitialValue()) {
- absl::optional<gfx::PointF> current_scroll_offset;
+ std::optional<gfx::PointF> current_scroll_offset;
// If the scroller was already composited, prefer using its current scroll
// offset.
current_scroll_offset = keyframe_effect_impl->ScrollOffsetForAnimation();
@@ -719,7 +719,7 @@
void KeyframeEffect::PushPropertiesTo(
KeyframeEffect* keyframe_effect_impl,
- absl::optional<base::TimeTicks> replaced_start_time) {
+ std::optional<base::TimeTicks> replaced_start_time) {
if (!needs_push_properties_)
return;
needs_push_properties_ = false;
@@ -1088,7 +1088,7 @@
element_animations_->UpdateClientAnimationState();
}
-absl::optional<gfx::PointF> KeyframeEffect::ScrollOffsetForAnimation() const {
+std::optional<gfx::PointF> KeyframeEffect::ScrollOffsetForAnimation() const {
return element_animations_->ScrollOffsetForAnimation();
}
diff --git a/cc/animation/keyframe_effect.h b/cc/animation/keyframe_effect.h
index 705e01c..0021165 100644
--- a/cc/animation/keyframe_effect.h
+++ b/cc/animation/keyframe_effect.h
@@ -154,7 +154,7 @@
// If `replaced_start_time` is provided, it will be set as the start time on
// this' keyframe models prior to being pushed.
void PushPropertiesTo(KeyframeEffect* keyframe_effect_impl,
- absl::optional<base::TimeTicks> replaced_start_time);
+ std::optional<base::TimeTicks> replaced_start_time);
std::string KeyframeModelsToString() const;
@@ -182,7 +182,7 @@
void MarkKeyframeModelsForDeletion(base::TimeTicks, AnimationEvents* events);
void MarkFinishedKeyframeModels(base::TimeTicks monotonic_time);
- absl::optional<gfx::PointF> ScrollOffsetForAnimation() const;
+ std::optional<gfx::PointF> ScrollOffsetForAnimation() const;
void GenerateEvent(AnimationEvents* events,
const KeyframeModel& keyframe_model,
AnimationEvent::Type type,
@@ -208,7 +208,7 @@
bool is_ticking_;
bool awaiting_deletion_;
- absl::optional<base::TimeTicks> last_tick_time_;
+ std::optional<base::TimeTicks> last_tick_time_;
bool needs_push_properties_;
};
diff --git a/cc/animation/scroll_offset_animation_curve.cc b/cc/animation/scroll_offset_animation_curve.cc
index 9709308..ebb3ed7 100644
--- a/cc/animation/scroll_offset_animation_curve.cc
+++ b/cc/animation/scroll_offset_animation_curve.cc
@@ -128,13 +128,13 @@
} // namespace
-absl::optional<double>
+std::optional<double>
ScrollOffsetAnimationCurve::animation_duration_for_testing_;
ScrollOffsetAnimationCurve::ScrollOffsetAnimationCurve(
const gfx::PointF& target_value,
AnimationType animation_type,
- absl::optional<DurationBehavior> duration_behavior)
+ std::optional<DurationBehavior> duration_behavior)
: target_value_(target_value),
animation_type_(animation_type),
duration_behavior_(duration_behavior),
@@ -159,7 +159,7 @@
const gfx::PointF& target_value,
std::unique_ptr<TimingFunction> timing_function,
AnimationType animation_type,
- absl::optional<DurationBehavior> duration_behavior)
+ std::optional<DurationBehavior> duration_behavior)
: target_value_(target_value),
timing_function_(std::move(timing_function)),
animation_type_(animation_type),
@@ -224,7 +224,7 @@
base::TimeDelta ScrollOffsetAnimationCurve::SegmentDuration(
const gfx::Vector2dF& delta,
base::TimeDelta delayed_by,
- absl::optional<double> velocity) {
+ std::optional<double> velocity) {
switch (animation_type_) {
case AnimationType::kEaseInOut:
DCHECK(duration_behavior_.has_value());
diff --git a/cc/animation/scroll_offset_animation_curve.h b/cc/animation/scroll_offset_animation_curve.h
index e0401e4..753aa449 100644
--- a/cc/animation/scroll_offset_animation_curve.h
+++ b/cc/animation/scroll_offset_animation_curve.h
@@ -7,11 +7,11 @@
#include <memory>
+#include <optional>
#include "base/gtest_prod_util.h"
#include "base/memory/raw_ptr.h"
#include "base/time/time.h"
#include "cc/animation/animation_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/animation/keyframe/animation_curve.h"
#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/vector2d_f.h"
@@ -125,17 +125,17 @@
ScrollOffsetAnimationCurve(
const gfx::PointF& target_value,
AnimationType animation_type,
- absl::optional<DurationBehavior> duration_behavior = absl::nullopt);
+ std::optional<DurationBehavior> duration_behavior = std::nullopt);
ScrollOffsetAnimationCurve(
const gfx::PointF& target_value,
std::unique_ptr<gfx::TimingFunction> timing_function,
AnimationType animation_type,
- absl::optional<DurationBehavior> duration_behavior);
+ std::optional<DurationBehavior> duration_behavior);
base::TimeDelta SegmentDuration(
const gfx::Vector2dF& delta,
base::TimeDelta delayed_by,
- absl::optional<double> velocity = absl::nullopt);
+ std::optional<double> velocity = std::nullopt);
base::TimeDelta EaseInOutBoundedSegmentDuration(
const gfx::Vector2dF& new_delta,
@@ -156,11 +156,11 @@
AnimationType animation_type_;
// Only valid when |animation_type_| is EASE_IN_OUT.
- absl::optional<DurationBehavior> duration_behavior_;
+ std::optional<DurationBehavior> duration_behavior_;
bool has_set_initial_value_;
- static absl::optional<double> animation_duration_for_testing_;
+ static std::optional<double> animation_duration_for_testing_;
raw_ptr<Target, DanglingUntriaged> target_ = nullptr;
};
diff --git a/cc/animation/scroll_offset_animations_impl.h b/cc/animation/scroll_offset_animations_impl.h
index 60ca91c..d5f14b2 100644
--- a/cc/animation/scroll_offset_animations_impl.h
+++ b/cc/animation/scroll_offset_animations_impl.h
@@ -79,7 +79,7 @@
base::TimeTicks animation_start_time,
std::unique_ptr<gfx::AnimationCurve> curve) override {}
void NotifyLocalTimeUpdated(
- absl::optional<base::TimeDelta> local_time) override {}
+ std::optional<base::TimeDelta> local_time) override {}
bool IsAnimating() const;
bool IsAutoScrolling() const;
diff --git a/cc/animation/scroll_timeline.cc b/cc/animation/scroll_timeline.cc
index d936a7d..5a66dac 100644
--- a/cc/animation/scroll_timeline.cc
+++ b/cc/animation/scroll_timeline.cc
@@ -29,9 +29,9 @@
} // namespace
-ScrollTimeline::ScrollTimeline(absl::optional<ElementId> scroller_id,
+ScrollTimeline::ScrollTimeline(std::optional<ElementId> scroller_id,
ScrollDirection direction,
- absl::optional<ScrollOffsets> scroll_offsets,
+ std::optional<ScrollOffsets> scroll_offsets,
int animation_timeline_id)
: AnimationTimeline(animation_timeline_id, /* is_impl_only */ false),
pending_id_(scroller_id),
@@ -41,9 +41,9 @@
ScrollTimeline::~ScrollTimeline() = default;
scoped_refptr<ScrollTimeline> ScrollTimeline::Create(
- absl::optional<ElementId> scroller_id,
+ std::optional<ElementId> scroller_id,
ScrollTimeline::ScrollDirection direction,
- absl::optional<ScrollOffsets> scroll_offsets) {
+ std::optional<ScrollOffsets> scroll_offsets) {
return base::WrapRefCounted(
new ScrollTimeline(scroller_id, direction, scroll_offsets,
AnimationIdProvider::NextTimelineId()));
@@ -76,14 +76,14 @@
}
// https://drafts.csswg.org/scroll-animations-1/#current-time-algorithm
-absl::optional<base::TimeTicks> ScrollTimeline::CurrentTime(
+std::optional<base::TimeTicks> ScrollTimeline::CurrentTime(
const ScrollTree& scroll_tree,
bool is_active_tree) const {
// If the timeline is not active return unresolved value by the spec.
// https://github.com/WICG/scroll-animations/issues/31
// https://wicg.github.io/scroll-animations/#current-time-algorithm
if (!IsActive(scroll_tree, is_active_tree)) {
- return absl::nullopt;
+ return std::nullopt;
}
ElementId scroller_id =
@@ -122,7 +122,7 @@
return base::TimeTicks() + base::Microseconds(progress_us);
}
-absl::optional<base::TimeTicks> ScrollTimeline::Duration(
+std::optional<base::TimeTicks> ScrollTimeline::Duration(
const ScrollTree& scroll_tree,
bool is_active_tree) const {
double start_offset = 0;
@@ -163,7 +163,7 @@
const std::vector<scoped_refptr<Animation>>& ticking_animations,
const ScrollTree& scroll_tree,
bool is_active_tree) {
- absl::optional<base::TimeTicks> tick_time =
+ std::optional<base::TimeTicks> tick_time =
CurrentTime(scroll_tree, is_active_tree);
if (!tick_time)
return false;
@@ -192,8 +192,8 @@
}
void ScrollTimeline::UpdateScrollerIdAndScrollOffsets(
- absl::optional<ElementId> pending_id,
- absl::optional<ScrollOffsets> pending_offsets) {
+ std::optional<ElementId> pending_id,
+ std::optional<ScrollOffsets> pending_offsets) {
if (pending_id_.Read(*this) == pending_id &&
pending_offsets_.Read(*this) == pending_offsets) {
return;
diff --git a/cc/animation/scroll_timeline.h b/cc/animation/scroll_timeline.h
index 2499cf7..7df893f 100644
--- a/cc/animation/scroll_timeline.h
+++ b/cc/animation/scroll_timeline.h
@@ -5,13 +5,13 @@
#ifndef CC_ANIMATION_SCROLL_TIMELINE_H_
#define CC_ANIMATION_SCROLL_TIMELINE_H_
+#include <optional>
#include <vector>
#include "base/time/time.h"
#include "cc/animation/animation_export.h"
#include "cc/animation/animation_timeline.h"
#include "cc/animation/keyframe_model.h"
#include "cc/paint/element_id.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace cc {
@@ -82,15 +82,15 @@
// = 16 range
static constexpr double kScrollTimelineMicrosecondsPerPixel = 16;
- ScrollTimeline(absl::optional<ElementId> scroller_id,
+ ScrollTimeline(std::optional<ElementId> scroller_id,
ScrollDirection direction,
- absl::optional<ScrollOffsets> scroll_offsets,
+ std::optional<ScrollOffsets> scroll_offsets,
int animation_timeline_id);
static scoped_refptr<ScrollTimeline> Create(
- absl::optional<ElementId> scroller_id,
+ std::optional<ElementId> scroller_id,
ScrollDirection direction,
- absl::optional<ScrollOffsets> scroll_offsets);
+ std::optional<ScrollOffsets> scroll_offsets);
// Create a copy of this ScrollTimeline intended for the impl thread in the
// compositor.
@@ -102,20 +102,19 @@
bool is_active_tree) const;
// Calculate the current time of the ScrollTimeline. This is either a
- // base::TimeTicks value or absl::nullopt if the current time is unresolved.
+ // base::TimeTicks value or std::nullopt if the current time is unresolved.
// The internal calculations are performed using doubles and the result is
// converted to base::TimeTicks. This limits the precision to 1us.
- virtual absl::optional<base::TimeTicks> CurrentTime(
+ virtual std::optional<base::TimeTicks> CurrentTime(
const ScrollTree& scroll_tree,
bool is_active_tree) const;
- virtual absl::optional<base::TimeTicks> Duration(
- const ScrollTree& scroll_tree,
- bool is_active_tree) const;
+ virtual std::optional<base::TimeTicks> Duration(const ScrollTree& scroll_tree,
+ bool is_active_tree) const;
void UpdateScrollerIdAndScrollOffsets(
- absl::optional<ElementId> scroller_id,
- absl::optional<ScrollOffsets> scroll_offsets);
+ std::optional<ElementId> scroller_id,
+ std::optional<ScrollOffsets> scroll_offsets);
void PushPropertiesTo(AnimationTimeline* impl_timeline) override;
void ActivateTimeline() override;
@@ -125,22 +124,22 @@
const ScrollTree& scroll_tree,
bool is_active_tree) override;
- absl::optional<ElementId> GetActiveIdForTest() const { return active_id(); }
- absl::optional<ElementId> GetPendingIdForTest() const { return pending_id(); }
+ std::optional<ElementId> GetActiveIdForTest() const { return active_id(); }
+ std::optional<ElementId> GetPendingIdForTest() const { return pending_id(); }
ScrollDirection GetDirectionForTest() const { return direction(); }
- absl::optional<double> GetStartScrollOffsetForTest() const {
- absl::optional<ScrollOffsets> offsets = pending_offsets();
+ std::optional<double> GetStartScrollOffsetForTest() const {
+ std::optional<ScrollOffsets> offsets = pending_offsets();
if (offsets) {
return offsets->start;
}
- return absl::nullopt;
+ return std::nullopt;
}
- absl::optional<double> GetEndScrollOffsetForTest() const {
- absl::optional<ScrollOffsets> offsets = pending_offsets();
+ std::optional<double> GetEndScrollOffsetForTest() const {
+ std::optional<ScrollOffsets> offsets = pending_offsets();
if (offsets) {
return offsets->end;
}
- return absl::nullopt;
+ return std::nullopt;
}
bool IsScrollTimeline() const override;
@@ -150,21 +149,21 @@
~ScrollTimeline() override;
private:
- const absl::optional<ElementId>& active_id() const {
+ const std::optional<ElementId>& active_id() const {
return active_id_.Read(*this);
}
- const absl::optional<ElementId>& pending_id() const {
+ const std::optional<ElementId>& pending_id() const {
return pending_id_.Read(*this);
}
const ScrollDirection& direction() const { return direction_.Read(*this); }
- const absl::optional<ScrollOffsets>& active_offsets() const {
+ const std::optional<ScrollOffsets>& active_offsets() const {
return active_offsets_.Read(*this);
}
- const absl::optional<ScrollOffsets>& pending_offsets() const {
+ const std::optional<ScrollOffsets>& pending_offsets() const {
return pending_offsets_.Read(*this);
}
@@ -173,15 +172,15 @@
// http://crbug.com/847588).
// Only the impl thread can set active properties.
- ProtectedSequenceForbidden<absl::optional<ElementId>> active_id_;
- ProtectedSequenceWritable<absl::optional<ElementId>> pending_id_;
+ ProtectedSequenceForbidden<std::optional<ElementId>> active_id_;
+ ProtectedSequenceWritable<std::optional<ElementId>> pending_id_;
// The direction of the ScrollTimeline indicates which axis of the scroller
// it should base its current time on, and where the origin point is.
ProtectedSequenceReadable<ScrollDirection> direction_;
- ProtectedSequenceForbidden<absl::optional<ScrollOffsets>> active_offsets_;
- ProtectedSequenceWritable<absl::optional<ScrollOffsets>> pending_offsets_;
+ ProtectedSequenceForbidden<std::optional<ScrollOffsets>> active_offsets_;
+ ProtectedSequenceWritable<std::optional<ScrollOffsets>> pending_offsets_;
};
inline ScrollTimeline* ToScrollTimeline(AnimationTimeline* timeline) {
diff --git a/cc/animation/scroll_timeline_unittest.cc b/cc/animation/scroll_timeline_unittest.cc
index a14904b..271c70f 100644
--- a/cc/animation/scroll_timeline_unittest.cc
+++ b/cc/animation/scroll_timeline_unittest.cc
@@ -82,7 +82,7 @@
// Helper method to convert base::TimeTicks to double.
// Returns double milliseconds if the input value is resolved or
// std::numeric_limits<double>::quiet_NaN() otherwise.
-double ToDouble(absl::optional<base::TimeTicks> time_ticks) {
+double ToDouble(std::optional<base::TimeTicks> time_ticks) {
if (time_ticks)
return (time_ticks.value() - base::TimeTicks()).InMillisecondsF();
return std::numeric_limits<double>::quiet_NaN();
@@ -393,7 +393,7 @@
double scroll_size = content_size().height() - container_size().height();
ScrollTimeline::ScrollOffsets scroll_offsets(0, scroll_size);
scoped_refptr<ScrollTimeline> inactive_timeline1 = ScrollTimeline::Create(
- absl::nullopt, ScrollTimeline::ScrollDown, scroll_offsets);
+ std::nullopt, ScrollTimeline::ScrollDown, scroll_offsets);
EXPECT_FALSE(
inactive_timeline1->IsActive(scroll_tree(), false /*is_active_tree*/));
EXPECT_FALSE(
@@ -413,7 +413,7 @@
// ScrollTimeline with empty scroll offsets is inactive.
scoped_refptr<ScrollTimeline> inactive_timeline3 =
ScrollTimeline::Create(scroller_id(), ScrollTimeline::ScrollDown,
- /* scroll_offsets */ absl::nullopt);
+ /* scroll_offsets */ std::nullopt);
EXPECT_FALSE(
inactive_timeline3->IsActive(scroll_tree(), false /*is_active_tree*/));
EXPECT_FALSE(
diff --git a/cc/animation/worklet_animation.cc b/cc/animation/worklet_animation.cc
index 7f952d9..bdca282 100644
--- a/cc/animation/worklet_animation.cc
+++ b/cc/animation/worklet_animation.cc
@@ -122,7 +122,7 @@
// TODO(https://crbug.com/1011138): Initialize current_time to null if the
// timeline is inactive. It might be inactive here when state is
// State::REMOVED.
- absl::optional<base::TimeDelta> current_time =
+ std::optional<base::TimeDelta> current_time =
CurrentTime(monotonic_time, scroll_tree, is_active_tree);
// When the timeline is inactive (only the case with scroll timelines), the
@@ -199,18 +199,18 @@
has_pending_tree_lock_.Write(*this) = false;
}
-absl::optional<base::TimeDelta> WorkletAnimation::CurrentTime(
+std::optional<base::TimeDelta> WorkletAnimation::CurrentTime(
base::TimeTicks monotonic_time,
const ScrollTree& scroll_tree,
bool is_active_tree) {
DCHECK(IsTimelineActive(scroll_tree, is_active_tree));
base::TimeTicks timeline_time;
if (animation_timeline()->IsScrollTimeline()) {
- absl::optional<base::TimeTicks> scroll_monotonic_time =
+ std::optional<base::TimeTicks> scroll_monotonic_time =
ToScrollTimeline(animation_timeline())
->CurrentTime(scroll_tree, is_active_tree);
if (!scroll_monotonic_time)
- return absl::nullopt;
+ return std::nullopt;
timeline_time = scroll_monotonic_time.value();
} else {
timeline_time = monotonic_time;
@@ -230,7 +230,7 @@
if (!IsTimelineActive(scroll_tree, is_active_tree))
return false;
- absl::optional<base::TimeDelta> current_time =
+ std::optional<base::TimeDelta> current_time =
CurrentTime(monotonic_time, scroll_tree, is_active_tree);
bool needs_update = last_current_time_.Read(*this) != current_time;
return needs_update;
diff --git a/cc/animation/worklet_animation.h b/cc/animation/worklet_animation.h
index b9cd272..5ce3b1ed 100644
--- a/cc/animation/worklet_animation.h
+++ b/cc/animation/worklet_animation.h
@@ -8,13 +8,13 @@
#include <memory>
#include <string>
+#include <optional>
#include "base/gtest_prod_util.h"
#include "base/time/time.h"
#include "cc/animation/animation.h"
#include "cc/animation/animation_export.h"
#include "cc/animation/animation_host.h"
#include "cc/trees/property_tree.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace cc {
@@ -86,9 +86,9 @@
// The current time is based on the timeline associated with the animation and
// in case of scroll timeline it may be nullopt when the associated scrolling
// node is not available in the particular ScrollTree.
- absl::optional<base::TimeDelta> CurrentTime(base::TimeTicks monotonic_time,
- const ScrollTree& scroll_tree,
- bool is_active_tree);
+ std::optional<base::TimeDelta> CurrentTime(base::TimeTicks monotonic_time,
+ const ScrollTree& scroll_tree,
+ bool is_active_tree);
// Returns true if the worklet animation needs to be updated which happens iff
// its current time is going to be different from last time given these input.
@@ -130,19 +130,19 @@
// Local time is used as an input to the keyframe effect of this animation.
// The value comes from the user script that runs inside the animation worklet
// global scope.
- ProtectedSequenceReadable<absl::optional<base::TimeDelta>> local_time_;
+ ProtectedSequenceReadable<std::optional<base::TimeDelta>> local_time_;
// Local time passed to the main thread worklet animation to update its
// keyframe effect. We only set the most recent local time, meaning that if
// there are multiple compositor frames without a single main frame only
// the local time associated with the latest frame is sent to the main thread.
- ProtectedSequenceReadable<absl::optional<base::TimeDelta>>
+ ProtectedSequenceReadable<std::optional<base::TimeDelta>>
last_synced_local_time_;
- ProtectedSequenceReadable<absl::optional<base::TimeTicks>> start_time_;
+ ProtectedSequenceReadable<std::optional<base::TimeTicks>> start_time_;
// Last current time used for updating. We use this to skip updating if
// current time has not changed since last update.
- ProtectedSequenceReadable<absl::optional<base::TimeDelta>> last_current_time_;
+ ProtectedSequenceReadable<std::optional<base::TimeDelta>> last_current_time_;
// To ensure that 'time' progresses forward for scroll animations, we guard
// against allowing active tree mutations while the pending tree has a
diff --git a/cc/animation/worklet_animation_unittest.cc b/cc/animation/worklet_animation_unittest.cc
index 6674c716..6125317 100644
--- a/cc/animation/worklet_animation_unittest.cc
+++ b/cc/animation/worklet_animation_unittest.cc
@@ -60,10 +60,10 @@
MockScrollTimeline()
: ScrollTimeline(ElementId(),
ScrollTimeline::ScrollDown,
- /* scroll_offsets */ absl::nullopt,
+ /* scroll_offsets */ std::nullopt,
AnimationIdProvider::NextTimelineId()) {}
MOCK_CONST_METHOD2(CurrentTime,
- absl::optional<base::TimeTicks>(const ScrollTree&, bool));
+ std::optional<base::TimeTicks>(const ScrollTree&, bool));
MOCK_CONST_METHOD2(IsActive, bool(const ScrollTree&, bool));
protected:
@@ -122,7 +122,7 @@
TEST_F(WorkletAnimationTest, AnimationEventLocalTimeUpdate) {
AttachWorkletAnimation();
- absl::optional<base::TimeDelta> local_time = base::Seconds(1);
+ std::optional<base::TimeDelta> local_time = base::Seconds(1);
MutatorOutputState::AnimationState state(worklet_animation_id_);
state.local_times.push_back(local_time);
worklet_animation_->SetOutputState(state);
@@ -156,7 +156,7 @@
// If local time is set to null value, an animation event with null local
// time is generated.
state.local_times.clear();
- local_time = absl::nullopt;
+ local_time = std::nullopt;
state.local_times.push_back(local_time);
worklet_animation_->SetOutputState(state);
mutator_events = host_->CreateEvents();
@@ -489,8 +489,8 @@
EXPECT_EQ(input->removed_animations.size(), 1u);
}
-absl::optional<base::TimeTicks> FakeIncreasingScrollTimelineTime(Unused,
- Unused) {
+std::optional<base::TimeTicks> FakeIncreasingScrollTimelineTime(Unused,
+ Unused) {
static base::TimeTicks current_time;
current_time += base::Seconds(0.1);
return current_time;
diff --git a/cc/base/list_container.h b/cc/base/list_container.h
index b8210f5..fdeae1b 100644
--- a/cc/base/list_container.h
+++ b/cc/base/list_container.h
@@ -11,9 +11,9 @@
#include <memory>
#include <utility>
+#include <optional>
#include "base/check.h"
#include "cc/base/list_container_helper.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace cc {
@@ -138,7 +138,7 @@
Iterator InsertBeforeAndInvalidateAllPointers(
Iterator at,
size_t count,
- const absl::optional<DerivedElementType> source = absl::nullopt) {
+ const std::optional<DerivedElementType> source = std::nullopt) {
helper_.InsertBeforeAndInvalidateAllPointers(&at, count);
Iterator result = at;
for (size_t i = 0; i < count; ++i) {
diff --git a/cc/base/list_container_unittest.cc b/cc/base/list_container_unittest.cc
index 703a62d..00c0701 100644
--- a/cc/base/list_container_unittest.cc
+++ b/cc/base/list_container_unittest.cc
@@ -152,9 +152,9 @@
<< "element destructor called the wrong number of times";
}
- // Not using absl::optional<size_t> here in order to get a precise destructor
+ // Not using std::optional<size_t> here in order to get a precise destructor
// behavior. The tests below need the ability to catch multiple destructor
- // calls, and absl::optional's destructor might make has_value() return false.
+ // calls, and std::optional's destructor might make has_value() return false.
size_t expected_destructor_calls_;
bool has_expected_destructor_calls_ = false;
size_t destructor_calls_ = 0;
diff --git a/cc/benchmarks/invalidation_benchmark.cc b/cc/benchmarks/invalidation_benchmark.cc
index e71c946..e08232b 100644
--- a/cc/benchmarks/invalidation_benchmark.cc
+++ b/cc/benchmarks/invalidation_benchmark.cc
@@ -11,6 +11,7 @@
#include <string>
#include <utility>
+#include <optional>
#include "base/rand_util.h"
#include "base/values.h"
#include "cc/base/math_util.h"
@@ -18,7 +19,6 @@
#include "cc/layers/picture_layer.h"
#include "cc/trees/draw_property_utils.h"
#include "cc/trees/layer_tree_host.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/rect.h"
namespace cc {
diff --git a/cc/benchmarks/rasterize_and_record_benchmark.cc b/cc/benchmarks/rasterize_and_record_benchmark.cc
index e837a8c..dc3421c 100644
--- a/cc/benchmarks/rasterize_and_record_benchmark.cc
+++ b/cc/benchmarks/rasterize_and_record_benchmark.cc
@@ -10,6 +10,7 @@
#include <limits>
#include <string>
+#include <optional>
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/task/single_thread_task_runner.h"
@@ -20,7 +21,6 @@
#include "cc/layers/recording_source.h"
#include "cc/paint/display_item_list.h"
#include "cc/trees/layer_tree_host.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/rect.h"
namespace cc {
diff --git a/cc/benchmarks/rasterize_and_record_benchmark_impl.cc b/cc/benchmarks/rasterize_and_record_benchmark_impl.cc
index 2d3efd2..5e62bbb 100644
--- a/cc/benchmarks/rasterize_and_record_benchmark_impl.cc
+++ b/cc/benchmarks/rasterize_and_record_benchmark_impl.cc
@@ -63,7 +63,7 @@
// Pass an empty settings to make sure that the decode cache is used to
// replace all images.
- absl::optional<PlaybackImageProvider::Settings> image_settings;
+ std::optional<PlaybackImageProvider::Settings> image_settings;
image_settings.emplace();
image_settings->images_to_skip = {};
image_settings->image_to_current_frame_index = {};
diff --git a/cc/benchmarks/unittest_only_benchmark.cc b/cc/benchmarks/unittest_only_benchmark.cc
index 8096876..2bb40d8 100644
--- a/cc/benchmarks/unittest_only_benchmark.cc
+++ b/cc/benchmarks/unittest_only_benchmark.cc
@@ -6,12 +6,12 @@
#include <utility>
+#include <optional>
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/task/single_thread_task_runner.h"
#include "base/values.h"
#include "cc/benchmarks/unittest_only_benchmark_impl.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace cc {
diff --git a/cc/input/browser_controls_offset_manager.cc b/cc/input/browser_controls_offset_manager.cc
index 7ee3f4a..4c6bc64 100644
--- a/cc/input/browser_controls_offset_manager.cc
+++ b/cc/input/browser_controls_offset_manager.cc
@@ -522,11 +522,11 @@
float old_top_offset = ContentTopOffset();
float old_bottom_offset = ContentBottomOffset();
- absl::optional<float> new_top_ratio =
+ std::optional<float> new_top_ratio =
top_controls_animation_.Tick(monotonic_time);
if (!new_top_ratio.has_value())
new_top_ratio = TopControlsShownRatio();
- absl::optional<float> new_bottom_ratio =
+ std::optional<float> new_bottom_ratio =
bottom_controls_animation_.Tick(monotonic_time);
if (!new_bottom_ratio.has_value())
new_bottom_ratio = BottomControlsShownRatio();
@@ -573,9 +573,9 @@
void BrowserControlsOffsetManager::ResetAnimations() {
// If the animation doesn't need to jump to the end, Animation::Reset() will
- // return |absl::nullopt|.
- absl::optional<float> top_ratio = top_controls_animation_.Reset();
- absl::optional<float> bottom_ratio = bottom_controls_animation_.Reset();
+ // return |std::nullopt|.
+ std::optional<float> top_ratio = top_controls_animation_.Reset();
+ std::optional<float> bottom_ratio = bottom_controls_animation_.Reset();
if (top_ratio.has_value() || bottom_ratio.has_value()) {
client_->SetCurrentBrowserControlsShownRatio(
@@ -740,10 +740,10 @@
std::max(start_value_, stop_value_));
}
-absl::optional<float> BrowserControlsOffsetManager::Animation::Tick(
+std::optional<float> BrowserControlsOffsetManager::Animation::Tick(
base::TimeTicks monotonic_time) {
if (!IsInitialized())
- return absl::nullopt;
+ return std::nullopt;
if (!started_) {
start_time_ = monotonic_time;
@@ -767,11 +767,11 @@
max_value_ = max;
}
-absl::optional<float> BrowserControlsOffsetManager::Animation::Reset() {
+std::optional<float> BrowserControlsOffsetManager::Animation::Reset() {
auto ret =
jump_to_end_on_reset_
- ? absl::make_optional(std::clamp(stop_value_, min_value_, max_value_))
- : absl::nullopt;
+ ? std::make_optional(std::clamp(stop_value_, min_value_, max_value_))
+ : std::nullopt;
started_ = false;
initialized_ = false;
diff --git a/cc/input/browser_controls_offset_manager.h b/cc/input/browser_controls_offset_manager.h
index 9a468fe..501082f 100644
--- a/cc/input/browser_controls_offset_manager.h
+++ b/cc/input/browser_controls_offset_manager.h
@@ -8,12 +8,12 @@
#include <memory>
#include <utility>
+#include <optional>
#include "base/memory/raw_ptr.h"
#include "base/time/time.h"
#include "cc/input/browser_controls_state.h"
#include "cc/layers/layer_impl.h"
#include "cc/trees/browser_controls_params.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/geometry/vector2d_f.h"
@@ -175,11 +175,10 @@
// Minimum and maximum values |top_controls_min_height_offset_| can take
// during the current min-height change animation.
- absl::optional<std::pair<float, float>>
- top_min_height_offset_animation_range_;
+ std::optional<std::pair<float, float>> top_min_height_offset_animation_range_;
// Minimum and maximum values |bottom_controls_min_height_offset_| can take
// during the current min-height change animation.
- absl::optional<std::pair<float, float>>
+ std::optional<std::pair<float, float>>
bottom_min_height_offset_animation_range_;
// Should ScrollEnd() animate the controls into view? This is used if there's
@@ -206,14 +205,14 @@
int64_t duration,
bool jump_to_end_on_reset);
// Returns the animated value for the given monotonic time tick if the
- // animation is initialized. Otherwise, returns |absl::nullopt|.
- absl::optional<float> Tick(base::TimeTicks monotonic_time);
+ // animation is initialized. Otherwise, returns |std::nullopt|.
+ std::optional<float> Tick(base::TimeTicks monotonic_time);
// Set the minimum and maximum values the animation can have.
void SetBounds(float min, float max);
// Reset the properties. If |skip_to_end_on_reset_| is false, this function
- // will return |absl::nullopt|. Otherwise, it will return the end value
+ // will return |std::nullopt|. Otherwise, it will return the end value
// (clamped to min-max).
- absl::optional<float> Reset();
+ std::optional<float> Reset();
// Returns the value the animation will end on. This will be the stop_value
// passed to the constructor clamped by the currently configured bounds.
diff --git a/cc/input/input_handler.cc b/cc/input/input_handler.cc
index 1bd808cc..9966414 100644
--- a/cc/input/input_handler.cc
+++ b/cc/input/input_handler.cc
@@ -821,7 +821,7 @@
return true;
}
-absl::optional<gfx::PointF> InputHandler::ConstrainFling(gfx::PointF original) {
+std::optional<gfx::PointF> InputHandler::ConstrainFling(gfx::PointF original) {
gfx::PointF fling = original;
if (fling_snap_constrain_x_) {
fling.set_x(std::clamp(fling.x(), fling_snap_constrain_x_->GetMin(),
@@ -831,7 +831,7 @@
fling.set_y(std::clamp(fling.y(), fling_snap_constrain_y_->GetMin(),
fling_snap_constrain_y_->GetMax()));
}
- return original == fling ? absl::nullopt : absl::make_optional(fling);
+ return original == fling ? std::nullopt : std::make_optional(fling);
}
bool InputHandler::GetSnapFlingInfoAndSetAnimatingSnapTarget(
@@ -856,7 +856,7 @@
gfx::PointF new_offset = current_offset + current_delta_in_content;
if (snap_fling_state_ == kConstrainedNativeFling) {
- if (absl::optional<gfx::PointF> constrained = ConstrainFling(new_offset)) {
+ if (std::optional<gfx::PointF> constrained = ConstrainFling(new_offset)) {
snap_displacement = *constrained - current_offset;
} else {
return false;
diff --git a/cc/input/input_handler.h b/cc/input/input_handler.h
index 22b1cda..29d96c936 100644
--- a/cc/input/input_handler.h
+++ b/cc/input/input_handler.h
@@ -634,7 +634,7 @@
return scrollbar_controller_.get();
}
- absl::optional<gfx::PointF> ConstrainFling(gfx::PointF original);
+ std::optional<gfx::PointF> ConstrainFling(gfx::PointF original);
// The input handler is owned by the delegate so their lifetimes are tied
// together.
@@ -659,12 +659,12 @@
// The source device type that started the scroll gesture. Only set between a
// ScrollBegin and ScrollEnd.
- absl::optional<ui::ScrollInputType> latched_scroll_type_;
+ std::optional<ui::ScrollInputType> latched_scroll_type_;
// Tracks the last scroll update/begin state received. Used to infer the most
// recent scroll type and direction.
- absl::optional<ScrollState> last_scroll_begin_state_;
- absl::optional<ScrollState> last_scroll_update_state_;
+ std::optional<ScrollState> last_scroll_begin_state_;
+ std::optional<ScrollState> last_scroll_update_state_;
// If a scroll snap is being animated, then the value of this will be the
// element id(s) of the target(s). Otherwise, the ids will be invalid.
@@ -679,8 +679,8 @@
kSnapFling
};
SnapFlingState snap_fling_state_ = kNoFling;
- absl::optional<gfx::RangeF> fling_snap_constrain_x_;
- absl::optional<gfx::RangeF> fling_snap_constrain_y_;
+ std::optional<gfx::RangeF> fling_snap_constrain_x_;
+ std::optional<gfx::RangeF> fling_snap_constrain_y_;
// A set of elements that scroll-snapped to a new target since the last
// begin main frame. The snap target ids of these elements will be sent to
diff --git a/cc/input/scroll_snap_data.cc b/cc/input/scroll_snap_data.cc
index 8ab1da7..b5dc015 100644
--- a/cc/input/scroll_snap_data.cc
+++ b/cc/input/scroll_snap_data.cc
@@ -46,7 +46,7 @@
}
void SetOrUpdateResult(const SnapSearchResult& candidate,
- absl::optional<SnapSearchResult>* result,
+ std::optional<SnapSearchResult>* result,
const ElementId& active_element_id) {
if (result->has_value()) {
result->value().Union(candidate);
@@ -57,11 +57,11 @@
}
}
-const absl::optional<SnapSearchResult>& ClosestSearchResult(
+const std::optional<SnapSearchResult>& ClosestSearchResult(
const gfx::PointF reference_point,
SearchAxis axis,
- const absl::optional<SnapSearchResult>& a,
- const absl::optional<SnapSearchResult>& b) {
+ const std::optional<SnapSearchResult>& a,
+ const std::optional<SnapSearchResult>& b) {
if (!a.has_value())
return b;
if (!b.has_value())
@@ -81,7 +81,7 @@
return distance_a < distance_b ? a : b;
}
-absl::optional<SnapSearchResult> SearchResultForDodgingRange(
+std::optional<SnapSearchResult> SearchResultForDodgingRange(
const gfx::RangeF& area_range,
const gfx::RangeF& dodging_range,
const SnapSearchResult& aligned_candidate,
@@ -90,7 +90,7 @@
float snapport_size,
SnapAlignment alignment) {
if (dodging_range.is_empty() || dodging_range.is_reversed()) {
- return absl::nullopt;
+ return std::nullopt;
}
// Use aligned_candidate as a template (we will override snap_offset and
@@ -129,7 +129,7 @@
min_offset = area_range.start() - scroll_padding;
max_offset = area_range.end() - scroll_padding - snapport_size;
if (max_offset < min_offset) {
- return absl::nullopt;
+ return std::nullopt;
}
result.set_snap_offset(std::clamp(offset, min_offset, max_offset));
@@ -229,7 +229,7 @@
strategy.ShouldPrioritizeSnapTargets() &&
target_snap_area_element_ids_.y != ElementId();
- absl::optional<SnapSearchResult> selected_x, selected_y;
+ std::optional<SnapSearchResult> selected_x, selected_y;
if (should_snap_on_x) {
// Start from current position in the cross axis. The search algorithm
// expects the cross axis position to be inside scroller bounds. But since
@@ -387,7 +387,7 @@
return snapped_target_ids;
}
-absl::optional<SnapSearchResult>
+std::optional<SnapSearchResult>
SnapContainerData::GetTargetSnapAreaSearchResult(
const SnapSelectionStrategy& strategy,
SearchAxis axis,
@@ -396,7 +396,7 @@
? target_snap_area_element_ids_.x
: target_snap_area_element_ids_.y;
if (target_id == ElementId())
- return absl::nullopt;
+ return std::nullopt;
for (const SnapAreaData& area : snap_area_list_) {
if (area.element_id == target_id && strategy.IsValidSnapArea(axis, area)) {
auto aligned_result = GetSnapSearchResult(axis, area);
@@ -420,7 +420,7 @@
return aligned_result;
}
}
- return absl::nullopt;
+ return std::nullopt;
}
void SnapContainerData::UpdateSnapAreaForTesting(ElementId element_id,
@@ -446,12 +446,12 @@
return true;
}
-absl::optional<SnapSearchResult> SnapContainerData::FindClosestValidArea(
+std::optional<SnapSearchResult> SnapContainerData::FindClosestValidArea(
SearchAxis axis,
const SnapSelectionStrategy& strategy,
const SnapSearchResult& cross_axis_snap_result,
const ElementId& active_element_id) const {
- absl::optional<SnapSearchResult> result = FindClosestValidAreaInternal(
+ std::optional<SnapSearchResult> result = FindClosestValidAreaInternal(
axis, strategy, cross_axis_snap_result, active_element_id);
// For EndAndDirectionStrategy, if there is a snap area with snap-stop:always,
@@ -467,7 +467,7 @@
strategy.current_position(),
strategy.intended_position() - strategy.current_position(),
strategy.UsingFractionalOffsets(), SnapStopAlwaysFilter::kRequire);
- absl::optional<SnapSearchResult> must_only_result =
+ std::optional<SnapSearchResult> must_only_result =
FindClosestValidAreaInternal(axis, *must_only_strategy,
cross_axis_snap_result, active_element_id,
false);
@@ -493,14 +493,13 @@
axis, *relaxed_strategy, cross_axis_snap_result, active_element_id);
}
-absl::optional<SnapSearchResult>
-SnapContainerData::FindClosestValidAreaInternal(
+std::optional<SnapSearchResult> SnapContainerData::FindClosestValidAreaInternal(
SearchAxis axis,
const SnapSelectionStrategy& strategy,
const SnapSearchResult& cross_axis_snap_result,
const ElementId& active_element_id,
bool should_consider_covering,
- absl::optional<gfx::RangeF> active_element_range) const {
+ std::optional<gfx::RangeF> active_element_range) const {
bool horiz = axis == SearchAxis::kX;
// The cross axis result is expected to be within bounds otherwise no snap
// area will meet the mutual visibility requirement.
@@ -509,10 +508,10 @@
(horiz ? max_position_.y() : max_position_.x()));
// The search result from the snap area that's closest to the search origin.
- absl::optional<SnapSearchResult> closest;
+ std::optional<SnapSearchResult> closest;
// The search result with the intended position if it makes a snap area cover
// the snapport.
- absl::optional<SnapSearchResult> covering_intended;
+ std::optional<SnapSearchResult> covering_intended;
// The intended position of the scroll operation if there's no snap. This
// scroll position becomes the covering candidate if there is a snap area that
@@ -562,7 +561,7 @@
(base::FeatureList::IsEnabled(features::kScrollSnapPreferCloserCovering)
? CanCoverSnapportOnAxis(axis, rect_, area.rect)
: IsSnapportCoveredOnAxis(axis, intended_position, area.rect))) {
- if (absl::optional<SnapSearchResult> covering =
+ if (std::optional<SnapSearchResult> covering =
FindCoveringCandidate(area, axis, candidate, intended_position)) {
if (covering->snap_offset() == intended_position) {
SetOrUpdateResult(*covering, &covering_intended, active_element_id);
@@ -584,7 +583,7 @@
// generates a snap position rejecting the current inplace candidate.
}
- const absl::optional<SnapSearchResult>& picked =
+ const std::optional<SnapSearchResult>& picked =
strategy.PickBestResult(closest, covering_intended);
return picked;
}
@@ -637,7 +636,7 @@
return result;
}
-absl::optional<SnapSearchResult> SnapContainerData::FindCoveringCandidate(
+std::optional<SnapSearchResult> SnapContainerData::FindCoveringCandidate(
const SnapAreaData& area,
SearchAxis axis,
const SnapSearchResult& aligned_candidate,
@@ -721,7 +720,7 @@
}
}
- absl::optional<SnapSearchResult> middle_candidate =
+ std::optional<SnapSearchResult> middle_candidate =
SearchResultForDodgingRange(area_range, middle_dodging_range,
aligned_candidate, intended_position,
scroll_padding, snapport_size, alignment);
@@ -729,11 +728,11 @@
return middle_candidate;
}
- absl::optional<SnapSearchResult> backward_candidate =
+ std::optional<SnapSearchResult> backward_candidate =
SearchResultForDodgingRange(area_range, backward_dodging_range,
aligned_candidate, intended_position,
scroll_padding, snapport_size, alignment);
- absl::optional<SnapSearchResult> forward_candidate =
+ std::optional<SnapSearchResult> forward_candidate =
SearchResultForDodgingRange(area_range, forward_dodging_range,
aligned_candidate, intended_position,
scroll_padding, snapport_size, alignment);
diff --git a/cc/input/scroll_snap_data.h b/cc/input/scroll_snap_data.h
index 5f1cbde..1d8844f 100644
--- a/cc/input/scroll_snap_data.h
+++ b/cc/input/scroll_snap_data.h
@@ -9,10 +9,10 @@
#include <utility>
#include <vector>
+#include <optional>
#include "base/gtest_prod_util.h"
#include "cc/cc_export.h"
#include "cc/paint/element_id.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/geometry/vector2d_f.h"
#include "ui/gfx/range/range_f.h"
@@ -114,7 +114,7 @@
ElementId element_id() const { return element_id_; }
void set_element_id(ElementId id) { element_id_ = id; }
- absl::optional<gfx::RangeF> covered_range() const { return covered_range_; }
+ std::optional<gfx::RangeF> covered_range() const { return covered_range_; }
void set_covered_range(const gfx::RangeF& range) { covered_range_ = range; }
private:
@@ -141,7 +141,7 @@
//
// If set, indicates the range of scroll offsets for which the snap area
// covers the viewport. The snap_offset_ will be a point within this range.
- absl::optional<gfx::RangeF> covered_range_;
+ std::optional<gfx::RangeF> covered_range_;
};
// Snap area is a bounding box that could be snapped to when a scroll happens in
@@ -217,8 +217,8 @@
// The elements generating the snap areas on both axes.
TargetSnapAreaElementIds target_element_ids;
- absl::optional<gfx::RangeF> covered_range_x;
- absl::optional<gfx::RangeF> covered_range_y;
+ std::optional<gfx::RangeF> covered_range_x;
+ std::optional<gfx::RangeF> covered_range_y;
};
class CC_EXPORT SnappedTargetData {
@@ -325,19 +325,19 @@
// it makes a snap area cover the snapport.
// When |active_element_range| is provided, only snap areas that overlap
// the active element are considered.
- absl::optional<SnapSearchResult> FindClosestValidAreaInternal(
+ std::optional<SnapSearchResult> FindClosestValidAreaInternal(
SearchAxis axis,
const SnapSelectionStrategy& strategy,
const SnapSearchResult& cross_axis_snap_result,
const ElementId& active_element_id,
bool should_consider_covering = true,
- absl::optional<gfx::RangeF> active_element_range = absl::nullopt) const;
+ std::optional<gfx::RangeF> active_element_range = std::nullopt) const;
// A wrapper of FindClosestValidAreaInternal(). If
// FindClosestValidAreaInternal() doesn't return a valid result when the snap
// type is mandatory and the strategy has an intended direction, we relax the
// strategy to ignore the direction and find again.
- absl::optional<SnapSearchResult> FindClosestValidArea(
+ std::optional<SnapSearchResult> FindClosestValidArea(
SearchAxis axis,
const SnapSelectionStrategy& strategy,
const SnapSearchResult& cross_axis_snap_result,
@@ -348,7 +348,7 @@
// Finds the snap area associated with the target snap area element id for the
// given axis.
- absl::optional<SnapSearchResult> GetTargetSnapAreaSearchResult(
+ std::optional<SnapSearchResult> GetTargetSnapAreaSearchResult(
const SnapSelectionStrategy& strategy,
SearchAxis axis,
SnapSearchResult cross_axis_snap_result) const;
@@ -369,7 +369,7 @@
void UpdateSnapAreaForTesting(ElementId element_id,
SnapAreaData snap_area_data);
- absl::optional<SnapSearchResult> FindCoveringCandidate(
+ std::optional<SnapSearchResult> FindCoveringCandidate(
const SnapAreaData& area,
SearchAxis axis,
const SnapSearchResult& aligned_candidate,
diff --git a/cc/input/scrollbar_controller.cc b/cc/input/scrollbar_controller.cc
index e548164..a6f6c83d 100644
--- a/cc/input/scrollbar_controller.cc
+++ b/cc/input/scrollbar_controller.cc
@@ -467,9 +467,9 @@
void ScrollbarController::ResetState() {
drag_processed_for_current_frame_ = false;
- drag_state_ = absl::nullopt;
- autoscroll_state_ = absl::nullopt;
- captured_scrollbar_metadata_ = absl::nullopt;
+ drag_state_ = std::nullopt;
+ autoscroll_state_ = std::nullopt;
+ captured_scrollbar_metadata_ = std::nullopt;
if (cancelable_autoscroll_task_) {
cancelable_autoscroll_task_->Cancel();
cancelable_autoscroll_task_.reset();
diff --git a/cc/input/scrollbar_controller.h b/cc/input/scrollbar_controller.h
index 30bb658..4d41ff33 100644
--- a/cc/input/scrollbar_controller.h
+++ b/cc/input/scrollbar_controller.h
@@ -7,6 +7,7 @@
#include <memory>
+#include <optional>
#include "base/cancelable_callback.h"
#include "base/gtest_prod_util.h"
#include "base/memory/raw_ptr.h"
@@ -16,7 +17,6 @@
#include "cc/input/scrollbar.h"
#include "cc/layers/layer_impl.h"
#include "cc/layers/painted_scrollbar_layer_impl.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
// High level documentation:
// https://source.chromium.org/chromium/chromium/src/+/main:cc/input/README.md
@@ -322,15 +322,15 @@
gfx::PointF last_known_pointer_position_;
// Set only while interacting with the scrollbar (eg: drag, click etc).
- absl::optional<CapturedScrollbarMetadata> captured_scrollbar_metadata_;
+ std::optional<CapturedScrollbarMetadata> captured_scrollbar_metadata_;
// Holds information pertaining to autoscrolling. This member is empty if and
// only if an autoscroll is *not* in progress or scheduled
- absl::optional<AutoScrollState> autoscroll_state_;
+ std::optional<AutoScrollState> autoscroll_state_;
// Holds information pertaining to thumb drags. Useful while making decisions
// about thumb anchoring/snapping.
- absl::optional<DragState> drag_state_;
+ std::optional<DragState> drag_state_;
// Used to track if a GSU was processed for the current frame or not. Without
// this, thumb drag will appear jittery. The reason this happens is because
diff --git a/cc/input/snap_selection_strategy.cc b/cc/input/snap_selection_strategy.cc
index a2444095..b69f8e6 100644
--- a/cc/input/snap_selection_strategy.cc
+++ b/cc/input/snap_selection_strategy.cc
@@ -94,9 +94,9 @@
return snap_targets_prioritization_ == SnapTargetsPrioritization::kRequire;
}
-const absl::optional<SnapSearchResult>& EndPositionStrategy::PickBestResult(
- const absl::optional<SnapSearchResult>& closest,
- const absl::optional<SnapSearchResult>& covering) const {
+const std::optional<SnapSearchResult>& EndPositionStrategy::PickBestResult(
+ const std::optional<SnapSearchResult>& closest,
+ const std::optional<SnapSearchResult>& covering) const {
return covering.has_value() ? covering : closest;
}
@@ -144,9 +144,9 @@
area.must_snap);
}
-const absl::optional<SnapSearchResult>& DirectionStrategy::PickBestResult(
- const absl::optional<SnapSearchResult>& closest,
- const absl::optional<SnapSearchResult>& covering) const {
+const std::optional<SnapSearchResult>& DirectionStrategy::PickBestResult(
+ const std::optional<SnapSearchResult>& closest,
+ const std::optional<SnapSearchResult>& covering) const {
// We choose the |closest| result only if the default landing position (using
// the default step) is not a valid snap position (not making a snap area
// covering the snapport), or the |closest| is closer than the default landing
@@ -215,9 +215,9 @@
return true;
}
-const absl::optional<SnapSearchResult>& EndAndDirectionStrategy::PickBestResult(
- const absl::optional<SnapSearchResult>& closest,
- const absl::optional<SnapSearchResult>& covering) const {
+const std::optional<SnapSearchResult>& EndAndDirectionStrategy::PickBestResult(
+ const std::optional<SnapSearchResult>& closest,
+ const std::optional<SnapSearchResult>& covering) const {
return covering.has_value() ? covering : closest;
}
diff --git a/cc/input/snap_selection_strategy.h b/cc/input/snap_selection_strategy.h
index 08fa7a4..e9c360f4 100644
--- a/cc/input/snap_selection_strategy.h
+++ b/cc/input/snap_selection_strategy.h
@@ -78,9 +78,9 @@
// -closest: snap search result representing closest match.
// -covering: snap search result representing the original target if it makes
// a snaparea covering the snapport.
- virtual const absl::optional<SnapSearchResult>& PickBestResult(
- const absl::optional<SnapSearchResult>& closest,
- const absl::optional<SnapSearchResult>& covering) const = 0;
+ virtual const std::optional<SnapSearchResult>& PickBestResult(
+ const std::optional<SnapSearchResult>& closest,
+ const std::optional<SnapSearchResult>& covering) const = 0;
// Returns true when the current scroll offset is provided in fractional
// pixels.
@@ -125,9 +125,9 @@
bool HasIntendedDirection() const override;
bool ShouldPrioritizeSnapTargets() const override;
- const absl::optional<SnapSearchResult>& PickBestResult(
- const absl::optional<SnapSearchResult>& closest,
- const absl::optional<SnapSearchResult>& covering) const override;
+ const std::optional<SnapSearchResult>& PickBestResult(
+ const std::optional<SnapSearchResult>& closest,
+ const std::optional<SnapSearchResult>& covering) const override;
private:
// Whether the x axis and y axis have been scrolled in this scroll gesture.
@@ -168,9 +168,9 @@
bool IsValidSnapArea(SearchAxis axis,
const SnapAreaData& area) const override;
- const absl::optional<SnapSearchResult>& PickBestResult(
- const absl::optional<SnapSearchResult>& closest,
- const absl::optional<SnapSearchResult>& covering) const override;
+ const std::optional<SnapSearchResult>& PickBestResult(
+ const std::optional<SnapSearchResult>& closest,
+ const std::optional<SnapSearchResult>& covering) const override;
bool UsingFractionalOffsets() const override;
@@ -211,9 +211,9 @@
bool ShouldRespectSnapStop() const override;
- const absl::optional<SnapSearchResult>& PickBestResult(
- const absl::optional<SnapSearchResult>& closest,
- const absl::optional<SnapSearchResult>& covering) const override;
+ const std::optional<SnapSearchResult>& PickBestResult(
+ const std::optional<SnapSearchResult>& closest,
+ const std::optional<SnapSearchResult>& covering) const override;
bool UsingFractionalOffsets() const override;
diff --git a/cc/layers/append_quads_data.h b/cc/layers/append_quads_data.h
index 939a92d..397d806fc 100644
--- a/cc/layers/append_quads_data.h
+++ b/cc/layers/append_quads_data.h
@@ -8,9 +8,9 @@
#include <stdint.h>
#include <vector>
+#include <optional>
#include "cc/cc_export.h"
#include "components/viz/common/surfaces/surface_id.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace cc {
@@ -34,7 +34,7 @@
// The non-default number of BeginFrames to wait before forcibly activating
// this CompositorFrame.
- absl::optional<uint32_t> deadline_in_frames;
+ std::optional<uint32_t> deadline_in_frames;
// Indicates whether or not one of the layers wants to use the default
// activation deadline.
diff --git a/cc/layers/deadline_policy.cc b/cc/layers/deadline_policy.cc
index 83f3439..be333d70 100644
--- a/cc/layers/deadline_policy.cc
+++ b/cc/layers/deadline_policy.cc
@@ -52,7 +52,7 @@
}
DeadlinePolicy::DeadlinePolicy(Type policy_type,
- absl::optional<uint32_t> deadline_in_frames)
+ std::optional<uint32_t> deadline_in_frames)
: policy_type_(policy_type), deadline_in_frames_(deadline_in_frames) {}
DeadlinePolicy::DeadlinePolicy(const DeadlinePolicy& other) = default;
diff --git a/cc/layers/deadline_policy.h b/cc/layers/deadline_policy.h
index a18f048..4e11c32 100644
--- a/cc/layers/deadline_policy.h
+++ b/cc/layers/deadline_policy.h
@@ -8,9 +8,9 @@
#include <cstdint>
#include <string>
+#include <optional>
#include "base/check.h"
#include "cc/cc_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace cc {
@@ -41,7 +41,7 @@
return policy_type_ == DeadlinePolicy::kUseExistingDeadline;
}
- absl::optional<uint32_t> deadline_in_frames() const {
+ std::optional<uint32_t> deadline_in_frames() const {
DCHECK(policy_type_ == Type::kUseDefaultDeadline ||
policy_type_ == Type::kUseSpecifiedDeadline ||
policy_type_ == Type::kUseInfiniteDeadline);
@@ -64,10 +64,10 @@
private:
explicit DeadlinePolicy(
Type policy_type,
- absl::optional<uint32_t> deadline_in_frames = absl::nullopt);
+ std::optional<uint32_t> deadline_in_frames = std::nullopt);
Type policy_type_;
- absl::optional<uint32_t> deadline_in_frames_;
+ std::optional<uint32_t> deadline_in_frames_;
};
} // namespace cc
diff --git a/cc/layers/heads_up_display_layer_impl.cc b/cc/layers/heads_up_display_layer_impl.cc
index 15ff9a5..14baffe 100644
--- a/cc/layers/heads_up_display_layer_impl.cc
+++ b/cc/layers/heads_up_display_layer_impl.cc
@@ -12,6 +12,7 @@
#include <utility>
#include <vector>
+#include <optional>
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/shared_memory_mapping.h"
@@ -53,7 +54,6 @@
#include "gpu/command_buffer/common/shared_image_usage.h"
#include "gpu/config/gpu_feature_info.h"
#include "skia/ext/legacy_display_globals.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkFont.h"
#include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/core/SkPath.h"
@@ -252,7 +252,7 @@
UpdateHudContents();
viz::RasterContextProvider* raster_context_provider = nullptr;
- absl::optional<viz::RasterContextProvider::ScopedRasterContextLock> lock;
+ std::optional<viz::RasterContextProvider::ScopedRasterContextLock> lock;
if (draw_mode == DRAW_MODE_HARDWARE) {
// TODO(penghuang): It would be better to use context_provider() instead of
// worker_context_provider() if/when it's switched to RasterContextProvider.
diff --git a/cc/layers/heads_up_display_layer_impl.h b/cc/layers/heads_up_display_layer_impl.h
index 768c355..a53b593 100644
--- a/cc/layers/heads_up_display_layer_impl.h
+++ b/cc/layers/heads_up_display_layer_impl.h
@@ -191,7 +191,7 @@
uint32_t throughput_value_ = 0.0f;
// Obtained from the current BeginFrameArgs.
- absl::optional<base::TimeDelta> frame_interval_;
+ std::optional<base::TimeDelta> frame_interval_;
MemoryHistory::Entry memory_entry_;
int paint_rects_fade_step_ = 0;
int layout_shift_rects_fade_step_ = 0;
diff --git a/cc/layers/layer.h b/cc/layers/layer.h
index 3b8cae6..efa74a4 100644
--- a/cc/layers/layer.h
+++ b/cc/layers/layer.h
@@ -371,9 +371,9 @@
// For layer tree mode only.
void SetBackdropFilterBounds(const gfx::RRectF& backdrop_filter_bounds);
void ClearBackdropFilterBounds();
- absl::optional<gfx::RRectF> backdrop_filter_bounds() const {
+ std::optional<gfx::RRectF> backdrop_filter_bounds() const {
return layer_tree_inputs() ? layer_tree_inputs()->backdrop_filter_bounds
- : absl::nullopt;
+ : std::nullopt;
}
// For layer tree mode only.
@@ -1070,7 +1070,7 @@
FilterOperations filters;
FilterOperations backdrop_filters;
- absl::optional<gfx::RRectF> backdrop_filter_bounds;
+ std::optional<gfx::RRectF> backdrop_filter_bounds;
float backdrop_filter_quality = 1.0f;
int mirror_count = 0;
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index afc7759..0729eae 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -146,7 +146,7 @@
void LayerImpl::PopulateSharedQuadState(viz::SharedQuadState* state,
bool contents_opaque) const {
EffectNode* effect_node = GetEffectTree().Node(effect_tree_index_);
- absl::optional<gfx::Rect> clip_rect;
+ std::optional<gfx::Rect> clip_rect;
if (draw_properties_.is_clipped) {
clip_rect = draw_properties_.clip_rect;
}
@@ -184,7 +184,7 @@
GetScaledDrawTransform(layer_to_content_scale);
EffectNode* effect_node = GetEffectTree().Node(effect_tree_index_);
- absl::optional<gfx::Rect> clip_rect;
+ std::optional<gfx::Rect> clip_rect;
if (draw_properties().is_clipped) {
clip_rect = draw_properties().clip_rect;
}
@@ -840,7 +840,7 @@
gfx::Vector2dF LayerImpl::GetIdealContentsScale() const {
const auto& transform = ScreenSpaceTransform();
- absl::optional<gfx::Vector2dF> transform_scales =
+ std::optional<gfx::Vector2dF> transform_scales =
gfx::TryComputeTransform2dScaleComponents(transform);
if (transform_scales) {
// TODO(crbug.com/1196414): Remove this scale cap.
diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc
index 6254839..933a5c2 100644
--- a/cc/layers/picture_layer.cc
+++ b/cc/layers/picture_layer.cc
@@ -173,7 +173,7 @@
picture_layer_inputs_.directly_composited_image_default_raster_scale =
gfx::Vector2dF();
picture_layer_inputs_.nearest_neighbor = false;
- absl::optional<DisplayItemList::DirectlyCompositedImageResult> result =
+ std::optional<DisplayItemList::DirectlyCompositedImageResult> result =
picture_layer_inputs_.display_list->GetDirectlyCompositedImageResult();
if (result) {
// Directly composited images are not guaranteed to fully cover every
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index 5e7ae4b..dd5409b 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -2126,9 +2126,9 @@
// Attempt to re-use an existing PaintRecord if possible.
new_records[input] = std::make_pair(
paint_image_id, std::move(paint_worklet_records_[input].second));
- // The move constructor of absl::optional does not clear the source to
+ // The move constructor of std::optional does not clear the source to
// nullopt.
- paint_worklet_records_[input].second = absl::nullopt;
+ paint_worklet_records_[input].second = std::nullopt;
}
paint_worklet_records_.swap(new_records);
@@ -2158,7 +2158,7 @@
// the animation system, then invalidate its associated PaintRecord so that
// we can repaint the PaintWorklet during impl side invalidation.
if (base::Contains(prop_ids, key))
- entry.second.second = absl::nullopt;
+ entry.second.second = std::nullopt;
}
}
diff --git a/cc/layers/render_surface_impl.cc b/cc/layers/render_surface_impl.cc
index ff2bff7f..f667c9d 100644
--- a/cc/layers/render_surface_impl.cc
+++ b/cc/layers/render_surface_impl.cc
@@ -146,7 +146,7 @@
return OwningEffectNode()->backdrop_filters;
}
-absl::optional<gfx::RRectF> RenderSurfaceImpl::BackdropFilterBounds() const {
+std::optional<gfx::RRectF> RenderSurfaceImpl::BackdropFilterBounds() const {
return OwningEffectNode()->backdrop_filter_bounds;
}
@@ -454,7 +454,7 @@
bool contents_opaque = false;
viz::SharedQuadState* shared_quad_state =
render_pass->CreateAndAppendSharedQuadState();
- absl::optional<gfx::Rect> clip_rect;
+ std::optional<gfx::Rect> clip_rect;
if (draw_properties_.is_clipped) {
clip_rect = draw_properties_.clip_rect;
}
diff --git a/cc/layers/render_surface_impl.h b/cc/layers/render_surface_impl.h
index f8d9c3ca..2dfe1f35 100644
--- a/cc/layers/render_surface_impl.h
+++ b/cc/layers/render_surface_impl.h
@@ -12,6 +12,7 @@
#include <utility>
#include <vector>
+#include <optional>
#include "base/memory/raw_ptr.h"
#include "cc/cc_export.h"
#include "cc/layers/draw_mode.h"
@@ -22,7 +23,6 @@
#include "components/viz/common/quads/compositor_render_pass.h"
#include "components/viz/common/quads/shared_quad_state.h"
#include "components/viz/common/surfaces/subtree_capture_id.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/mask_filter_info.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rect_f.h"
@@ -213,7 +213,7 @@
const FilterOperations& Filters() const;
const FilterOperations& BackdropFilters() const;
- absl::optional<gfx::RRectF> BackdropFilterBounds() const;
+ std::optional<gfx::RRectF> BackdropFilterBounds() const;
LayerImpl* BackdropMaskLayer() const;
gfx::Transform SurfaceScale() const;
diff --git a/cc/layers/surface_layer.cc b/cc/layers/surface_layer.cc
index a1314dd..29f76dd 100644
--- a/cc/layers/surface_layer.cc
+++ b/cc/layers/surface_layer.cc
@@ -97,8 +97,8 @@
layer_tree_host()->RemoveSurfaceRange(surface_range);
surface_range = viz::SurfaceRange(
- surface_id.is_valid() ? absl::optional<viz::SurfaceId>(surface_id)
- : absl::nullopt,
+ surface_id.is_valid() ? std::optional<viz::SurfaceId>(surface_id)
+ : std::nullopt,
surface_range.end());
if (layer_tree_host() && surface_range.IsValid())
diff --git a/cc/layers/surface_layer.h b/cc/layers/surface_layer.h
index 29c1840..e3b0283 100644
--- a/cc/layers/surface_layer.h
+++ b/cc/layers/surface_layer.h
@@ -73,11 +73,11 @@
return surface_range_.Read(*this).end();
}
- const absl::optional<viz::SurfaceId>& oldest_acceptable_fallback() const {
+ const std::optional<viz::SurfaceId>& oldest_acceptable_fallback() const {
return surface_range_.Read(*this).start();
}
- absl::optional<uint32_t> deadline_in_frames() const {
+ std::optional<uint32_t> deadline_in_frames() const {
return deadline_in_frames_.Read(*this);
}
@@ -94,7 +94,7 @@
ProtectedSequenceReadable<bool> may_contain_video_;
ProtectedSequenceReadable<viz::SurfaceRange> surface_range_;
- ProtectedSequenceWritable<absl::optional<uint32_t>> deadline_in_frames_;
+ ProtectedSequenceWritable<std::optional<uint32_t>> deadline_in_frames_;
ProtectedSequenceReadable<bool> stretch_content_to_fill_bounds_;
diff --git a/cc/layers/surface_layer_impl.cc b/cc/layers/surface_layer_impl.cc
index 48efa6c..070d8fe 100644
--- a/cc/layers/surface_layer_impl.cc
+++ b/cc/layers/surface_layer_impl.cc
@@ -66,7 +66,7 @@
}
void SurfaceLayerImpl::SetRange(const viz::SurfaceRange& surface_range,
- absl::optional<uint32_t> deadline_in_frames) {
+ std::optional<uint32_t> deadline_in_frames) {
if (surface_range_ == surface_range &&
deadline_in_frames_ == deadline_in_frames) {
return;
diff --git a/cc/layers/surface_layer_impl.h b/cc/layers/surface_layer_impl.h
index 777b32a..cd1695cf 100644
--- a/cc/layers/surface_layer_impl.h
+++ b/cc/layers/surface_layer_impl.h
@@ -39,10 +39,10 @@
SurfaceLayerImpl& operator=(const SurfaceLayerImpl&) = delete;
void SetRange(const viz::SurfaceRange& surface_range,
- absl::optional<uint32_t> deadline_in_frames);
+ std::optional<uint32_t> deadline_in_frames);
const viz::SurfaceRange& range() const { return surface_range_; }
- absl::optional<uint32_t> deadline_in_frames() const {
+ std::optional<uint32_t> deadline_in_frames() const {
return deadline_in_frames_;
}
@@ -84,7 +84,7 @@
UpdateSubmissionStateCB update_submission_state_callback_;
viz::SurfaceRange surface_range_;
- absl::optional<uint32_t> deadline_in_frames_;
+ std::optional<uint32_t> deadline_in_frames_;
bool stretch_content_to_fill_bounds_ = false;
bool surface_hit_testable_ = false;
diff --git a/cc/layers/surface_layer_impl_unittest.cc b/cc/layers/surface_layer_impl_unittest.cc
index a00a460..60e68f7 100644
--- a/cc/layers/surface_layer_impl_unittest.cc
+++ b/cc/layers/surface_layer_impl_unittest.cc
@@ -33,8 +33,8 @@
surface_layer_impl->SetBounds(layer_size);
surface_layer_impl->SetDrawsContent(true);
viz::SurfaceId surface_id(kArbitraryFrameSinkId, kArbitraryLocalSurfaceId);
- surface_layer_impl->SetRange(viz::SurfaceRange(absl::nullopt, surface_id),
- absl::nullopt);
+ surface_layer_impl->SetRange(viz::SurfaceRange(std::nullopt, surface_id),
+ std::nullopt);
CopyProperties(impl.root_layer(), surface_layer_impl);
impl.CalcDrawProps(viewport_size);
@@ -120,7 +120,7 @@
// viz::SurfaceInfo.
{
AppendQuadsData data;
- surface_layer_impl->SetRange(viz::SurfaceRange(absl::nullopt, surface_id1),
+ surface_layer_impl->SetRange(viz::SurfaceRange(std::nullopt, surface_id1),
0u);
surface_layer_impl->AppendQuads(render_pass.get(), &data);
// The primary viz::SurfaceInfo should be added to activation_dependencies.
@@ -164,7 +164,7 @@
EXPECT_EQ(surface_id1, surface_draw_quad2->surface_range.end());
EXPECT_EQ(SkColors::kBlue, surface_draw_quad2->default_background_color);
- EXPECT_EQ(absl::nullopt, surface_draw_quad2->surface_range.start());
+ EXPECT_EQ(std::nullopt, surface_draw_quad2->surface_range.start());
EXPECT_EQ(surface_id1, surface_draw_quad3->surface_range.end());
EXPECT_EQ(SkColors::kBlue, surface_draw_quad3->default_background_color);
@@ -202,7 +202,7 @@
surface_layer_impl2->SetBounds(layer_size);
surface_layer_impl2->SetDrawsContent(true);
surface_layer_impl2->SetRange(viz::SurfaceRange(surface_id1, surface_id2),
- absl::nullopt);
+ std::nullopt);
auto render_pass = viz::CompositorRenderPass::Create();
AppendQuadsData data;
diff --git a/cc/layers/texture_layer.h b/cc/layers/texture_layer.h
index 1d2d410..3db36325e 100644
--- a/cc/layers/texture_layer.h
+++ b/cc/layers/texture_layer.h
@@ -9,6 +9,7 @@
#include <string>
#include <vector>
+#include <optional>
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
@@ -21,7 +22,6 @@
#include "cc/resources/shared_bitmap_id_registrar.h"
#include "components/viz/common/resources/release_callback.h"
#include "components/viz/common/resources/transferable_resource.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/hdr_metadata.h"
namespace gpu {
diff --git a/cc/layers/texture_layer_impl.h b/cc/layers/texture_layer_impl.h
index 0e661349..9e65dd1c 100644
--- a/cc/layers/texture_layer_impl.h
+++ b/cc/layers/texture_layer_impl.h
@@ -9,6 +9,7 @@
#include <string>
#include <vector>
+#include <optional>
#include "base/containers/flat_map.h"
#include "base/functional/callback.h"
#include "base/memory/ptr_util.h"
@@ -17,7 +18,6 @@
#include "cc/resources/cross_thread_shared_bitmap.h"
#include "components/viz/common/resources/release_callback.h"
#include "components/viz/common/resources/transferable_resource.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/hdr_metadata.h"
namespace cc {
diff --git a/cc/layers/video_layer_impl.cc b/cc/layers/video_layer_impl.cc
index 9ae6d4c..6f52189 100644
--- a/cc/layers/video_layer_impl.cc
+++ b/cc/layers/video_layer_impl.cc
@@ -168,7 +168,7 @@
if (visible_quad_rect.IsEmpty())
return;
- absl::optional<gfx::Rect> clip_rect_opt;
+ std::optional<gfx::Rect> clip_rect_opt;
if (is_clipped()) {
clip_rect_opt = clip_rect();
}
diff --git a/cc/metrics/compositor_frame_reporter.cc b/cc/metrics/compositor_frame_reporter.cc
index 129461b..da8d652 100644
--- a/cc/metrics/compositor_frame_reporter.cc
+++ b/cc/metrics/compositor_frame_reporter.cc
@@ -133,8 +133,8 @@
FrameReportType report_type,
FrameSequenceTrackerType frame_sequence_tracker_type,
StageType stage_type,
- absl::optional<VizBreakdown> viz_breakdown,
- absl::optional<BlinkBreakdown> blink_breakdown) {
+ std::optional<VizBreakdown> viz_breakdown,
+ std::optional<BlinkBreakdown> blink_breakdown) {
DCHECK_LE(frame_sequence_tracker_type, FrameSequenceTrackerType::kMaxType);
const char* tracker_type_name =
FrameSequenceTracker::GetFrameSequenceTrackerTypeName(
@@ -155,7 +155,7 @@
const std::string& name,
int index,
base::TimeDelta latency,
- const absl::optional<EventMetrics::HistogramBucketing>& bucketing) {
+ const std::optional<EventMetrics::HistogramBucketing>& bucketing) {
STATIC_HISTOGRAM_POINTER_GROUP(
name, index, kMaxEventLatencyHistogramIndex,
AddTimeMicrosecondsGranularity(latency),
@@ -541,8 +541,8 @@
// static
const char* CompositorFrameReporter::GetStageName(
StageType stage_type,
- absl::optional<VizBreakdown> viz_breakdown,
- absl::optional<BlinkBreakdown> blink_breakdown,
+ std::optional<VizBreakdown> viz_breakdown,
+ std::optional<BlinkBreakdown> blink_breakdown,
bool impl_only) {
DCHECK(!viz_breakdown ||
stage_type ==
@@ -1069,8 +1069,8 @@
base::TimeDelta stage_delta = stage.end_time - stage.start_time;
ReportCompositorLatencyHistogram(
frame_sequence_tracker_type, stage.stage_type,
- /*viz_breakdown=*/absl::nullopt,
- /*blink_breakdown=*/absl::nullopt, stage_delta);
+ /*viz_breakdown=*/std::nullopt,
+ /*blink_breakdown=*/std::nullopt, stage_delta);
switch (stage.stage_type) {
case StageType::kSendBeginMainFrameToCommit:
ReportCompositorLatencyBlinkBreakdowns(frame_sequence_tracker_type);
@@ -1090,7 +1090,7 @@
it.Advance()) {
ReportCompositorLatencyHistogram(
frame_sequence_tracker_type, StageType::kSendBeginMainFrameToCommit,
- /*viz_breakdown=*/absl::nullopt, it.GetBreakdown(), it.GetLatency());
+ /*viz_breakdown=*/std::nullopt, it.GetBreakdown(), it.GetLatency());
}
}
@@ -1102,15 +1102,15 @@
ReportCompositorLatencyHistogram(
frame_sequence_tracker_type,
StageType::kSubmitCompositorFrameToPresentationCompositorFrame,
- it.GetBreakdown(), /*blink_breakdown=*/absl::nullopt, it.GetDuration());
+ it.GetBreakdown(), /*blink_breakdown=*/std::nullopt, it.GetDuration());
}
}
void CompositorFrameReporter::ReportCompositorLatencyHistogram(
FrameSequenceTrackerType frame_sequence_tracker_type,
StageType stage_type,
- absl::optional<VizBreakdown> viz_breakdown,
- absl::optional<BlinkBreakdown> blink_breakdown,
+ std::optional<VizBreakdown> viz_breakdown,
+ std::optional<BlinkBreakdown> blink_breakdown,
base::TimeDelta time_delta) const {
DCHECK(!viz_breakdown ||
stage_type ==
@@ -1240,7 +1240,7 @@
{histogram_base_name, kGenerationToBrowserMainName}, ".");
const base::TimeDelta browser_main_delay =
browser_main_timestamp - generated_timestamp;
- const absl::optional<EventMetrics::HistogramBucketing>& bucketing =
+ const std::optional<EventMetrics::HistogramBucketing>& bucketing =
event_metrics->GetHistogramBucketing();
if (bucketing) {
STATIC_HISTOGRAM_POINTER_GROUP(
@@ -2077,7 +2077,7 @@
}
for (auto index : highest_blink_contribution_change_index) {
high_latency_substages_.push_back(
- GetStageName(StageType::kSendBeginMainFrameToCommit, absl::nullopt,
+ GetStageName(StageType::kSendBeginMainFrameToCommit, std::nullopt,
static_cast<BlinkBreakdown>(index)));
}
for (auto index : highest_viz_contribution_change_index) {
diff --git a/cc/metrics/compositor_frame_reporter.h b/cc/metrics/compositor_frame_reporter.h
index 8908632b..ea3a12c 100644
--- a/cc/metrics/compositor_frame_reporter.h
+++ b/cc/metrics/compositor_frame_reporter.h
@@ -13,6 +13,7 @@
#include <utility>
#include <vector>
+#include <optional>
#include "base/memory/raw_ptr.h"
#include "base/rand_util.h"
#include "base/time/default_tick_clock.h"
@@ -28,7 +29,6 @@
#include "cc/scheduler/scheduler.h"
#include "components/viz/common/frame_sinks/begin_frame_args.h"
#include "components/viz/common/frame_timing_details.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace viz {
struct FrameTimingDetails;
@@ -254,7 +254,7 @@
base::TimeTicks swap_start() const { return swap_start_; }
private:
- absl::optional<std::pair<base::TimeTicks, base::TimeTicks>>
+ std::optional<std::pair<base::TimeTicks, base::TimeTicks>>
list_[static_cast<int>(VizBreakdown::kBreakdownCount)];
bool buffer_ready_available_ = false;
@@ -293,8 +293,8 @@
// name of the appropriate breakdown.
static const char* GetStageName(
StageType stage_type,
- absl::optional<VizBreakdown> viz_breakdown = absl::nullopt,
- absl::optional<BlinkBreakdown> blink_breakdown = absl::nullopt,
+ std::optional<VizBreakdown> viz_breakdown = std::nullopt,
+ std::optional<BlinkBreakdown> blink_breakdown = std::nullopt,
bool impl_only = false);
// Name for the viz breakdowns which are shown in traces as substages under
@@ -456,8 +456,8 @@
void ReportCompositorLatencyHistogram(
FrameSequenceTrackerType intraction_type,
StageType stage_type,
- absl::optional<VizBreakdown> viz_breakdown,
- absl::optional<BlinkBreakdown> blink_breakdown,
+ std::optional<VizBreakdown> viz_breakdown,
+ std::optional<BlinkBreakdown> blink_breakdown,
base::TimeDelta time_delta) const;
void ReportEventLatencyMetrics() const;
@@ -534,9 +534,9 @@
// The timestamp of when the frame was marked as not having produced a frame
// (through a call to DidNotProduceFrame()).
- absl::optional<base::TimeTicks> did_not_produce_frame_time_;
- absl::optional<FrameSkippedReason> frame_skip_reason_;
- absl::optional<base::TimeTicks> main_frame_abort_time_;
+ std::optional<base::TimeTicks> did_not_produce_frame_time_;
+ std::optional<FrameSkippedReason> frame_skip_reason_;
+ std::optional<base::TimeTicks> main_frame_abort_time_;
raw_ptr<const base::TickClock> tick_clock_ =
base::DefaultTickClock::GetInstance();
diff --git a/cc/metrics/compositor_frame_reporter_unittest.cc b/cc/metrics/compositor_frame_reporter_unittest.cc
index e7b87b0..8a5e70b 100644
--- a/cc/metrics/compositor_frame_reporter_unittest.cc
+++ b/cc/metrics/compositor_frame_reporter_unittest.cc
@@ -117,7 +117,7 @@
AdvanceNowByUs(3);
return SetupEventMetrics(EventMetrics::CreateForTesting(
type, event_time, arrived_in_browser_main_timestamp, &test_tick_clock_,
- absl::nullopt));
+ std::nullopt));
}
// Creates EventMetrics with elements in stage_durations representing each
@@ -146,8 +146,7 @@
ScrollUpdateEventMetrics::CreateForTesting(
ui::ET_GESTURE_SCROLL_UPDATE, ui::ScrollInputType::kWheel,
is_inertial, scroll_update_type, /*delta=*/10.0f, event_time,
- arrived_in_browser_main_timestamp, &test_tick_clock_,
- absl::nullopt),
+ arrived_in_browser_main_timestamp, &test_tick_clock_, std::nullopt),
stage_durations);
}
@@ -172,7 +171,7 @@
return SetupEventMetrics(ScrollUpdateEventMetrics::CreateForTesting(
ui::ET_GESTURE_SCROLL_UPDATE, input_type, is_inertial,
scroll_update_type, /*delta=*/10.0f, event_time,
- arrived_in_browser_main_timestamp, &test_tick_clock_, absl::nullopt));
+ arrived_in_browser_main_timestamp, &test_tick_clock_, std::nullopt));
}
std::unique_ptr<EventMetrics> CreatePinchEventMetrics(
diff --git a/cc/metrics/compositor_frame_reporting_controller_unittest.cc b/cc/metrics/compositor_frame_reporting_controller_unittest.cc
index 167defaa..e3de853e 100644
--- a/cc/metrics/compositor_frame_reporting_controller_unittest.cc
+++ b/cc/metrics/compositor_frame_reporting_controller_unittest.cc
@@ -256,7 +256,7 @@
std::unique_ptr<EventMetrics> CreateEventMetrics(
ui::EventType type,
- absl::optional<EventMetrics::TraceId> trace_id) {
+ std::optional<EventMetrics::TraceId> trace_id) {
const base::TimeTicks event_time = AdvanceNowByMs(10);
const base::TimeTicks arrived_in_browser_main_timestamp = AdvanceNowByMs(3);
AdvanceNowByMs(10);
@@ -280,7 +280,7 @@
ui::ScrollInputType input_type,
bool is_inertial,
ScrollUpdateEventMetrics::ScrollUpdateType scroll_update_type,
- absl::optional<EventMetrics::TraceId> trace_id) {
+ std::optional<EventMetrics::TraceId> trace_id) {
const base::TimeTicks event_time = AdvanceNowByMs(10);
const base::TimeTicks arrived_in_browser_main_timestamp = AdvanceNowByMs(3);
AdvanceNowByMs(10);
@@ -1220,9 +1220,9 @@
base::HistogramTester histogram_tester;
std::unique_ptr<EventMetrics> event_metrics_ptrs[] = {
- CreateEventMetrics(ui::ET_TOUCH_PRESSED, absl::nullopt),
- CreateEventMetrics(ui::ET_TOUCH_MOVED, absl::nullopt),
- CreateEventMetrics(ui::ET_TOUCH_MOVED, absl::nullopt),
+ CreateEventMetrics(ui::ET_TOUCH_PRESSED, std::nullopt),
+ CreateEventMetrics(ui::ET_TOUCH_MOVED, std::nullopt),
+ CreateEventMetrics(ui::ET_TOUCH_MOVED, std::nullopt),
};
EXPECT_THAT(event_metrics_ptrs, Each(NotNull()));
EventMetrics::List events_metrics(
@@ -1295,27 +1295,23 @@
CreateScrollBeginEventMetrics(ui::ScrollInputType::kWheel),
CreateScrollUpdateEventMetrics(
ui::ScrollInputType::kWheel, kScrollIsNotInertial,
- ScrollUpdateEventMetrics::ScrollUpdateType::kStarted, absl::nullopt),
+ ScrollUpdateEventMetrics::ScrollUpdateType::kStarted, std::nullopt),
CreateScrollUpdateEventMetrics(
ui::ScrollInputType::kWheel, kScrollIsNotInertial,
- ScrollUpdateEventMetrics::ScrollUpdateType::kContinued,
- absl::nullopt),
+ ScrollUpdateEventMetrics::ScrollUpdateType::kContinued, std::nullopt),
CreateScrollUpdateEventMetrics(
ui::ScrollInputType::kWheel, kScrollIsInertial,
- ScrollUpdateEventMetrics::ScrollUpdateType::kContinued,
- absl::nullopt),
+ ScrollUpdateEventMetrics::ScrollUpdateType::kContinued, std::nullopt),
CreateScrollBeginEventMetrics(ui::ScrollInputType::kTouchscreen),
CreateScrollUpdateEventMetrics(
ui::ScrollInputType::kTouchscreen, kScrollIsNotInertial,
- ScrollUpdateEventMetrics::ScrollUpdateType::kStarted, absl::nullopt),
+ ScrollUpdateEventMetrics::ScrollUpdateType::kStarted, std::nullopt),
CreateScrollUpdateEventMetrics(
ui::ScrollInputType::kTouchscreen, kScrollIsNotInertial,
- ScrollUpdateEventMetrics::ScrollUpdateType::kContinued,
- absl::nullopt),
+ ScrollUpdateEventMetrics::ScrollUpdateType::kContinued, std::nullopt),
CreateScrollUpdateEventMetrics(
ui::ScrollInputType::kTouchscreen, kScrollIsInertial,
- ScrollUpdateEventMetrics::ScrollUpdateType::kContinued,
- absl::nullopt),
+ ScrollUpdateEventMetrics::ScrollUpdateType::kContinued, std::nullopt),
};
EXPECT_THAT(event_metrics_ptrs, Each(NotNull()));
EventMetrics::List events_metrics(
@@ -1443,7 +1439,7 @@
// Set up two EventMetrics objects.
std::unique_ptr<EventMetrics> metrics_1 = CreateScrollUpdateEventMetrics(
ui::ScrollInputType::kWheel, /*is_inertial=*/false,
- ScrollUpdateEventMetrics::ScrollUpdateType::kStarted, absl::nullopt);
+ ScrollUpdateEventMetrics::ScrollUpdateType::kStarted, std::nullopt);
base::TimeTicks start_time_1 = metrics_1->GetDispatchStageTimestamp(
EventMetrics::DispatchStage::kGenerated);
@@ -1452,7 +1448,7 @@
// with differing values for this bit, but let's test both conditions here.)
std::unique_ptr<EventMetrics> metrics_2 = CreateScrollUpdateEventMetrics(
ui::ScrollInputType::kWheel, /*is_inertial=*/false,
- ScrollUpdateEventMetrics::ScrollUpdateType::kContinued, absl::nullopt);
+ ScrollUpdateEventMetrics::ScrollUpdateType::kContinued, std::nullopt);
metrics_2->set_requires_main_thread_update();
base::TimeTicks start_time_2 = metrics_2->GetDispatchStageTimestamp(
EventMetrics::DispatchStage::kGenerated);
@@ -1596,9 +1592,9 @@
base::HistogramTester histogram_tester;
std::unique_ptr<EventMetrics> event_metrics_ptrs[] = {
- CreateEventMetrics(ui::ET_TOUCH_PRESSED, absl::nullopt),
- CreateEventMetrics(ui::ET_TOUCH_MOVED, absl::nullopt),
- CreateEventMetrics(ui::ET_TOUCH_MOVED, absl::nullopt),
+ CreateEventMetrics(ui::ET_TOUCH_PRESSED, std::nullopt),
+ CreateEventMetrics(ui::ET_TOUCH_MOVED, std::nullopt),
+ CreateEventMetrics(ui::ET_TOUCH_MOVED, std::nullopt),
};
EXPECT_THAT(event_metrics_ptrs, Each(NotNull()));
EventMetrics::List events_metrics(
@@ -2204,15 +2200,15 @@
std::unique_ptr<EventMetrics> metrics_1 = CreateScrollUpdateEventMetrics(
ui::ScrollInputType::kWheel, /*is_inertial=*/false,
- ScrollUpdateEventMetrics::ScrollUpdateType::kStarted, absl::nullopt);
+ ScrollUpdateEventMetrics::ScrollUpdateType::kStarted, std::nullopt);
std::unique_ptr<EventMetrics> metrics_2 = CreateScrollUpdateEventMetrics(
ui::ScrollInputType::kWheel, /*is_inertial=*/false,
- ScrollUpdateEventMetrics::ScrollUpdateType::kContinued, absl::nullopt);
+ ScrollUpdateEventMetrics::ScrollUpdateType::kContinued, std::nullopt);
std::unique_ptr<EventMetrics> metrics_3 = CreateScrollUpdateEventMetrics(
ui::ScrollInputType::kWheel, /*is_inertial=*/false,
- ScrollUpdateEventMetrics::ScrollUpdateType::kContinued, absl::nullopt);
+ ScrollUpdateEventMetrics::ScrollUpdateType::kContinued, std::nullopt);
SimulateBeginImplFrame(); // BF1
viz::BeginFrameId bf1_id = current_id_;
@@ -2324,12 +2320,12 @@
std::unique_ptr<EventMetrics> metrics_1 = CreateScrollUpdateEventMetrics(
ui::ScrollInputType::kWheel, /*is_inertial=*/false,
- ScrollUpdateEventMetrics::ScrollUpdateType::kStarted, absl::nullopt);
+ ScrollUpdateEventMetrics::ScrollUpdateType::kStarted, std::nullopt);
metrics_1->set_requires_main_thread_update();
std::unique_ptr<EventMetrics> metrics_2 = CreateScrollUpdateEventMetrics(
ui::ScrollInputType::kWheel, /*is_inertial=*/false,
- ScrollUpdateEventMetrics::ScrollUpdateType::kContinued, absl::nullopt);
+ ScrollUpdateEventMetrics::ScrollUpdateType::kContinued, std::nullopt);
metrics_2->set_requires_main_thread_update();
SimulateBeginImplFrame(); // BF1
@@ -2431,11 +2427,11 @@
std::unique_ptr<EventMetrics> metrics_1 = CreateScrollUpdateEventMetrics(
ui::ScrollInputType::kWheel, /*is_inertial=*/false,
- ScrollUpdateEventMetrics::ScrollUpdateType::kStarted, absl::nullopt);
+ ScrollUpdateEventMetrics::ScrollUpdateType::kStarted, std::nullopt);
std::unique_ptr<EventMetrics> metrics_2 = CreateScrollUpdateEventMetrics(
ui::ScrollInputType::kWheel, /*is_inertial=*/false,
- ScrollUpdateEventMetrics::ScrollUpdateType::kContinued, absl::nullopt);
+ ScrollUpdateEventMetrics::ScrollUpdateType::kContinued, std::nullopt);
SimulateBeginImplFrame(); // BF1
viz::BeginFrameId bf1_id = current_id_;
@@ -2522,17 +2518,17 @@
std::unique_ptr<EventMetrics> metrics_1 = CreateScrollUpdateEventMetrics(
ui::ScrollInputType::kWheel, /*is_inertial=*/false,
- ScrollUpdateEventMetrics::ScrollUpdateType::kStarted, absl::nullopt);
+ ScrollUpdateEventMetrics::ScrollUpdateType::kStarted, std::nullopt);
metrics_1->set_requires_main_thread_update();
std::unique_ptr<EventMetrics> metrics_2 = CreateScrollUpdateEventMetrics(
ui::ScrollInputType::kWheel, /*is_inertial=*/false,
- ScrollUpdateEventMetrics::ScrollUpdateType::kContinued, absl::nullopt);
+ ScrollUpdateEventMetrics::ScrollUpdateType::kContinued, std::nullopt);
metrics_2->set_requires_main_thread_update();
std::unique_ptr<EventMetrics> metrics_3 = CreateScrollUpdateEventMetrics(
ui::ScrollInputType::kWheel, /*is_inertial=*/false,
- ScrollUpdateEventMetrics::ScrollUpdateType::kContinued, absl::nullopt);
+ ScrollUpdateEventMetrics::ScrollUpdateType::kContinued, std::nullopt);
metrics_3->set_requires_main_thread_update();
SimulateBeginImplFrame(); // BF1
@@ -2692,18 +2688,18 @@
std::unique_ptr<EventMetrics> metrics_1 = CreateScrollUpdateEventMetrics(
ui::ScrollInputType::kWheel, /*is_inertial=*/false,
- ScrollUpdateEventMetrics::ScrollUpdateType::kStarted, absl::nullopt);
+ ScrollUpdateEventMetrics::ScrollUpdateType::kStarted, std::nullopt);
base::TimeTicks event1_generation_ts = metrics_1->GetDispatchStageTimestamp(
EventMetrics::DispatchStage::kGenerated);
std::unique_ptr<EventMetrics> metrics_2 = CreateScrollUpdateEventMetrics(
ui::ScrollInputType::kWheel, /*is_inertial=*/false,
- ScrollUpdateEventMetrics::ScrollUpdateType::kContinued, absl::nullopt);
+ ScrollUpdateEventMetrics::ScrollUpdateType::kContinued, std::nullopt);
base::TimeTicks event2_generation_ts = metrics_2->GetDispatchStageTimestamp(
EventMetrics::DispatchStage::kGenerated);
std::unique_ptr<EventMetrics> non_scroll_event =
- CreateEventMetrics(ui::ET_TOUCH_PRESSED, absl::nullopt);
+ CreateEventMetrics(ui::ET_TOUCH_PRESSED, std::nullopt);
base::TimeDelta vsync_interval = event2_generation_ts - event1_generation_ts;
args_.interval = vsync_interval;
diff --git a/cc/metrics/dropped_frame_counter.h b/cc/metrics/dropped_frame_counter.h
index f4c886b..84beede 100644
--- a/cc/metrics/dropped_frame_counter.h
+++ b/cc/metrics/dropped_frame_counter.h
@@ -11,6 +11,7 @@
#include <utility>
#include <vector>
+#include <optional>
#include "base/containers/ring_buffer.h"
#include "base/functional/callback_forward.h"
#include "base/memory/raw_ptr.h"
@@ -19,7 +20,6 @@
#include "cc/metrics/frame_info.h"
#include "cc/metrics/frame_sorter.h"
#include "cc/metrics/ukm_smoothness_data.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace cc {
class TotalFrameCounter;
@@ -125,15 +125,15 @@
return sliding_window_max_percent_dropped_;
}
- absl::optional<double> max_percent_dropped_After_1_sec() const {
+ std::optional<double> max_percent_dropped_After_1_sec() const {
return sliding_window_max_percent_dropped_After_1_sec_;
}
- absl::optional<double> max_percent_dropped_After_2_sec() const {
+ std::optional<double> max_percent_dropped_After_2_sec() const {
return sliding_window_max_percent_dropped_After_2_sec_;
}
- absl::optional<double> max_percent_dropped_After_5_sec() const {
+ std::optional<double> max_percent_dropped_After_5_sec() const {
return sliding_window_max_percent_dropped_After_5_sec_;
}
@@ -196,9 +196,9 @@
size_t total_smoothness_dropped_ = 0;
bool fcp_received_ = false;
double sliding_window_max_percent_dropped_ = 0;
- absl::optional<double> sliding_window_max_percent_dropped_After_1_sec_;
- absl::optional<double> sliding_window_max_percent_dropped_After_2_sec_;
- absl::optional<double> sliding_window_max_percent_dropped_After_5_sec_;
+ std::optional<double> sliding_window_max_percent_dropped_After_1_sec_;
+ std::optional<double> sliding_window_max_percent_dropped_After_2_sec_;
+ std::optional<double> sliding_window_max_percent_dropped_After_5_sec_;
base::TimeTicks time_fcp_received_;
raw_ptr<UkmSmoothnessDataShared> ukm_smoothness_data_ = nullptr;
FrameSorter frame_sorter_;
@@ -209,10 +209,10 @@
double p95_window = 0;
} last_reported_metrics_;
- absl::optional<SortedFrameCallback> sorted_frame_callback_;
+ std::optional<SortedFrameCallback> sorted_frame_callback_;
bool report_for_ui_ = false;
- absl::optional<double> sliding_window_current_percent_dropped_;
+ std::optional<double> sliding_window_current_percent_dropped_;
// Sets to true on a newly dropped frame and stays true as long as the frames
// that follow are dropped. Reset when a frame is presented. It is used to
diff --git a/cc/metrics/event_metrics.cc b/cc/metrics/event_metrics.cc
index 90cb3ba..da782d6 100644
--- a/cc/metrics/event_metrics.cc
+++ b/cc/metrics/event_metrics.cc
@@ -28,12 +28,12 @@
const char* name;
ui::EventType ui_event_type;
- absl::optional<bool> scroll_is_inertial = absl::nullopt;
- absl::optional<ScrollUpdateEventMetrics::ScrollUpdateType>
- scroll_update_type = absl::nullopt;
+ std::optional<bool> scroll_is_inertial = std::nullopt;
+ std::optional<ScrollUpdateEventMetrics::ScrollUpdateType> scroll_update_type =
+ std::nullopt;
- absl::optional<EventMetrics::HistogramBucketing> histogram_bucketing =
- absl::nullopt;
+ std::optional<EventMetrics::HistogramBucketing> histogram_bucketing =
+ std::nullopt;
} kInterestingEvents[] = {
#define EVENT_TYPE(type_name, ui_type, ...) \
{ \
@@ -148,10 +148,10 @@
static_cast<int>(PinchEventMetrics::PinchType::kMaxValue) + 1,
"PinchEventMetrics::PinchType has changed.");
-absl::optional<EventMetrics::EventType> ToInterestingEventType(
+std::optional<EventMetrics::EventType> ToInterestingEventType(
ui::EventType ui_event_type,
- absl::optional<bool> scroll_is_inertial,
- absl::optional<ScrollUpdateEventMetrics::ScrollUpdateType>
+ std::optional<bool> scroll_is_inertial,
+ std::optional<ScrollUpdateEventMetrics::ScrollUpdateType>
scroll_update_type) {
for (size_t i = 0; i < std::size(kInterestingEvents); i++) {
const auto& interesting_event = kInterestingEvents[i];
@@ -164,7 +164,7 @@
return metrics_event_type;
}
}
- return absl::nullopt;
+ return std::nullopt;
}
ScrollEventMetrics::ScrollType ToScrollType(ui::ScrollInputType ui_input_type) {
@@ -215,7 +215,7 @@
std::unique_ptr<EventMetrics> EventMetrics::Create(
ui::EventType type,
base::TimeTicks timestamp,
- absl::optional<TraceId> trace_id) {
+ std::optional<TraceId> trace_id) {
return Create(type, timestamp, base::TimeTicks(), trace_id);
}
@@ -224,7 +224,7 @@
ui::EventType type,
base::TimeTicks timestamp,
base::TimeTicks arrived_in_browser_main_timestamp,
- absl::optional<TraceId> trace_id) {
+ std::optional<TraceId> trace_id) {
// TODO(crbug.com/1157090): We expect that `timestamp` is not null, but there
// seems to be some tests that are emitting events with null timestamp. We
// should investigate and try to fix those cases and add a `DCHECK` here to
@@ -249,7 +249,7 @@
base::TimeTicks timestamp,
base::TimeTicks arrived_in_browser_main_timestamp,
const base::TickClock* tick_clock,
- absl::optional<TraceId> trace_id) {
+ std::optional<TraceId> trace_id) {
DCHECK(!timestamp.is_null());
std::unique_ptr<EventMetrics> metrics =
@@ -277,7 +277,7 @@
std::unique_ptr<EventMetrics> metrics =
CreateInternal(type, base::TimeTicks(), base::TimeTicks(),
- existing->tick_clock_, absl::nullopt);
+ existing->tick_clock_, std::nullopt);
if (!metrics)
return nullptr;
@@ -294,10 +294,10 @@
base::TimeTicks timestamp,
base::TimeTicks arrived_in_browser_main_timestamp,
const base::TickClock* tick_clock,
- absl::optional<TraceId> trace_id) {
- absl::optional<EventType> interesting_type =
- ToInterestingEventType(type, /*scroll_is_inertial=*/absl::nullopt,
- /*scroll_update_type=*/absl::nullopt);
+ std::optional<TraceId> trace_id) {
+ std::optional<EventType> interesting_type =
+ ToInterestingEventType(type, /*scroll_is_inertial=*/std::nullopt,
+ /*scroll_update_type=*/std::nullopt);
if (!interesting_type)
return nullptr;
return base::WrapUnique(new EventMetrics(*interesting_type, timestamp,
@@ -308,7 +308,7 @@
EventMetrics::EventMetrics(EventType type,
base::TimeTicks timestamp,
const base::TickClock* tick_clock,
- absl::optional<TraceId> trace_id)
+ std::optional<TraceId> trace_id)
: type_(type), tick_clock_(tick_clock), trace_id_(trace_id) {
dispatch_stage_timestamps_[static_cast<int>(DispatchStage::kGenerated)] =
timestamp;
@@ -318,7 +318,7 @@
base::TimeTicks timestamp,
base::TimeTicks arrived_in_browser_main_timestamp,
const base::TickClock* tick_clock,
- absl::optional<TraceId> trace_id)
+ std::optional<TraceId> trace_id)
: EventMetrics(type, timestamp, tick_clock, trace_id) {
dispatch_stage_timestamps_[static_cast<int>(
DispatchStage::kArrivedInBrowserMain)] =
@@ -348,7 +348,7 @@
return kInterestingEvents[static_cast<int>(type)].name;
}
-const absl::optional<EventMetrics::HistogramBucketing>&
+const std::optional<EventMetrics::HistogramBucketing>&
EventMetrics::GetHistogramBucketing() const {
return kInterestingEvents[static_cast<int>(type_)].histogram_bucketing;
}
@@ -435,7 +435,7 @@
base::TimeTicks timestamp,
base::TimeTicks arrived_in_browser_main_timestamp,
base::TimeTicks blocking_touch_dispatched_to_renderer,
- absl::optional<TraceId> trace_id) {
+ std::optional<TraceId> trace_id) {
// TODO(crbug.com/1157090): We expect that `timestamp` is not null, but there
// seems to be some tests that are emitting events with null timestamp. We
// should investigate and try to fix those cases and add a `DCHECK` here to
@@ -464,7 +464,7 @@
ui::ScrollInputType input_type,
bool is_inertial,
base::TimeTicks timestamp,
- absl::optional<TraceId> trace_id) {
+ std::optional<TraceId> trace_id) {
return Create(type, input_type, is_inertial, timestamp,
/*arrived_in_browser_main_timestamp=*/base::TimeTicks(),
/*blocking_touch_dispatched_to_renderer=*/base::TimeTicks(),
@@ -483,7 +483,7 @@
std::unique_ptr<ScrollEventMetrics> metrics = CreateInternal(
type, input_type, is_inertial, timestamp,
- arrived_in_browser_main_timestamp, tick_clock, absl::nullopt);
+ arrived_in_browser_main_timestamp, tick_clock, std::nullopt);
if (!metrics)
return nullptr;
@@ -509,7 +509,7 @@
std::unique_ptr<ScrollEventMetrics> metrics =
CreateInternal(type, input_type, is_inertial, base::TimeTicks(),
- base::TimeTicks(), existing->tick_clock_, absl::nullopt);
+ base::TimeTicks(), existing->tick_clock_, std::nullopt);
if (!metrics)
return nullptr;
@@ -528,10 +528,10 @@
base::TimeTicks timestamp,
base::TimeTicks arrived_in_browser_main_timestamp,
const base::TickClock* tick_clock,
- absl::optional<TraceId> trace_id) {
- absl::optional<EventType> interesting_type =
+ std::optional<TraceId> trace_id) {
+ std::optional<EventType> interesting_type =
ToInterestingEventType(type, is_inertial,
- /*scroll_update_type=*/absl::nullopt);
+ /*scroll_update_type=*/std::nullopt);
if (!interesting_type)
return nullptr;
return base::WrapUnique(new ScrollEventMetrics(
@@ -545,7 +545,7 @@
base::TimeTicks timestamp,
base::TimeTicks arrived_in_browser_main_timestamp,
const base::TickClock* tick_clock,
- absl::optional<TraceId> trace_id)
+ std::optional<TraceId> trace_id)
: EventMetrics(type,
timestamp,
arrived_in_browser_main_timestamp,
@@ -635,7 +635,7 @@
base::TimeTicks timestamp,
base::TimeTicks arrived_in_browser_main_timestamp,
const base::TickClock* tick_clock,
- absl::optional<TraceId> trace_id) {
+ std::optional<TraceId> trace_id) {
DCHECK(!timestamp.is_null());
std::unique_ptr<ScrollUpdateEventMetrics> metrics = CreateInternal(
@@ -671,7 +671,7 @@
existing->GetDispatchStageTimestamp(DispatchStage::kGenerated);
std::unique_ptr<ScrollUpdateEventMetrics> metrics = CreateInternal(
type, input_type, is_inertial, scroll_update_type, delta, generation_ts,
- base::TimeTicks(), existing->tick_clock_, absl::nullopt);
+ base::TimeTicks(), existing->tick_clock_, std::nullopt);
if (!metrics)
return nullptr;
@@ -693,8 +693,8 @@
base::TimeTicks timestamp,
base::TimeTicks arrived_in_browser_main_timestamp,
const base::TickClock* tick_clock,
- absl::optional<TraceId> trace_id) {
- absl::optional<EventType> interesting_type =
+ std::optional<TraceId> trace_id) {
+ std::optional<EventType> interesting_type =
ToInterestingEventType(type, is_inertial, scroll_update_type);
if (!interesting_type)
return nullptr;
@@ -711,7 +711,7 @@
base::TimeTicks timestamp,
base::TimeTicks arrived_in_browser_main_timestamp,
const base::TickClock* tick_clock,
- absl::optional<TraceId> trace_id)
+ std::optional<TraceId> trace_id)
: ScrollEventMetrics(type,
scroll_type,
timestamp,
@@ -783,7 +783,7 @@
DCHECK(!timestamp.is_null());
std::unique_ptr<PinchEventMetrics> metrics =
- CreateInternal(type, input_type, timestamp, tick_clock, absl::nullopt);
+ CreateInternal(type, input_type, timestamp, tick_clock, std::nullopt);
if (!metrics)
return nullptr;
@@ -798,10 +798,10 @@
ui::ScrollInputType input_type,
base::TimeTicks timestamp,
const base::TickClock* tick_clock,
- absl::optional<TraceId> trace_id) {
- absl::optional<EventType> interesting_type =
- ToInterestingEventType(type, /*scroll_is_inertial=*/absl::nullopt,
- /*scroll_update_type=*/absl::nullopt);
+ std::optional<TraceId> trace_id) {
+ std::optional<EventType> interesting_type =
+ ToInterestingEventType(type, /*scroll_is_inertial=*/std::nullopt,
+ /*scroll_update_type=*/std::nullopt);
if (!interesting_type)
return nullptr;
return base::WrapUnique(
@@ -813,7 +813,7 @@
PinchType pinch_type,
base::TimeTicks timestamp,
const base::TickClock* tick_clock,
- absl::optional<TraceId> trace_id)
+ std::optional<TraceId> trace_id)
: EventMetrics(type, timestamp, tick_clock, trace_id),
pinch_type_(pinch_type) {}
diff --git a/cc/metrics/event_metrics.h b/cc/metrics/event_metrics.h
index 8c399d7..b247976 100644
--- a/cc/metrics/event_metrics.h
+++ b/cc/metrics/event_metrics.h
@@ -10,12 +10,12 @@
#include <string>
#include <vector>
+#include <optional>
#include "base/memory/raw_ptr.h"
#include "base/time/tick_clock.h"
#include "base/time/time.h"
#include "base/types/id_type.h"
#include "cc/cc_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/events/types/event_type.h"
#include "ui/events/types/scroll_input_type.h"
#include "ui/latency/latency_info.h"
@@ -85,7 +85,7 @@
static std::unique_ptr<EventMetrics> Create(ui::EventType type,
base::TimeTicks timestamp,
- absl::optional<TraceId> trace_id);
+ std::optional<TraceId> trace_id);
// Returns a new instance if the event is of a type we are interested in.
// Otherwise, returns `nullptr`. For scroll and pinch events, use the
@@ -94,7 +94,7 @@
ui::EventType type,
base::TimeTicks timestamp,
base::TimeTicks arrived_in_browser_main_timestamp,
- absl::optional<TraceId> trace_id);
+ std::optional<TraceId> trace_id);
// Similar to `Create()` with an extra `base::TickClock` to use in tests.
static std::unique_ptr<EventMetrics> CreateForTesting(
@@ -102,7 +102,7 @@
base::TimeTicks timestamp,
base::TimeTicks arrived_in_browser_main_timestamp,
const base::TickClock* tick_clock,
- absl::optional<TraceId> trace_id);
+ std::optional<TraceId> trace_id);
// Used to create an instance for an event generated based on an existing
// event. If the new event is of an interesting type, we expect that the
@@ -122,7 +122,7 @@
EventType type() const { return type_; }
- absl::optional<TraceId> trace_id() const { return trace_id_; }
+ std::optional<TraceId> trace_id() const { return trace_id_; }
// Returns a string representing event type.
const char* GetTypeName() const;
@@ -136,7 +136,7 @@
size_t count;
const char* version_suffix;
};
- const absl::optional<HistogramBucketing>& GetHistogramBucketing() const;
+ const std::optional<HistogramBucketing>& GetHistogramBucketing() const;
void SetHighLatencyStage(const std::string& stage);
const std::vector<std::string>& GetHighLatencyStages() const {
@@ -182,13 +182,13 @@
EventMetrics(EventType type,
base::TimeTicks timestamp,
const base::TickClock* tick_clock,
- absl::optional<TraceId> trace_id);
+ std::optional<TraceId> trace_id);
EventMetrics(EventType type,
base::TimeTicks timestamp,
base::TimeTicks arrived_in_browser_main_timestamp,
const base::TickClock* tick_clock,
- absl::optional<TraceId> trace_id);
+ std::optional<TraceId> trace_id);
// Creates a clone of `other` that might be used in creating `EventMetrics`
// objects for some injected events. Since this object itself does not
@@ -213,7 +213,7 @@
base::TimeTicks timestamp,
base::TimeTicks arrived_in_browser_main_timestamp,
const base::TickClock* tick_clock,
- absl::optional<TraceId> trace_id);
+ std::optional<TraceId> trace_id);
EventType type_;
@@ -243,7 +243,7 @@
// This is a trace id of an input event. It can be null for events which don't
// have a corresponding input, for example a generated event based on existing
// event.
- absl::optional<TraceId> trace_id_;
+ std::optional<TraceId> trace_id_;
};
class CC_EXPORT ScrollEventMetrics : public EventMetrics {
@@ -273,7 +273,7 @@
base::TimeTicks timestamp,
base::TimeTicks arrived_in_browser_main_timestamp,
base::TimeTicks blocking_touch_dispatched_to_renderer,
- absl::optional<TraceId> trace_id);
+ std::optional<TraceId> trace_id);
// Prefer to use `Create()` above. This method is used only by the Browser
// process which have own breakdowns.
@@ -284,7 +284,7 @@
ui::ScrollInputType input_type,
bool is_inertial,
base::TimeTicks timestamp,
- absl::optional<TraceId> trace_id);
+ std::optional<TraceId> trace_id);
// Similar to `Create()` with an extra `base::TickClock` to use in tests.
// Should only be used for scroll events other than scroll-update.
@@ -327,7 +327,7 @@
base::TimeTicks timestamp,
base::TimeTicks arrived_in_browser_main_timestamp,
const base::TickClock* tick_clock,
- absl::optional<TraceId> trace_id);
+ std::optional<TraceId> trace_id);
ScrollEventMetrics(const ScrollEventMetrics&);
private:
@@ -338,7 +338,7 @@
base::TimeTicks timestamp,
base::TimeTicks arrived_in_browser_main_timestamp,
const base::TickClock* tick_clock,
- absl::optional<TraceId> trace_id);
+ std::optional<TraceId> trace_id);
// Type of the input device for the event.
ScrollType scroll_type_;
@@ -396,7 +396,7 @@
base::TimeTicks timestamp,
base::TimeTicks arrived_in_browser_main_timestamp,
const base::TickClock* tick_clock,
- absl::optional<TraceId> trace_id);
+ std::optional<TraceId> trace_id);
// Used to create an instance for an event generated based on an existing
// event. If the new event is of an interesting type, we expect that the
@@ -434,10 +434,10 @@
std::unique_ptr<EventMetrics> Clone() const override;
- void set_is_janky_scrolled_frame(absl::optional<bool> is_janky) {
+ void set_is_janky_scrolled_frame(std::optional<bool> is_janky) {
is_janky_scrolled_frame_ = is_janky;
}
- absl::optional<bool> is_janky_scrolled_frame() const {
+ std::optional<bool> is_janky_scrolled_frame() const {
return is_janky_scrolled_frame_;
}
@@ -449,7 +449,7 @@
base::TimeTicks timestamp,
base::TimeTicks arrived_in_browser_main_timestamp,
const base::TickClock* tick_clock,
- absl::optional<TraceId> trace_id);
+ std::optional<TraceId> trace_id);
ScrollUpdateEventMetrics(const ScrollUpdateEventMetrics&);
private:
@@ -462,7 +462,7 @@
base::TimeTicks timestamp,
base::TimeTicks arrived_in_browser_main_timestamp,
const base::TickClock* tick_clock,
- absl::optional<TraceId> trace_id);
+ std::optional<TraceId> trace_id);
float delta_;
float predicted_delta_;
@@ -473,7 +473,7 @@
// Total events that were coalesced into this into this ScrollUpdate
int32_t coalesced_event_count_ = 1;
- absl::optional<bool> is_janky_scrolled_frame_ = absl::nullopt;
+ std::optional<bool> is_janky_scrolled_frame_ = std::nullopt;
};
class CC_EXPORT PinchEventMetrics : public EventMetrics {
@@ -519,7 +519,7 @@
PinchType pinch_type,
base::TimeTicks timestamp,
const base::TickClock* tick_clock,
- absl::optional<TraceId> trace_id);
+ std::optional<TraceId> trace_id);
PinchEventMetrics(const PinchEventMetrics&);
private:
@@ -528,7 +528,7 @@
ui::ScrollInputType input_type,
base::TimeTicks timestamp,
const base::TickClock* tick_clock,
- absl::optional<TraceId> trace_id);
+ std::optional<TraceId> trace_id);
PinchType pinch_type_;
};
diff --git a/cc/metrics/event_metrics_unittest.cc b/cc/metrics/event_metrics_unittest.cc
index 93aca73..f3ad8e3c 100644
--- a/cc/metrics/event_metrics_unittest.cc
+++ b/cc/metrics/event_metrics_unittest.cc
@@ -34,7 +34,7 @@
ScrollEventMetrics::Create(
ui::ET_GESTURE_SCROLL_BEGIN, ui::ScrollInputType::kTouchscreen,
/*is_inertial=*/false, event_time, arrived_in_browser_main_timestamp,
- blocking_touch_dispatched_to_renderer_timestamp, absl::nullopt);
+ blocking_touch_dispatched_to_renderer_timestamp, std::nullopt);
// Assert
EXPECT_EQ(event_time, scroll_event_metric->GetDispatchStageTimestamp(
@@ -84,7 +84,7 @@
ScrollEventMetrics::Create(
ui::ET_GESTURE_SCROLL_BEGIN, ui::ScrollInputType::kTouchscreen,
/*is_inertial=*/false, event_time, arrived_in_browser_main_timestamp,
- blocking_touch_dispatched_to_renderer_timestamp, absl::nullopt);
+ blocking_touch_dispatched_to_renderer_timestamp, std::nullopt);
// Assert
EXPECT_EQ(event_time, scroll_event_metric->GetDispatchStageTimestamp(
@@ -129,7 +129,7 @@
ScrollEventMetrics::Create(
ui::ET_GESTURE_SCROLL_BEGIN, ui::ScrollInputType::kTouchscreen,
/*is_inertial=*/false, event_time, arrived_in_browser_main_timestamp,
- blocking_touch_dispatched_to_renderer_timestamp, absl::nullopt);
+ blocking_touch_dispatched_to_renderer_timestamp, std::nullopt);
// Act
std::unique_ptr<ScrollEventMetrics> copy_scroll_metric =
@@ -363,7 +363,7 @@
// Act
std::unique_ptr<EventMetrics> event_metric =
EventMetrics::Create(ui::ET_TOUCH_MOVED, event_time,
- arrived_in_browser_main_timestamp, absl::nullopt);
+ arrived_in_browser_main_timestamp, std::nullopt);
// Assert
EXPECT_EQ(event_time, event_metric->GetDispatchStageTimestamp(
@@ -400,7 +400,7 @@
base::TimeTicks::Now() - base::Microseconds(50);
std::unique_ptr<EventMetrics> event_metric =
EventMetrics::Create(ui::ET_TOUCH_MOVED, event_time,
- arrived_in_browser_main_timestamp, absl::nullopt);
+ arrived_in_browser_main_timestamp, std::nullopt);
// Act
std::unique_ptr<EventMetrics> copy_event_metric =
diff --git a/cc/metrics/events_metrics_manager_unittest.cc b/cc/metrics/events_metrics_manager_unittest.cc
index 879bf94..ff438df 100644
--- a/cc/metrics/events_metrics_manager_unittest.cc
+++ b/cc/metrics/events_metrics_manager_unittest.cc
@@ -60,7 +60,7 @@
test_tick_clock_.Advance(base::Microseconds(10));
return EventMetrics::CreateForTesting(type, event_time,
arrived_in_browser_main_timestamp,
- &test_tick_clock_, absl::nullopt);
+ &test_tick_clock_, std::nullopt);
}
EventsMetricsManager manager_;
diff --git a/cc/metrics/frame_sorter.h b/cc/metrics/frame_sorter.h
index 71561659..a8671c1 100644
--- a/cc/metrics/frame_sorter.h
+++ b/cc/metrics/frame_sorter.h
@@ -9,11 +9,11 @@
#include <map>
+#include <optional>
#include "base/containers/circular_deque.h"
#include "base/functional/callback.h"
#include "cc/cc_export.h"
#include "components/viz/common/frame_sinks/begin_frame_args.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace cc {
@@ -78,7 +78,7 @@
std::map<viz::BeginFrameId, FrameState> frame_states_;
std::map<viz::BeginFrameId, FrameInfo> frame_infos_;
- absl::optional<uint64_t> current_source_id_;
+ std::optional<uint64_t> current_source_id_;
};
} // namespace cc
diff --git a/cc/metrics/predictor_jank_tracker.cc b/cc/metrics/predictor_jank_tracker.cc
index 9b447e1..9967256 100644
--- a/cc/metrics/predictor_jank_tracker.cc
+++ b/cc/metrics/predictor_jank_tracker.cc
@@ -67,7 +67,7 @@
float next_delta,
base::TimeTicks next_presentation_ts,
base::TimeDelta vsync_interval,
- absl::optional<EventMetrics::TraceId> trace_id) {
+ std::optional<EventMetrics::TraceId> trace_id) {
total_frames_++;
float d1 = frame_data_.prev_delta_;
float d2 = frame_data_.cur_delta_;
@@ -123,7 +123,7 @@
float janky_value,
bool contains_missed_vsyncs,
bool slow_scroll,
- absl::optional<EventMetrics::TraceId> trace_id) {
+ std::optional<EventMetrics::TraceId> trace_id) {
janky_frames_++;
TRACE_EVENT_INSTANT(
"input.scrolling", "PredictorJankTracker::ReportJankyFrame",
@@ -200,7 +200,7 @@
void PredictorJankTracker::StoreLatestFrameData(
float delta,
base::TimeTicks presentation_ts,
- absl::optional<EventMetrics::TraceId> trace_id) {
+ std::optional<EventMetrics::TraceId> trace_id) {
frame_data_.prev_delta_ = frame_data_.cur_delta_;
frame_data_.prev_trace_id_ = frame_data_.cur_trace_id_;
frame_data_.cur_delta_ = delta;
diff --git a/cc/metrics/predictor_jank_tracker.h b/cc/metrics/predictor_jank_tracker.h
index 1c69c93..bc6c6be 100644
--- a/cc/metrics/predictor_jank_tracker.h
+++ b/cc/metrics/predictor_jank_tracker.h
@@ -5,10 +5,10 @@
#ifndef CC_METRICS_PREDICTOR_JANK_TRACKER_H_
#define CC_METRICS_PREDICTOR_JANK_TRACKER_H_
+#include <optional>
#include "base/time/time.h"
#include "cc/cc_export.h"
#include "cc/metrics/event_metrics.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace cc {
@@ -28,7 +28,7 @@
void ReportLatestScrollDelta(float delta,
base::TimeTicks presentation_ts,
base::TimeDelta vsync_interval,
- absl::optional<EventMetrics::TraceId> trace_id);
+ std::optional<EventMetrics::TraceId> trace_id);
// Whenever a new scroll starts, data inside this class will be erased
// as it should be comparing neighbouring frames only.
@@ -40,13 +40,13 @@
// frame information.
void StoreLatestFrameData(float delta,
base::TimeTicks presentation_ts,
- absl::optional<EventMetrics::TraceId> trace_id);
+ std::optional<EventMetrics::TraceId> trace_id);
void ReportJankyFrame(float next_delta,
float janky_value,
bool contains_missed_vsyncs,
bool slow_scroll,
- absl::optional<EventMetrics::TraceId> trace_id);
+ std::optional<EventMetrics::TraceId> trace_id);
// Finds if a sequence of 3 consecutive frames were presnted in
// consecutive vsyncs, or some vsyncs were missed.
@@ -59,11 +59,11 @@
// Delta for the previous frame in pixels.
float prev_delta_ = 0;
// The EventLatency event_trace_id value if available.
- absl::optional<EventMetrics::TraceId> prev_trace_id_;
+ std::optional<EventMetrics::TraceId> prev_trace_id_;
// Delta for the current frame in pixels.
float cur_delta_ = 0;
// The EventLatency event_trace_id value if available.
- absl::optional<EventMetrics::TraceId> cur_trace_id_;
+ std::optional<EventMetrics::TraceId> cur_trace_id_;
// Presentation timestamp of the previous frame.
base::TimeTicks prev_presentation_ts_;
diff --git a/cc/metrics/scroll_jank_dropped_frame_tracker.h b/cc/metrics/scroll_jank_dropped_frame_tracker.h
index 0959574..80bf649 100644
--- a/cc/metrics/scroll_jank_dropped_frame_tracker.h
+++ b/cc/metrics/scroll_jank_dropped_frame_tracker.h
@@ -5,10 +5,10 @@
#ifndef CC_METRICS_SCROLL_JANK_DROPPED_FRAME_TRACKER_H_
#define CC_METRICS_SCROLL_JANK_DROPPED_FRAME_TRACKER_H_
+#include <optional>
#include "base/time/time.h"
#include "cc/cc_export.h"
#include "cc/metrics/event_metrics.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace cc {
@@ -77,8 +77,8 @@
// TODO(b/306611560): Cleanup experimental per vsync metric or promote to
// default.
JankData experimental_vsync_fixed_window_;
- absl::optional<JankData> per_scroll_;
- absl::optional<JankData> experimental_per_scroll_vsync_;
+ std::optional<JankData> per_scroll_;
+ std::optional<JankData> experimental_per_scroll_vsync_;
};
} // namespace cc
diff --git a/cc/metrics/scroll_jank_dropped_frame_tracker_unittest.cc b/cc/metrics/scroll_jank_dropped_frame_tracker_unittest.cc
index 06977ce1..98669d05 100644
--- a/cc/metrics/scroll_jank_dropped_frame_tracker_unittest.cc
+++ b/cc/metrics/scroll_jank_dropped_frame_tracker_unittest.cc
@@ -90,7 +90,7 @@
/*is_inertial=*/false,
ScrollUpdateEventMetrics::ScrollUpdateType::kContinued,
/*delta=*/10.0f, prev_frame.first_input_ts, base::TimeTicks(),
- &tick_clock, /*trace_id=*/absl::nullopt);
+ &tick_clock, /*trace_id=*/std::nullopt);
scroll_jank_dropped_frame_tracker_->ReportLatestPresentationData(
*event.get(), prev_frame.last_input_ts, prev_frame.presentation_ts,
@@ -107,7 +107,7 @@
/*is_inertial=*/false,
ScrollUpdateEventMetrics::ScrollUpdateType::kContinued,
/*delta=*/10.0f, frame.first_input_ts, base::TimeTicks(), &tick_clock,
- /*trace_id=*/absl::nullopt);
+ /*trace_id=*/std::nullopt);
scroll_jank_dropped_frame_tracker_->ReportLatestPresentationData(
*event.get(), frame.last_input_ts, frame.presentation_ts,
kVsyncInterval);
diff --git a/cc/metrics/video_playback_roughness_reporter.h b/cc/metrics/video_playback_roughness_reporter.h
index c967596..c407352 100644
--- a/cc/metrics/video_playback_roughness_reporter.h
+++ b/cc/metrics/video_playback_roughness_reporter.h
@@ -5,6 +5,7 @@
#ifndef CC_METRICS_VIDEO_PLAYBACK_ROUGHNESS_REPORTER_H_
#define CC_METRICS_VIDEO_PLAYBACK_ROUGHNESS_REPORTER_H_
+#include <optional>
#include "base/containers/circular_deque.h"
#include "base/containers/flat_set.h"
#include "base/functional/callback.h"
@@ -12,7 +13,6 @@
#include "cc/cc_export.h"
#include "media/base/video_frame.h"
#include "media/base/video_types.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
namespace cc {
@@ -111,10 +111,10 @@
FrameInfo();
FrameInfo(const FrameInfo&);
TokenType token = 0;
- absl::optional<base::TimeTicks> decode_time;
- absl::optional<base::TimeTicks> presentation_time;
- absl::optional<base::TimeDelta> actual_duration;
- absl::optional<base::TimeDelta> intended_duration;
+ std::optional<base::TimeTicks> decode_time;
+ std::optional<base::TimeTicks> presentation_time;
+ std::optional<base::TimeDelta> actual_duration;
+ std::optional<base::TimeDelta> intended_duration;
int refresh_rate_hz = 60;
gfx::Size size;
};
diff --git a/cc/mojo_embedder/async_layer_tree_frame_sink.cc b/cc/mojo_embedder/async_layer_tree_frame_sink.cc
index 02a334a..b22dfbc 100644
--- a/cc/mojo_embedder/async_layer_tree_frame_sink.cc
+++ b/cc/mojo_embedder/async_layer_tree_frame_sink.cc
@@ -200,7 +200,7 @@
frame.size_in_pixels().width());
}
- absl::optional<viz::HitTestRegionList> hit_test_region_list =
+ std::optional<viz::HitTestRegionList> hit_test_region_list =
client_->BuildHitTestData();
// If |hit_test_data_changed| was set or local_surface_id has been updated,
@@ -214,7 +214,7 @@
last_hit_test_data_)) {
DCHECK(!viz::HitTestRegionList::IsEqual(*hit_test_region_list,
viz::HitTestRegionList()));
- hit_test_region_list = absl::nullopt;
+ hit_test_region_list = std::nullopt;
} else {
last_hit_test_data_ = *hit_test_region_list;
}
diff --git a/cc/mojom/render_frame_metadata_mojom_traits.h b/cc/mojom/render_frame_metadata_mojom_traits.h
index 34b04ce..5cee93f 100644
--- a/cc/mojom/render_frame_metadata_mojom_traits.h
+++ b/cc/mojom/render_frame_metadata_mojom_traits.h
@@ -5,13 +5,13 @@
#ifndef CC_MOJOM_RENDER_FRAME_METADATA_MOJOM_TRAITS_H_
#define CC_MOJOM_RENDER_FRAME_METADATA_MOJOM_TRAITS_H_
+#include <optional>
#include "base/component_export.h"
#include "build/build_config.h"
#include "cc/mojom/render_frame_metadata.mojom-shared.h"
#include "cc/trees/render_frame_metadata.h"
#include "services/viz/public/cpp/compositing/local_surface_id_mojom_traits.h"
#include "skia/public/mojom/skcolor4f_mojom_traits.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
namespace mojo {
@@ -38,7 +38,7 @@
return metadata.root_background_color;
}
- static const absl::optional<gfx::PointF>& root_scroll_offset(
+ static const std::optional<gfx::PointF>& root_scroll_offset(
const cc::RenderFrameMetadata& metadata) {
return metadata.root_scroll_offset;
}
@@ -56,7 +56,7 @@
return metadata.is_mobile_optimized;
}
- static const absl::optional<cc::DelegatedInkBrowserMetadata>&
+ static const std::optional<cc::DelegatedInkBrowserMetadata>&
delegated_ink_metadata(const cc::RenderFrameMetadata& metadata) {
return metadata.delegated_ink_metadata;
}
@@ -70,7 +70,7 @@
return metadata.viewport_size_in_pixels;
}
- static const absl::optional<viz::LocalSurfaceId>& local_surface_id(
+ static const std::optional<viz::LocalSurfaceId>& local_surface_id(
const cc::RenderFrameMetadata& metadata) {
return metadata.local_surface_id;
}
diff --git a/cc/paint/decoded_draw_image.cc b/cc/paint/decoded_draw_image.cc
index 0d7d687..58e81961 100644
--- a/cc/paint/decoded_draw_image.cc
+++ b/cc/paint/decoded_draw_image.cc
@@ -32,7 +32,7 @@
is_budgeted_(true) {}
DecodedDrawImage::DecodedDrawImage(
- absl::optional<uint32_t> transfer_cache_entry_id,
+ std::optional<uint32_t> transfer_cache_entry_id,
sk_sp<ColorFilter> dark_mode_color_filter,
const SkSize& src_rect_offset,
const SkSize& scale_adjustment,
diff --git a/cc/paint/decoded_draw_image.h b/cc/paint/decoded_draw_image.h
index fd4f93a..634098a 100644
--- a/cc/paint/decoded_draw_image.h
+++ b/cc/paint/decoded_draw_image.h
@@ -8,10 +8,10 @@
#include <cfloat>
#include <cmath>
+#include <optional>
#include "cc/paint/paint_export.h"
#include "cc/paint/paint_flags.h"
#include "gpu/command_buffer/common/mailbox.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkRefCnt.h"
#include "third_party/skia/include/core/SkSize.h"
@@ -35,7 +35,7 @@
bool is_budgeted);
DecodedDrawImage(const gpu::Mailbox& mailbox,
PaintFlags::FilterQuality filter_quality);
- DecodedDrawImage(absl::optional<uint32_t> transfer_cache_entry_id,
+ DecodedDrawImage(std::optional<uint32_t> transfer_cache_entry_id,
sk_sp<ColorFilter> dark_mode_color_filter,
const SkSize& src_rect_offset,
const SkSize& scale_adjustment,
@@ -54,7 +54,7 @@
const sk_sp<ColorFilter>& dark_mode_color_filter() const {
return dark_mode_color_filter_;
}
- absl::optional<uint32_t> transfer_cache_entry_id() const {
+ std::optional<uint32_t> transfer_cache_entry_id() const {
return transfer_cache_entry_id_;
}
const SkSize& src_rect_offset() const { return src_rect_offset_; }
@@ -76,7 +76,7 @@
private:
sk_sp<SkImage> image_;
gpu::Mailbox mailbox_;
- absl::optional<uint32_t> transfer_cache_entry_id_;
+ std::optional<uint32_t> transfer_cache_entry_id_;
sk_sp<ColorFilter> dark_mode_color_filter_;
SkSize src_rect_offset_;
SkSize scale_adjustment_;
diff --git a/cc/paint/discardable_image_map.cc b/cc/paint/discardable_image_map.cc
index 0c33d9f..26a2dd4 100644
--- a/cc/paint/discardable_image_map.cc
+++ b/cc/paint/discardable_image_map.cc
@@ -115,7 +115,7 @@
continue;
gfx::Rect op_rect;
- absl::optional<gfx::Rect> local_op_rect;
+ std::optional<gfx::Rect> local_op_rect;
if (top_level_op_rect) {
op_rect = *top_level_op_rect;
diff --git a/cc/paint/display_item_list.cc b/cc/paint/display_item_list.cc
index ff462feb..b934f88d 100644
--- a/cc/paint/display_item_list.cc
+++ b/cc/paint/display_item_list.cc
@@ -348,7 +348,7 @@
offsets_to_use = &offsets;
}
- absl::optional<SkColor4f> solid_color =
+ std::optional<SkColor4f> solid_color =
SolidColorAnalyzer::DetermineIfSolidColor(
paint_op_buffer_, rect, max_ops_to_analyze, offsets_to_use);
if (solid_color) {
@@ -360,7 +360,7 @@
namespace {
-absl::optional<DisplayItemList::DirectlyCompositedImageResult>
+std::optional<DisplayItemList::DirectlyCompositedImageResult>
DirectlyCompositedImageResultForPaintOpBuffer(const PaintOpBuffer& op_buffer) {
// A PaintOpBuffer for an image may have 1 (a kDrawimagerect or a kDrawrecord
// that recursively contains a PaintOpBuffer for an image) or 4 paint
@@ -375,10 +375,10 @@
// PaintOpBuffer (i.e. 5 operations).
constexpr size_t kMaxDrawImageOps = 5;
if (op_buffer.size() > kMaxDrawImageOps)
- return absl::nullopt;
+ return std::nullopt;
bool transpose_image_size = false;
- absl::optional<DisplayItemList::DirectlyCompositedImageResult> result;
+ std::optional<DisplayItemList::DirectlyCompositedImageResult> result;
for (const PaintOp& op : op_buffer) {
switch (op.GetType()) {
case PaintOpType::kSave:
@@ -389,14 +389,14 @@
// We only expect a single transformation. If we see another one, then
// this image won't be eligible for directly compositing.
if (transpose_image_size)
- return absl::nullopt;
+ return std::nullopt;
// The transformation must be before the kDrawimagerect operation.
if (result)
- return absl::nullopt;
+ return std::nullopt;
const ConcatOp& concat_op = static_cast<const ConcatOp&>(op);
if (!MathUtil::SkM44Preserves2DAxisAlignment(concat_op.matrix))
- return absl::nullopt;
+ return std::nullopt;
// If the image has been rotated +/-90 degrees we'll need to transpose
// the width and height dimensions to account for the same transform
@@ -408,13 +408,13 @@
}
case PaintOpType::kDrawimagerect: {
if (result)
- return absl::nullopt;
+ return std::nullopt;
const auto& draw_image_rect_op =
static_cast<const DrawImageRectOp&>(op);
const SkRect& src = draw_image_rect_op.src;
const SkRect& dst = draw_image_rect_op.dst;
if (src.isEmpty() || dst.isEmpty())
- return absl::nullopt;
+ return std::nullopt;
result.emplace();
result->default_raster_scale = gfx::Vector2dF(
src.width() / dst.width(), src.height() / dst.height());
@@ -427,16 +427,16 @@
}
case PaintOpType::kDrawrecord:
if (result)
- return absl::nullopt;
+ return std::nullopt;
result = DirectlyCompositedImageResultForPaintOpBuffer(
static_cast<const DrawRecordOp&>(op).record.buffer());
if (!result)
- return absl::nullopt;
+ return std::nullopt;
break;
default:
// Disqualify the layer as a directly composited image if any other
// paint op is detected.
- return absl::nullopt;
+ return std::nullopt;
}
}
@@ -447,7 +447,7 @@
} // anonymous namespace
-absl::optional<DisplayItemList::DirectlyCompositedImageResult>
+std::optional<DisplayItemList::DirectlyCompositedImageResult>
DisplayItemList::GetDirectlyCompositedImageResult() const {
return DirectlyCompositedImageResultForPaintOpBuffer(paint_op_buffer_);
}
diff --git a/cc/paint/display_item_list.h b/cc/paint/display_item_list.h
index 9d036dac..8411e5d 100644
--- a/cc/paint/display_item_list.h
+++ b/cc/paint/display_item_list.h
@@ -11,6 +11,7 @@
#include <utility>
#include <vector>
+#include <optional>
#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
#include "cc/base/rtree.h"
@@ -19,7 +20,6 @@
#include "cc/paint/paint_export.h"
#include "cc/paint/paint_op.h"
#include "cc/paint/paint_op_buffer.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkPicture.h"
#include "ui/gfx/color_space.h"
#include "ui/gfx/geometry/rect.h"
@@ -136,7 +136,7 @@
// rasterized at the intrinsic size of the image), return the intrinsic size
// of the image and whether or not to use nearest neighbor filtering when
// scaling the layer.
- absl::optional<DirectlyCompositedImageResult>
+ std::optional<DirectlyCompositedImageResult>
GetDirectlyCompositedImageResult() const;
int num_slow_paths_up_to_min_for_MSAA() const {
@@ -230,7 +230,7 @@
void GenerateDiscardableImagesMetadata() const;
- mutable absl::optional<DiscardableImageMap> image_map_
+ mutable std::optional<DiscardableImageMap> image_map_
GUARDED_BY_CONTEXT(image_generation_lock_);
mutable base::Lock image_generation_lock_;
diff --git a/cc/paint/draw_image.cc b/cc/paint/draw_image.cc
index 875fc5e..2a56eb2 100644
--- a/cc/paint/draw_image.cc
+++ b/cc/paint/draw_image.cc
@@ -48,7 +48,7 @@
const SkIRect& src_rect,
PaintFlags::FilterQuality filter_quality,
const SkM44& matrix,
- absl::optional<size_t> frame_index)
+ std::optional<size_t> frame_index)
: paint_image_(std::move(image)),
use_dark_mode_(use_dark_mode),
src_rect_(src_rect),
@@ -62,7 +62,7 @@
const SkIRect& src_rect,
PaintFlags::FilterQuality filter_quality,
const SkM44& matrix,
- absl::optional<size_t> frame_index,
+ std::optional<size_t> frame_index,
const TargetColorParams& target_color_params)
: paint_image_(std::move(image)),
use_dark_mode_(use_dark_mode),
diff --git a/cc/paint/draw_image.h b/cc/paint/draw_image.h
index bafbc2ef..a2ad0fdc 100644
--- a/cc/paint/draw_image.h
+++ b/cc/paint/draw_image.h
@@ -5,11 +5,11 @@
#ifndef CC_PAINT_DRAW_IMAGE_H_
#define CC_PAINT_DRAW_IMAGE_H_
+#include <optional>
#include "cc/paint/paint_export.h"
#include "cc/paint/paint_flags.h"
#include "cc/paint/paint_image.h"
#include "cc/paint/target_color_params.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkM44.h"
#include "third_party/skia/include/core/SkRect.h"
@@ -32,13 +32,13 @@
const SkIRect& src_rect,
PaintFlags::FilterQuality filter_quality,
const SkM44& matrix,
- absl::optional<size_t> frame_index = absl::nullopt);
+ std::optional<size_t> frame_index = std::nullopt);
DrawImage(PaintImage image,
bool use_dark_mode,
const SkIRect& src_rect,
PaintFlags::FilterQuality filter_quality,
const SkM44& matrix,
- absl::optional<size_t> frame_index,
+ std::optional<size_t> frame_index,
const TargetColorParams& target_color_params);
// Constructs a DrawImage from |other| by adjusting its scale and setting new
// color params.
@@ -92,8 +92,8 @@
PaintFlags::FilterQuality filter_quality_;
SkSize scale_;
bool matrix_is_decomposable_;
- absl::optional<size_t> frame_index_;
- absl::optional<TargetColorParams> target_color_params_;
+ std::optional<size_t> frame_index_;
+ std::optional<TargetColorParams> target_color_params_;
};
} // namespace cc
diff --git a/cc/paint/image_provider.cc b/cc/paint/image_provider.cc
index f53b496e..c9e4217 100644
--- a/cc/paint/image_provider.cc
+++ b/cc/paint/image_provider.cc
@@ -6,8 +6,8 @@
#include <utility>
+#include <optional>
#include "cc/paint/paint_record.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace cc {
@@ -16,7 +16,7 @@
ImageProvider::ScopedResult::ScopedResult(DecodedDrawImage image)
: image_(std::move(image)) {}
-ImageProvider::ScopedResult::ScopedResult(absl::optional<PaintRecord> record)
+ImageProvider::ScopedResult::ScopedResult(std::optional<PaintRecord> record)
: record_(std::move(record)) {}
ImageProvider::ScopedResult::ScopedResult(DecodedDrawImage image,
diff --git a/cc/paint/image_provider.h b/cc/paint/image_provider.h
index f3fd470e..0835fe7d 100644
--- a/cc/paint/image_provider.h
+++ b/cc/paint/image_provider.h
@@ -7,13 +7,13 @@
#include <utility>
+#include <optional>
#include "base/functional/callback.h"
#include "base/types/optional_util.h"
#include "cc/paint/decoded_draw_image.h"
#include "cc/paint/draw_image.h"
#include "cc/paint/paint_export.h"
#include "cc/paint/paint_op_buffer.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace cc {
class PaintImage;
@@ -28,7 +28,7 @@
ScopedResult();
explicit ScopedResult(DecodedDrawImage image);
- explicit ScopedResult(absl::optional<PaintRecord> record);
+ explicit ScopedResult(std::optional<PaintRecord> record);
ScopedResult(DecodedDrawImage image, DestructionCallback callback);
ScopedResult(const ScopedResult&) = delete;
ScopedResult(ScopedResult&& other);
@@ -51,7 +51,7 @@
void DestroyDecode();
DecodedDrawImage image_;
- absl::optional<PaintRecord> record_;
+ std::optional<PaintRecord> record_;
DestructionCallback destruction_callback_;
};
diff --git a/cc/paint/image_transfer_cache_entry.cc b/cc/paint/image_transfer_cache_entry.cc
index a8273f05..7346595 100644
--- a/cc/paint/image_transfer_cache_entry.cc
+++ b/cc/paint/image_transfer_cache_entry.cc
@@ -257,7 +257,7 @@
GrDirectContext* gr_context,
skgpu::graphite::Recorder* graphite_recorder,
bool mip_mapped_for_upload,
- absl::optional<SkYUVAInfo>* out_yuva_info = nullptr,
+ std::optional<SkYUVAInfo>* out_yuva_info = nullptr,
std::vector<sk_sp<SkImage>>* out_yuva_plane_images = nullptr) {
int max_size;
if (gr_context) {
@@ -349,7 +349,7 @@
}
if (out_yuva_info) {
- *out_yuva_info = absl::nullopt;
+ *out_yuva_info = std::nullopt;
}
if (out_yuva_plane_images) {
out_yuva_plane_images->clear();
@@ -476,7 +476,7 @@
ClientImageTransferCacheEntry::ClientImageTransferCacheEntry(
const Image& image,
bool needs_mips,
- const absl::optional<gfx::HDRMetadata>& hdr_metadata,
+ const std::optional<gfx::HDRMetadata>& hdr_metadata,
sk_sp<SkColorSpace> target_color_space)
: needs_mips_(needs_mips),
target_color_space_(target_color_space),
@@ -767,7 +767,7 @@
}
// Color conversion converts to RGBA. Remove all YUV state.
- yuva_info_ = absl::nullopt;
+ yuva_info_ = std::nullopt;
plane_images_.clear();
plane_sizes_.clear();
diff --git a/cc/paint/image_transfer_cache_entry.h b/cc/paint/image_transfer_cache_entry.h
index 611ff79..95db874 100644
--- a/cc/paint/image_transfer_cache_entry.h
+++ b/cc/paint/image_transfer_cache_entry.h
@@ -10,11 +10,11 @@
#include <vector>
+#include <optional>
#include "base/atomic_sequence_num.h"
#include "base/containers/span.h"
#include "base/memory/raw_ptr.h"
#include "cc/paint/transfer_cache_entry.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkImageInfo.h"
#include "third_party/skia/include/core/SkRefCnt.h"
#include "third_party/skia/include/core/SkYUVAInfo.h"
@@ -82,7 +82,7 @@
ClientImageTransferCacheEntry(
const Image& image,
bool needs_mips,
- const absl::optional<gfx::HDRMetadata>& hdr_metadata = absl::nullopt,
+ const std::optional<gfx::HDRMetadata>& hdr_metadata = std::nullopt,
sk_sp<SkColorSpace> target_color_space = nullptr);
ClientImageTransferCacheEntry(const Image& image,
const Image& gainmap_image,
@@ -115,11 +115,11 @@
// The gainmap image and parameters. Either both or neither of these must
// be specified.
- absl::optional<Image> gainmap_image_;
- absl::optional<SkGainmapInfo> gainmap_info_;
+ std::optional<Image> gainmap_image_;
+ std::optional<SkGainmapInfo> gainmap_info_;
// The HDR metadata for non-gainmap HDR metadata.
- absl::optional<gfx::HDRMetadata> hdr_metadata_;
+ std::optional<gfx::HDRMetadata> hdr_metadata_;
};
class CC_PAINT_EXPORT ServiceImageTransferCacheEntry final
@@ -197,7 +197,7 @@
// HDR tonemapping may be done with a tone curve (for global tone mapping).
bool use_tone_curve_ = false;
- absl::optional<gfx::HDRMetadata> tone_curve_hdr_metadata_;
+ std::optional<gfx::HDRMetadata> tone_curve_hdr_metadata_;
// The value of `size_` is computed during deserialization and never updated
// (even if the size of the image changes due to mipmaps being requested).
@@ -206,7 +206,7 @@
// The individual planes that are used by `image_` when `image_` is a YUVA
// image. The planes are kept around for use in EnsureMips(), memory dumps,
// and unit tests.
- absl::optional<SkYUVAInfo> yuva_info_;
+ std::optional<SkYUVAInfo> yuva_info_;
std::vector<sk_sp<SkImage>> plane_images_;
std::vector<size_t> plane_sizes_;
};
diff --git a/cc/paint/image_transfer_cache_entry_unittest.cc b/cc/paint/image_transfer_cache_entry_unittest.cc
index b094518..a055d6d 100644
--- a/cc/paint/image_transfer_cache_entry_unittest.cc
+++ b/cc/paint/image_transfer_cache_entry_unittest.cc
@@ -245,7 +245,7 @@
ClientImageTransferCacheEntry::Image(yuva_pixmaps.planes().data(),
yuva_info,
nullptr /* decoded color space*/),
- true /* needs_mips */, absl::nullopt));
+ true /* needs_mips */, std::nullopt));
uint32_t size = client_entry->SerializedSize();
auto data = PaintOpWriter::AllocateAlignedBuffer<uint8_t>(size);
ASSERT_TRUE(client_entry->Serialize(
@@ -399,7 +399,7 @@
ClientImageTransferCacheEntry client_entry(
ClientImageTransferCacheEntry::Image(&bitmap.pixmap()), true,
- absl::nullopt);
+ std::nullopt);
const uint32_t storage_size = client_entry.SerializedSize();
auto storage = PaintOpWriter::AllocateAlignedBuffer<uint8_t>(storage_size);
client_entry.Serialize(base::make_span(storage.get(), storage_size));
@@ -429,7 +429,7 @@
SkImageInfo::MakeN32Premul(gr_context->maxTextureSize() + 1, 10));
ClientImageTransferCacheEntry client_entry(
ClientImageTransferCacheEntry::Image(&bitmap.pixmap()), false,
- absl::nullopt);
+ std::nullopt);
const uint32_t storage_size = client_entry.SerializedSize();
auto storage = PaintOpWriter::AllocateAlignedBuffer<uint8_t>(storage_size);
client_entry.Serialize(base::make_span(storage.get(), storage_size));
diff --git a/cc/paint/oop_pixeltest.cc b/cc/paint/oop_pixeltest.cc
index d63fcb0..9cabc1e7 100644
--- a/cc/paint/oop_pixeltest.cc
+++ b/cc/paint/oop_pixeltest.cc
@@ -174,7 +174,7 @@
SkBitmap Raster(scoped_refptr<DisplayItemList> display_item_list,
const RasterOptions& options) {
- absl::optional<PlaybackImageProvider::Settings> settings;
+ std::optional<PlaybackImageProvider::Settings> settings;
settings.emplace(PlaybackImageProvider::Settings());
settings->raster_mode = options.image_provider_raster_mode;
PlaybackImageProvider image_provider(oop_image_cache_.get(),
@@ -267,7 +267,7 @@
gpu::SharedImageInterface* sii,
const RasterOptions& options,
viz::SharedImageFormat image_format,
- absl::optional<gfx::ColorSpace> color_space = absl::nullopt) {
+ std::optional<gfx::ColorSpace> color_space = std::nullopt) {
uint32_t flags = gpu::SHARED_IMAGE_USAGE_RASTER |
gpu::SHARED_IMAGE_USAGE_OOP_RASTERIZATION;
gpu::Mailbox mailbox =
diff --git a/cc/paint/paint_filter.h b/cc/paint/paint_filter.h
index b7326f4..a32fad8 100644
--- a/cc/paint/paint_filter.h
+++ b/cc/paint/paint_filter.h
@@ -7,13 +7,13 @@
#include <string>
+#include <optional>
#include "base/check_op.h"
#include "cc/paint/color_filter.h"
#include "cc/paint/paint_export.h"
#include "cc/paint/paint_image.h"
#include "cc/paint/paint_shader.h"
#include "third_party/abseil-cpp/absl/container/inlined_vector.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkBlendMode.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkImageFilter.h"
@@ -144,7 +144,7 @@
friend class viz::SoftwareRenderer;
const Type type_;
- absl::optional<CropRect> crop_rect_;
+ std::optional<CropRect> crop_rect_;
const bool has_discardable_images_;
ImageAnalysisState image_analysis_state_ = ImageAnalysisState::kNoAnalysis;
diff --git a/cc/paint/paint_image.h b/cc/paint/paint_image.h
index bfada0f..c3b11c36 100644
--- a/cc/paint/paint_image.h
+++ b/cc/paint/paint_image.h
@@ -8,6 +8,7 @@
#include <string>
#include <vector>
+#include <optional>
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_refptr.h"
#include "cc/paint/frame_metadata.h"
@@ -15,7 +16,6 @@
#include "cc/paint/paint_export.h"
#include "cc/paint/paint_record.h"
#include "gpu/command_buffer/common/mailbox.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkImageInfo.h"
#include "third_party/skia/include/core/SkRefCnt.h"
@@ -85,7 +85,7 @@
YUVSubsampling yuv_subsampling = YUVSubsampling::kUnknown;
// The HDR metadata included with the image, if present.
- absl::optional<gfx::HDRMetadata> hdr_metadata;
+ std::optional<gfx::HDRMetadata> hdr_metadata;
// The visible size of the image (i.e., the area that contains meaningful
// pixels).
@@ -95,7 +95,7 @@
// |image_size| for a 4:2:0 JPEG is 12x31, its coded size should be 16x32
// because the size of a minimum-coded unit for 4:2:0 is 16x16.
// A zero-initialized |coded_size| indicates an invalid image.
- absl::optional<gfx::Size> coded_size;
+ std::optional<gfx::Size> coded_size;
// Whether the image embeds an ICC color profile.
bool has_embedded_color_profile = false;
@@ -104,11 +104,11 @@
bool all_data_received_prior_to_decode = false;
// For JPEGs only: whether the image is progressive (as opposed to baseline).
- absl::optional<bool> jpeg_is_progressive;
+ std::optional<bool> jpeg_is_progressive;
// For WebPs only: whether this is a simple-format lossy image. See
// https://developers.google.com/speed/webp/docs/riff_container#simple_file_format_lossy.
- absl::optional<bool> webp_is_non_extended_lossy;
+ std::optional<bool> webp_is_non_extended_lossy;
};
// A representation of an image for the compositor. This is the most abstract
@@ -358,11 +358,11 @@
return gainmap_info_.value();
}
- absl::optional<gfx::HDRMetadata> GetHDRMetadata() const {
+ std::optional<gfx::HDRMetadata> GetHDRMetadata() const {
if (const auto* image_metadata = GetImageHeaderMetadata()) {
return image_metadata->hdr_metadata;
}
- return absl::nullopt;
+ return std::nullopt;
}
std::string ToString() const;
@@ -400,7 +400,7 @@
const sk_sp<SkImage>& GetSkImage() const;
sk_sp<SkImage> sk_image_;
- absl::optional<PaintRecord> paint_record_;
+ std::optional<PaintRecord> paint_record_;
gfx::Rect paint_record_rect_;
ContentId content_id_ = kInvalidContentId;
@@ -409,10 +409,10 @@
// Gainmap HDR metadata.
sk_sp<PaintImageGenerator> gainmap_paint_image_generator_;
- absl::optional<SkGainmapInfo> gainmap_info_;
+ std::optional<SkGainmapInfo> gainmap_info_;
// The HDR metadata for non-gainmap HDR rendering.
- absl::optional<gfx::HDRMetadata> hdr_metadata_;
+ std::optional<gfx::HDRMetadata> hdr_metadata_;
sk_sp<TextureBacking> texture_backing_;
diff --git a/cc/paint/paint_image_builder.cc b/cc/paint/paint_image_builder.cc
index 176dece4..d08ca0f7 100644
--- a/cc/paint/paint_image_builder.cc
+++ b/cc/paint/paint_image_builder.cc
@@ -29,7 +29,7 @@
#endif
if (clear_contents) {
paint_image_.sk_image_ = nullptr;
- paint_image_.paint_record_ = absl::nullopt;
+ paint_image_.paint_record_ = std::nullopt;
paint_image_.paint_record_rect_ = gfx::Rect();
paint_image_.paint_image_generator_ = nullptr;
paint_image_.cached_sk_image_ = nullptr;
diff --git a/cc/paint/paint_image_builder.h b/cc/paint/paint_image_builder.h
index 54f8685..3f80dbd9b 100644
--- a/cc/paint/paint_image_builder.h
+++ b/cc/paint/paint_image_builder.h
@@ -86,7 +86,7 @@
return std::move(*this);
}
PaintImageBuilder&& set_hdr_metadata(
- absl::optional<gfx::HDRMetadata> hdr_metadata) {
+ std::optional<gfx::HDRMetadata> hdr_metadata) {
paint_image_.hdr_metadata_ = hdr_metadata;
return std::move(*this);
}
diff --git a/cc/paint/paint_op.cc b/cc/paint/paint_op.cc
index fa753ce..decb0df2 100644
--- a/cc/paint/paint_op.cc
+++ b/cc/paint/paint_op.cc
@@ -881,7 +881,7 @@
template <typename T>
bool DeserializeSkottieMap(
base::flat_map<SkottieResourceIdHash, T>& map,
- absl::optional<size_t> max_map_size,
+ std::optional<size_t> max_map_size,
PaintOpReader& reader,
base::FunctionRef<T(PaintOpReader& reader)> value_deserializer) {
size_t map_size = 0;
@@ -954,7 +954,7 @@
op->images, /*max_map_size=*/num_assets_in_animation, reader,
DeserializeSkottieFrameData) &&
DeserializeSkottieMap<SkColor>(op->color_map,
- /*max_map_size=*/absl::nullopt, reader,
+ /*max_map_size=*/std::nullopt, reader,
DeserializeSkottieColor) &&
DeserializeSkottieMap<SkottieTextPropertyValue>(
op->text_map, /*max_map_size=*/num_text_nodes_in_animation, reader,
@@ -1454,7 +1454,7 @@
const PlaybackParams& params) {
// See PaintOp::kUnsetRect
bool unset = op->bounds.left() == SK_ScalarInfinity;
- absl::optional<SkPaint> paint;
+ std::optional<SkPaint> paint;
if (op->alpha != 1.0f) {
paint.emplace();
paint->setAlphaf(op->alpha);
diff --git a/cc/paint/paint_op_buffer.h b/cc/paint/paint_op_buffer.h
index 2d19b217..e8304e9 100644
--- a/cc/paint/paint_op_buffer.h
+++ b/cc/paint/paint_op_buffer.h
@@ -10,6 +10,7 @@
#include <utility>
#include <vector>
+#include <optional>
#include "base/bits.h"
#include "base/check_op.h"
#include "base/functional/callback.h"
@@ -17,7 +18,6 @@
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "cc/paint/paint_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkM44.h"
#include "third_party/skia/include/core/SkRefCnt.h"
@@ -75,7 +75,7 @@
CustomDataRasterCallback custom_callback;
DidDrawOpCallback did_draw_op_callback;
ConvertOpCallback convert_op_callback;
- absl::optional<bool> save_layer_alpha_should_preserve_lcd_text;
+ std::optional<bool> save_layer_alpha_should_preserve_lcd_text;
bool is_analyzing = false;
};
diff --git a/cc/paint/paint_op_buffer_iterator.cc b/cc/paint/paint_op_buffer_iterator.cc
index 076bef4..28ba1af6 100644
--- a/cc/paint/paint_op_buffer_iterator.cc
+++ b/cc/paint/paint_op_buffer_iterator.cc
@@ -39,10 +39,10 @@
const PaintOpBuffer& buffer,
const std::vector<size_t>* offsets)
: iter_(offsets == nullptr ? absl::variant<Iterator, OffsetIterator>(
- absl::in_place_type<Iterator>,
+ std::in_place_type<Iterator>,
buffer)
: absl::variant<Iterator, OffsetIterator>(
- absl::in_place_type<OffsetIterator>,
+ std::in_place_type<OffsetIterator>,
buffer,
*offsets)) {}
diff --git a/cc/paint/paint_op_reader.cc b/cc/paint/paint_op_reader.cc
index 128d430..1af06fd 100644
--- a/cc/paint/paint_op_reader.cc
+++ b/cc/paint/paint_op_reader.cc
@@ -925,7 +925,7 @@
}
uint32_t has_crop_rect = 0;
- absl::optional<PaintFilter::CropRect> crop_rect;
+ std::optional<PaintFilter::CropRect> crop_rect;
ReadSimple(&has_crop_rect);
if (has_crop_rect) {
SkRect rect = SkRect::MakeEmpty();
@@ -1009,7 +1009,7 @@
void PaintOpReader::ReadColorFilterPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect) {
+ const std::optional<PaintFilter::CropRect>& crop_rect) {
sk_sp<ColorFilter> color_filter;
sk_sp<PaintFilter> input;
@@ -1024,7 +1024,7 @@
void PaintOpReader::ReadBlurPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect) {
+ const std::optional<PaintFilter::CropRect>& crop_rect) {
SkScalar sigma_x = 0.f;
SkScalar sigma_y = 0.f;
SkTileMode tile_mode;
@@ -1043,7 +1043,7 @@
void PaintOpReader::ReadDropShadowPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect) {
+ const std::optional<PaintFilter::CropRect>& crop_rect) {
SkScalar dx = 0.f;
SkScalar dy = 0.f;
SkScalar sigma_x = 0.f;
@@ -1069,7 +1069,7 @@
void PaintOpReader::ReadMagnifierPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect) {
+ const std::optional<PaintFilter::CropRect>& crop_rect) {
SkRect lens_bounds = SkRect::MakeEmpty();
SkScalar zoom_amount = 1.f;
SkScalar inset = 0.f;
@@ -1088,7 +1088,7 @@
void PaintOpReader::ReadComposePaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect) {
+ const std::optional<PaintFilter::CropRect>& crop_rect) {
sk_sp<PaintFilter> outer;
sk_sp<PaintFilter> inner;
@@ -1101,7 +1101,7 @@
void PaintOpReader::ReadAlphaThresholdPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect) {
+ const std::optional<PaintFilter::CropRect>& crop_rect) {
SkRegion region;
sk_sp<PaintFilter> input;
@@ -1115,7 +1115,7 @@
void PaintOpReader::ReadXfermodePaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect) {
+ const std::optional<PaintFilter::CropRect>& crop_rect) {
SkBlendMode blend_mode;
sk_sp<PaintFilter> background;
sk_sp<PaintFilter> foreground;
@@ -1133,7 +1133,7 @@
void PaintOpReader::ReadArithmeticPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect) {
+ const std::optional<PaintFilter::CropRect>& crop_rect) {
float k1 = 0.f;
float k2 = 0.f;
float k3 = 0.f;
@@ -1157,7 +1157,7 @@
void PaintOpReader::ReadMatrixConvolutionPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect) {
+ const std::optional<PaintFilter::CropRect>& crop_rect) {
SkISize kernel_size = SkISize::MakeEmpty();
SkScalar gain = 0.f;
SkScalar bias = 0.f;
@@ -1203,7 +1203,7 @@
void PaintOpReader::ReadDisplacementMapEffectPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect) {
+ const std::optional<PaintFilter::CropRect>& crop_rect) {
SkColorChannel channel_x;
SkColorChannel channel_y;
SkScalar scale = 0.f;
@@ -1225,7 +1225,7 @@
void PaintOpReader::ReadImagePaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect) {
+ const std::optional<PaintFilter::CropRect>& crop_rect) {
PaintImage image;
Read(&image, PaintFlags::DynamicRangeLimit::kHigh);
if (!image) {
@@ -1248,7 +1248,7 @@
void PaintOpReader::ReadRecordPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect) {
+ const std::optional<PaintFilter::CropRect>& crop_rect) {
bool has_filter = false;
ReadSimple(&has_filter);
if (!has_filter) {
@@ -1282,7 +1282,7 @@
return;
}
- absl::optional<PaintRecord> record;
+ std::optional<PaintRecord> record;
Read(&record);
if (!valid_) {
return;
@@ -1293,7 +1293,7 @@
void PaintOpReader::ReadMergePaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect) {
+ const std::optional<PaintFilter::CropRect>& crop_rect) {
size_t input_count = 0;
ReadSize(&input_count);
@@ -1317,7 +1317,7 @@
void PaintOpReader::ReadMorphologyPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect) {
+ const std::optional<PaintFilter::CropRect>& crop_rect) {
MorphologyPaintFilter::MorphType morph_type;
float radius_x = 0;
float radius_y = 0;
@@ -1335,7 +1335,7 @@
void PaintOpReader::ReadOffsetPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect) {
+ const std::optional<PaintFilter::CropRect>& crop_rect) {
SkScalar dx = 0.f;
SkScalar dy = 0.f;
sk_sp<PaintFilter> input;
@@ -1351,7 +1351,7 @@
void PaintOpReader::ReadTilePaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect) {
+ const std::optional<PaintFilter::CropRect>& crop_rect) {
SkRect src = SkRect::MakeEmpty();
SkRect dst = SkRect::MakeEmpty();
sk_sp<PaintFilter> input;
@@ -1366,7 +1366,7 @@
void PaintOpReader::ReadTurbulencePaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect) {
+ const std::optional<PaintFilter::CropRect>& crop_rect) {
TurbulencePaintFilter::TurbulenceType turbulence_type;
SkScalar base_frequency_x = 0.f;
SkScalar base_frequency_y = 0.f;
@@ -1389,7 +1389,7 @@
void PaintOpReader::ReadShaderPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect) {
+ const std::optional<PaintFilter::CropRect>& crop_rect) {
using Dither = SkImageFilters::Dither;
sk_sp<PaintShader> shader;
@@ -1411,7 +1411,7 @@
void PaintOpReader::ReadMatrixPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect) {
+ const std::optional<PaintFilter::CropRect>& crop_rect) {
SkMatrix matrix = SkMatrix::I();
PaintFlags::FilterQuality filter_quality = PaintFlags::FilterQuality::kNone;
sk_sp<PaintFilter> input;
@@ -1427,7 +1427,7 @@
void PaintOpReader::ReadLightingDistantPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect) {
+ const std::optional<PaintFilter::CropRect>& crop_rect) {
PaintFilter::LightingType lighting_type;
SkPoint3 direction = SkPoint3::Make(0.f, 0.f, 0.f);
SkColor light_color = SK_ColorBLACK;
@@ -1454,7 +1454,7 @@
void PaintOpReader::ReadLightingPointPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect) {
+ const std::optional<PaintFilter::CropRect>& crop_rect) {
PaintFilter::LightingType lighting_type;
SkPoint3 location = SkPoint3::Make(0.f, 0.f, 0.f);
SkColor light_color = SK_ColorBLACK;
@@ -1480,7 +1480,7 @@
void PaintOpReader::ReadLightingSpotPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect) {
+ const std::optional<PaintFilter::CropRect>& crop_rect) {
PaintFilter::LightingType lighting_type;
SkPoint3 location = SkPoint3::Make(0.f, 0.f, 0.f);
SkPoint3 target = SkPoint3::Make(0.f, 0.f, 0.f);
@@ -1512,7 +1512,7 @@
std::move(input), base::OptionalToPtr(crop_rect)));
}
-size_t PaintOpReader::Read(absl::optional<PaintRecord>* record) {
+size_t PaintOpReader::Read(std::optional<PaintRecord>* record) {
size_t size_bytes = 0;
ReadSize(&size_bytes);
diff --git a/cc/paint/paint_op_reader.h b/cc/paint/paint_op_reader.h
index 30b9d78..d65dd3a 100644
--- a/cc/paint/paint_op_reader.h
+++ b/cc/paint/paint_op_reader.h
@@ -5,6 +5,7 @@
#ifndef CC_PAINT_PAINT_OP_READER_H_
#define CC_PAINT_PAINT_OP_READER_H_
+#include <optional>
#include "base/bits.h"
#include "base/memory/raw_ref.h"
#include "base/memory/scoped_refptr.h"
@@ -12,7 +13,6 @@
#include "cc/paint/paint_filter.h"
#include "cc/paint/paint_op_writer.h"
#include "cc/paint/transfer_cache_deserialize_helper.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
struct SkGainmapInfo;
struct SkHighContrastConfig;
@@ -245,73 +245,73 @@
// the following functions depending on read type.
void ReadColorFilterPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect);
+ const std::optional<PaintFilter::CropRect>& crop_rect);
void ReadBlurPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect);
+ const std::optional<PaintFilter::CropRect>& crop_rect);
void ReadDropShadowPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect);
+ const std::optional<PaintFilter::CropRect>& crop_rect);
void ReadMagnifierPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect);
+ const std::optional<PaintFilter::CropRect>& crop_rect);
void ReadComposePaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect);
+ const std::optional<PaintFilter::CropRect>& crop_rect);
void ReadAlphaThresholdPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect);
+ const std::optional<PaintFilter::CropRect>& crop_rect);
void ReadXfermodePaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect);
+ const std::optional<PaintFilter::CropRect>& crop_rect);
void ReadArithmeticPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect);
+ const std::optional<PaintFilter::CropRect>& crop_rect);
void ReadMatrixConvolutionPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect);
+ const std::optional<PaintFilter::CropRect>& crop_rect);
void ReadDisplacementMapEffectPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect);
+ const std::optional<PaintFilter::CropRect>& crop_rect);
void ReadImagePaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect);
+ const std::optional<PaintFilter::CropRect>& crop_rect);
void ReadRecordPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect);
+ const std::optional<PaintFilter::CropRect>& crop_rect);
void ReadMergePaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect);
+ const std::optional<PaintFilter::CropRect>& crop_rect);
void ReadMorphologyPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect);
+ const std::optional<PaintFilter::CropRect>& crop_rect);
void ReadOffsetPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect);
+ const std::optional<PaintFilter::CropRect>& crop_rect);
void ReadTilePaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect);
+ const std::optional<PaintFilter::CropRect>& crop_rect);
void ReadTurbulencePaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect);
+ const std::optional<PaintFilter::CropRect>& crop_rect);
void ReadShaderPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect);
+ const std::optional<PaintFilter::CropRect>& crop_rect);
void ReadMatrixPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect);
+ const std::optional<PaintFilter::CropRect>& crop_rect);
void ReadLightingDistantPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect);
+ const std::optional<PaintFilter::CropRect>& crop_rect);
void ReadLightingPointPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect);
+ const std::optional<PaintFilter::CropRect>& crop_rect);
void ReadLightingSpotPaintFilter(
sk_sp<PaintFilter>* filter,
- const absl::optional<PaintFilter::CropRect>& crop_rect);
+ const std::optional<PaintFilter::CropRect>& crop_rect);
// Returns the size of the read record, 0 if error.
- size_t Read(absl::optional<PaintRecord>* record);
+ size_t Read(std::optional<PaintRecord>* record);
void Read(SkRegion* region);
uint8_t* CopyScratchSpace(size_t bytes);
diff --git a/cc/paint/paint_op_writer.cc b/cc/paint/paint_op_writer.cc
index eda20a06..53c47b6 100644
--- a/cc/paint/paint_op_writer.cc
+++ b/cc/paint/paint_op_writer.cc
@@ -380,7 +380,7 @@
return;
}
- absl::optional<uint32_t> id = decoded_draw_image.transfer_cache_entry_id();
+ std::optional<uint32_t> id = decoded_draw_image.transfer_cache_entry_id();
// In the case of a decode failure, id may not be set. Send an invalid ID.
WriteImage(id.value_or(kInvalidImageTransferCacheEntryId),
decoded_draw_image.transfer_cache_entry_needs_mips());
diff --git a/cc/paint/paint_op_writer.h b/cc/paint/paint_op_writer.h
index 26bb335..f9d2356f 100644
--- a/cc/paint/paint_op_writer.h
+++ b/cc/paint/paint_op_writer.h
@@ -151,7 +151,7 @@
static size_t SerializedSize(const PaintFilter* filter);
template <typename T>
- static size_t SerializedSize(const absl::optional<T>& o) {
+ static size_t SerializedSize(const std::optional<T>& o) {
if (o) {
return (base::CheckedNumeric<size_t>(SerializedSize<bool>()) +
SerializedSize<T>(*o))
diff --git a/cc/paint/paint_shader.h b/cc/paint/paint_shader.h
index 8b0fbfc..8ab0504 100644
--- a/cc/paint/paint_shader.h
+++ b/cc/paint/paint_shader.h
@@ -8,6 +8,7 @@
#include <memory>
#include <vector>
+#include <optional>
#include "base/gtest_prod_util.h"
#include "base/types/optional_util.h"
#include "cc/paint/image_analysis_state.h"
@@ -15,7 +16,6 @@
#include "cc/paint/paint_flags.h"
#include "cc/paint/paint_image.h"
#include "cc/paint/paint_record.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkScalar.h"
#include "third_party/skia/include/effects/SkGradientShader.h"
@@ -256,7 +256,7 @@
SkColor4f fallback_color_ = SkColors::kTransparent;
ScalingBehavior scaling_behavior_ = ScalingBehavior::kRasterAtScale;
- absl::optional<SkMatrix> local_matrix_;
+ std::optional<SkMatrix> local_matrix_;
SkPoint center_ = SkPoint::Make(0, 0);
SkRect tile_ = SkRect::MakeEmpty();
@@ -267,12 +267,12 @@
SkScalar end_degrees_ = 0;
PaintImage image_;
- absl::optional<PaintRecord> record_;
+ std::optional<PaintRecord> record_;
RecordShaderId id_ = kInvalidRecordShaderId;
// For decoded PaintRecord shaders, specifies the scale at which the record
// will be rasterized.
- absl::optional<gfx::SizeF> tile_scale_;
+ std::optional<gfx::SizeF> tile_scale_;
std::vector<SkColor4f> colors_;
std::vector<SkScalar> positions_;
diff --git a/cc/paint/paint_worklet_input.h b/cc/paint/paint_worklet_input.h
index f0fdc22..4e451a31 100644
--- a/cc/paint/paint_worklet_input.h
+++ b/cc/paint/paint_worklet_input.h
@@ -9,12 +9,12 @@
#include <utility>
#include <vector>
+#include <optional>
#include "base/containers/flat_map.h"
#include "base/memory/ref_counted.h"
#include "cc/paint/element_id.h"
#include "cc/paint/paint_export.h"
#include "cc/paint/paint_image.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkRefCnt.h"
#include "ui/gfx/geometry/size_f.h"
@@ -55,8 +55,8 @@
bool operator!=(const PropertyKey& other) const;
bool operator<(const PropertyKey&) const;
- absl::optional<std::string> custom_property_name;
- absl::optional<NativePropertyType> native_property_type;
+ std::optional<std::string> custom_property_name;
+ std::optional<NativePropertyType> native_property_type;
ElementId element_id;
};
@@ -74,8 +74,8 @@
~PropertyValue();
bool has_value() const;
void reset();
- absl::optional<float> float_value;
- absl::optional<SkColor4f> color_value;
+ std::optional<float> float_value;
+ std::optional<SkColor4f> color_value;
};
virtual gfx::SizeF GetSize() const = 0;
@@ -104,7 +104,7 @@
// the PaintWorklet to enable efficient invalidation of dirty PaintWorklets.
using PaintWorkletRecordMap =
base::flat_map<scoped_refptr<const PaintWorkletInput>,
- std::pair<PaintImage::Id, absl::optional<PaintRecord>>>;
+ std::pair<PaintImage::Id, std::optional<PaintRecord>>>;
} // namespace cc
diff --git a/cc/paint/record_paint_canvas.h b/cc/paint/record_paint_canvas.h
index 0f9f81d..90403ed 100644
--- a/cc/paint/record_paint_canvas.h
+++ b/cc/paint/record_paint_canvas.h
@@ -5,6 +5,7 @@
#ifndef CC_PAINT_RECORD_PAINT_CANVAS_H_
#define CC_PAINT_RECORD_PAINT_CANVAS_H_
+#include <optional>
#include "base/compiler_specific.h"
#include "base/memory/raw_ptr.h"
#include "build/build_config.h"
@@ -13,7 +14,6 @@
#include "cc/paint/paint_op_buffer.h"
#include "cc/paint/paint_record.h"
#include "cc/paint/skottie_color_map.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/utils/SkNoDrawCanvas.h"
namespace cc {
diff --git a/cc/paint/scoped_raster_flags.h b/cc/paint/scoped_raster_flags.h
index 40d1a43..8104ca6 100644
--- a/cc/paint/scoped_raster_flags.h
+++ b/cc/paint/scoped_raster_flags.h
@@ -5,11 +5,11 @@
#ifndef CC_PAINT_SCOPED_RASTER_FLAGS_H_
#define CC_PAINT_SCOPED_RASTER_FLAGS_H_
+#include <optional>
#include "base/memory/raw_ptr_exclusion.h"
#include "cc/paint/decode_stashing_image_provider.h"
#include "cc/paint/paint_export.h"
#include "cc/paint/paint_flags.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace cc {
@@ -77,8 +77,8 @@
// This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #union
RAW_PTR_EXCLUSION const PaintFlags* original_flags_;
- absl::optional<PaintFlags> modified_flags_;
- absl::optional<DecodeStashingImageProvider> decode_stashing_image_provider_;
+ std::optional<PaintFlags> modified_flags_;
+ std::optional<DecodeStashingImageProvider> decode_stashing_image_provider_;
bool decode_failed_ = false;
};
diff --git a/cc/paint/skia_paint_canvas.cc b/cc/paint/skia_paint_canvas.cc
index 94945f5..6286f7b 100644
--- a/cc/paint/skia_paint_canvas.cc
+++ b/cc/paint/skia_paint_canvas.cc
@@ -279,7 +279,7 @@
const SkSamplingOptions& sampling,
const PaintFlags* flags) {
DCHECK(!image.IsPaintWorklet());
- absl::optional<ScopedRasterFlags> scoped_flags;
+ std::optional<ScopedRasterFlags> scoped_flags;
if (flags) {
scoped_flags.emplace(flags, image_provider_, canvas_->getTotalMatrix(),
GetMaxTextureSize(), 1.0f);
@@ -300,7 +300,7 @@
const SkSamplingOptions& sampling,
const PaintFlags* flags,
SkCanvas::SrcRectConstraint constraint) {
- absl::optional<ScopedRasterFlags> scoped_flags;
+ std::optional<ScopedRasterFlags> scoped_flags;
if (flags) {
scoped_flags.emplace(flags, image_provider_, canvas_->getTotalMatrix(),
GetMaxTextureSize(), 1.0f);
diff --git a/cc/paint/skottie_frame_data_provider.h b/cc/paint/skottie_frame_data_provider.h
index 2a49a88..d9d1d6a 100644
--- a/cc/paint/skottie_frame_data_provider.h
+++ b/cc/paint/skottie_frame_data_provider.h
@@ -5,13 +5,13 @@
#ifndef CC_PAINT_SKOTTIE_FRAME_DATA_PROVIDER_H_
#define CC_PAINT_SKOTTIE_FRAME_DATA_PROVIDER_H_
+#include <optional>
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_refptr.h"
#include "base/strings/string_piece.h"
#include "cc/paint/paint_export.h"
#include "cc/paint/skottie_frame_data.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
namespace cc {
@@ -66,7 +66,7 @@
virtual scoped_refptr<ImageAsset> LoadImageAsset(
base::StringPiece resource_id,
const base::FilePath& resource_path,
- const absl::optional<gfx::Size>& size) = 0;
+ const std::optional<gfx::Size>& size) = 0;
};
} // namespace cc
diff --git a/cc/paint/skottie_mru_resource_provider.cc b/cc/paint/skottie_mru_resource_provider.cc
index 8840193..950b454 100644
--- a/cc/paint/skottie_mru_resource_provider.cc
+++ b/cc/paint/skottie_mru_resource_provider.cc
@@ -7,12 +7,12 @@
#include <string>
#include <utility>
+#include <optional>
#include "base/check.h"
#include "base/json/json_reader.h"
#include "base/logging.h"
#include "base/strings/string_piece.h"
#include "base/values.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkRefCnt.h"
@@ -30,7 +30,7 @@
base::StringPiece animation_json) {
base::flat_map<std::string, gfx::Size> image_asset_sizes;
- absl::optional<base::Value> animation_dict =
+ std::optional<base::Value> animation_dict =
base::JSONReader::Read(animation_json);
if (!animation_dict || !animation_dict->is_dict()) {
LOG(ERROR) << "Failed to parse Lottie animation json";
@@ -52,8 +52,8 @@
const base::Value::Dict& asset_dict = asset.GetDict();
const std::string* id = asset_dict.FindString(kIdKey);
- absl::optional<int> width = asset_dict.FindInt(kWidthKey);
- absl::optional<int> height = asset_dict.FindInt(kHeightKey);
+ std::optional<int> width = asset_dict.FindInt(kWidthKey);
+ std::optional<int> height = asset_dict.FindInt(kHeightKey);
if (id && width && height && *width > 0 && *height > 0 &&
!image_asset_sizes.emplace(*id, gfx::Size(*width, *height)).second) {
LOG(WARNING) << "Multiple assets found in animation with id " << *id;
@@ -116,7 +116,7 @@
const char resource_name[],
const char resource_id[]) const {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- absl::optional<gfx::Size> size;
+ std::optional<gfx::Size> size;
if (image_asset_sizes_.contains(resource_id))
size.emplace(image_asset_sizes_.at(resource_id));
diff --git a/cc/paint/skottie_mru_resource_provider_unittest.cc b/cc/paint/skottie_mru_resource_provider_unittest.cc
index c6d7638b..1c71e6f8 100644
--- a/cc/paint/skottie_mru_resource_provider_unittest.cc
+++ b/cc/paint/skottie_mru_resource_provider_unittest.cc
@@ -6,6 +6,7 @@
#include <utility>
+#include <optional>
#include "base/containers/flat_map.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
@@ -17,7 +18,6 @@
#include "cc/test/skia_common.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkRefCnt.h"
#include "third_party/skia/modules/skresources/include/SkResources.h"
#include "ui/gfx/geometry/size.h"
@@ -189,7 +189,7 @@
FieldsAre(base::FilePath(FILE_PATH_LITERAL(
"test-resource-path/test-resource-name"))
.NormalizePathSeparators(),
- Eq(absl::nullopt)))));
+ Eq(std::nullopt)))));
}
TEST_F(SkottieMRUResourceProviderTest, HandlesIncompleteDimensions) {
@@ -210,7 +210,7 @@
FieldsAre(base::FilePath(FILE_PATH_LITERAL(
"test-resource-path/test-resource-name"))
.NormalizePathSeparators(),
- Eq(absl::nullopt)))));
+ Eq(std::nullopt)))));
Init(R"({
"assets": [
@@ -229,7 +229,7 @@
FieldsAre(base::FilePath(FILE_PATH_LITERAL(
"test-resource-path/test-resource-name"))
.NormalizePathSeparators(),
- Eq(absl::nullopt)))));
+ Eq(std::nullopt)))));
}
TEST_F(SkottieMRUResourceProviderTest, HandlesInvalidDimensions) {
@@ -250,7 +250,7 @@
FieldsAre(base::FilePath(FILE_PATH_LITERAL(
"test-resource-path/test-resource-name"))
.NormalizePathSeparators(),
- Eq(absl::nullopt)))));
+ Eq(std::nullopt)))));
Init(R"({
"assets": [
@@ -269,7 +269,7 @@
FieldsAre(base::FilePath(FILE_PATH_LITERAL(
"test-resource-path/test-resource-name"))
.NormalizePathSeparators(),
- Eq(absl::nullopt)))));
+ Eq(std::nullopt)))));
}
TEST_F(SkottieMRUResourceProviderTest, GracefullyHandlesInvalidJson) {
diff --git a/cc/paint/skottie_resource_metadata.cc b/cc/paint/skottie_resource_metadata.cc
index f4eeb8a..03944cd 100644
--- a/cc/paint/skottie_resource_metadata.cc
+++ b/cc/paint/skottie_resource_metadata.cc
@@ -15,7 +15,7 @@
SkottieResourceMetadataMap::ImageAssetMetadata::ImageAssetMetadata(
base::FilePath resource_path_in,
- absl::optional<gfx::Size> size_in)
+ std::optional<gfx::Size> size_in)
: resource_path(std::move(resource_path_in)), size(std::move(size_in)) {}
SkottieResourceMetadataMap::SkottieResourceMetadataMap() = default;
@@ -31,7 +31,7 @@
bool SkottieResourceMetadataMap::RegisterAsset(base::StringPiece resource_path,
base::StringPiece resource_name,
base::StringPiece resource_id,
- absl::optional<gfx::Size> size) {
+ std::optional<gfx::Size> size) {
DCHECK(!size || !size->IsEmpty());
if (resource_id.empty()) {
LOG(ERROR) << "Skottie animation has asset with empty resource_id";
diff --git a/cc/paint/skottie_resource_metadata.h b/cc/paint/skottie_resource_metadata.h
index c81405a..2cb92cb 100644
--- a/cc/paint/skottie_resource_metadata.h
+++ b/cc/paint/skottie_resource_metadata.h
@@ -7,12 +7,12 @@
#include <string>
+#include <optional>
#include "base/containers/flat_map.h"
#include "base/files/file_path.h"
#include "base/strings/string_piece.h"
#include "base/types/id_type.h"
#include "cc/paint/paint_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
namespace cc {
@@ -24,12 +24,12 @@
// Metadata for a single image asset.
struct ImageAssetMetadata {
ImageAssetMetadata(base::FilePath resource_path_in,
- absl::optional<gfx::Size> size_in);
+ std::optional<gfx::Size> size_in);
base::FilePath resource_path;
// May be null if asset's dimensions are not specified in the animation
// file.
- absl::optional<gfx::Size> size;
+ std::optional<gfx::Size> size;
};
using Storage =
@@ -46,7 +46,7 @@
bool RegisterAsset(base::StringPiece resource_path,
base::StringPiece resource_name,
base::StringPiece resource_id,
- absl::optional<gfx::Size> size);
+ std::optional<gfx::Size> size);
const Storage& asset_storage() const { return asset_storage_; }
diff --git a/cc/paint/skottie_resource_metadata_unittest.cc b/cc/paint/skottie_resource_metadata_unittest.cc
index 3597800..4085917 100644
--- a/cc/paint/skottie_resource_metadata_unittest.cc
+++ b/cc/paint/skottie_resource_metadata_unittest.cc
@@ -27,7 +27,7 @@
"test-resource-id-1", gfx::Size(100, 100)));
ASSERT_TRUE(resource_map.RegisterAsset("test-resource-path-2",
"test-resource-name-2",
- "test-resource-id-2", absl::nullopt));
+ "test-resource-id-2", std::nullopt));
EXPECT_THAT(
resource_map.asset_storage(),
UnorderedElementsAre(
@@ -42,7 +42,7 @@
FILE_PATH_LITERAL(
"test-resource-path-2/test-resource-name-2"))
.NormalizePathSeparators(),
- Eq(absl::nullopt)))));
+ Eq(std::nullopt)))));
}
TEST(SkottieResourceMetadataTest,
@@ -50,10 +50,10 @@
SkottieResourceMetadataMap resource_map;
ASSERT_TRUE(resource_map.RegisterAsset("test-resource-path-1",
"test-resource-name-1",
- "test-resource-id-1", absl::nullopt));
+ "test-resource-id-1", std::nullopt));
EXPECT_FALSE(resource_map.RegisterAsset("test-resource-path-2",
"test-resource-name-2",
- "test-resource-id-1", absl::nullopt));
+ "test-resource-id-1", std::nullopt));
}
TEST(SkottieResourceMetadataTest,
@@ -61,7 +61,7 @@
SkottieResourceMetadataMap resource_map;
EXPECT_FALSE(resource_map.RegisterAsset("test-resource-path",
"test-resource-name",
- /*resource_id=*/"", absl::nullopt));
+ /*resource_id=*/"", std::nullopt));
}
TEST(SkottieResourceMetadataTest,
@@ -69,7 +69,7 @@
SkottieResourceMetadataMap resource_map;
EXPECT_FALSE(resource_map.RegisterAsset("test-resource-path",
"/absolute-resource-name",
- /*resource_id=*/"", absl::nullopt));
+ /*resource_id=*/"", std::nullopt));
}
TEST(SkottieResourceMetadataTest, HashSkottieResourceIdReturnsMatchingHashes) {
diff --git a/cc/paint/solid_color_analyzer.cc b/cc/paint/solid_color_analyzer.cc
index e06032d..7170e09 100644
--- a/cc/paint/solid_color_analyzer.cc
+++ b/cc/paint/solid_color_analyzer.cc
@@ -218,7 +218,7 @@
} // namespace
-absl::optional<SkColor4f> SolidColorAnalyzer::DetermineIfSolidColor(
+std::optional<SkColor4f> SolidColorAnalyzer::DetermineIfSolidColor(
const PaintOpBuffer& buffer,
const gfx::Rect& rect,
int max_ops_to_analyze,
@@ -283,11 +283,11 @@
case PaintOpType::kDrawline:
case PaintOpType::kDrawoval:
case PaintOpType::kDrawpath:
- return absl::nullopt;
+ return std::nullopt;
// TODO(vmpstr): Add more tests on exceeding max_ops_to_analyze.
case PaintOpType::kDrawrrect: {
if (++num_draw_ops > max_ops_to_analyze)
- return absl::nullopt;
+ return std::nullopt;
const auto& rrect_op = static_cast<const DrawRRectOp&>(op);
CheckIfSolidShape(canvas, rrect_op.rrect, rrect_op.flags, &is_solid,
&is_transparent, &color);
@@ -305,7 +305,7 @@
// cover the canvas.
// TODO(vmpstr): We could investigate handling these.
case PaintOpType::kClippath:
- return absl::nullopt;
+ return std::nullopt;
case PaintOpType::kCliprrect: {
const auto& rrect_op = static_cast<const ClipRRectOp&>(op);
bool does_cover_canvas =
@@ -313,12 +313,12 @@
// If the clip covers the full canvas, we can treat it as if there's no
// clip at all and continue, otherwise this is no longer a solid color.
if (!does_cover_canvas)
- return absl::nullopt;
+ return std::nullopt;
break;
}
case PaintOpType::kDrawrect: {
if (++num_draw_ops > max_ops_to_analyze)
- return absl::nullopt;
+ return std::nullopt;
const auto& rect_op = static_cast<const DrawRectOp&>(op);
CheckIfSolidShape(canvas, rect_op.rect, rect_op.flags, &is_solid,
&is_transparent, &color);
@@ -326,7 +326,7 @@
}
case PaintOpType::kDrawcolor: {
if (++num_draw_ops > max_ops_to_analyze)
- return absl::nullopt;
+ return std::nullopt;
const auto& color_op = static_cast<const DrawColorOp&>(op);
CheckIfSolidColor(canvas, color_op.color, color_op.mode, &is_solid,
&is_transparent, &color);
@@ -339,7 +339,7 @@
// a rect, this is no longer solid color.
const auto& clip_op = static_cast<const ClipRectOp&>(op);
if (clip_op.op == SkClipOp::kDifference)
- return absl::nullopt;
+ return std::nullopt;
op.Raster(&canvas, params);
break;
}
@@ -369,7 +369,7 @@
return SkColors::kTransparent;
if (is_solid)
return color;
- return absl::nullopt;
+ return std::nullopt;
}
} // namespace cc
diff --git a/cc/paint/solid_color_analyzer.h b/cc/paint/solid_color_analyzer.h
index a43dae0..fd3fb6e 100644
--- a/cc/paint/solid_color_analyzer.h
+++ b/cc/paint/solid_color_analyzer.h
@@ -7,9 +7,9 @@
#include <vector>
+#include <optional>
#include "cc/paint/paint_export.h"
#include "cc/paint/paint_flags.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/geometry/skia_conversions.h"
@@ -20,7 +20,7 @@
public:
SolidColorAnalyzer() = delete;
- static absl::optional<SkColor4f> DetermineIfSolidColor(
+ static std::optional<SkColor4f> DetermineIfSolidColor(
const PaintOpBuffer& buffer,
const gfx::Rect& rect,
int max_ops_to_analyze,
diff --git a/cc/paint/solid_color_analyzer_unittest.cc b/cc/paint/solid_color_analyzer_unittest.cc
index 07bae36..7835518 100644
--- a/cc/paint/solid_color_analyzer_unittest.cc
+++ b/cc/paint/solid_color_analyzer_unittest.cc
@@ -4,13 +4,13 @@
#include "cc/paint/solid_color_analyzer.h"
+#include <optional>
#include "base/memory/ref_counted.h"
#include "build/build_config.h"
#include "cc/paint/display_item_list.h"
#include "cc/paint/paint_filter.h"
#include "cc/paint/record_paint_canvas.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/skia_conversions.h"
namespace cc {
@@ -39,7 +39,7 @@
RecordPaintCanvas canvas_;
private:
- absl::optional<SolidColorAnalyzer> analyzer_;
+ std::optional<SolidColorAnalyzer> analyzer_;
};
TEST_F(SolidColorAnalyzerTest, Empty) {
diff --git a/cc/paint/target_color_params.h b/cc/paint/target_color_params.h
index 8931fa3..5dc4fcd 100644
--- a/cc/paint/target_color_params.h
+++ b/cc/paint/target_color_params.h
@@ -7,8 +7,8 @@
#include <string>
+#include <optional>
#include "cc/paint/paint_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/color_space.h"
#include "ui/gfx/hdr_metadata.h"
diff --git a/cc/raster/categorized_worker_pool.cc b/cc/raster/categorized_worker_pool.cc
index b869938f..8a016a7 100644
--- a/cc/raster/categorized_worker_pool.cc
+++ b/cc/raster/categorized_worker_pool.cc
@@ -515,7 +515,7 @@
void CategorizedWorkerPoolJob::Run(base::span<const TaskCategory> categories,
base::JobDelegate* job_delegate) {
- absl::optional<TaskGraphWorkQueue::PrioritizedTask> prioritized_task;
+ std::optional<TaskGraphWorkQueue::PrioritizedTask> prioritized_task;
while (!job_delegate->ShouldYield()) {
base::JobHandle* job_handle_to_notify = nullptr;
@@ -563,7 +563,7 @@
}
}
-absl::optional<TaskGraphWorkQueue::PrioritizedTask>
+std::optional<TaskGraphWorkQueue::PrioritizedTask>
CategorizedWorkerPoolJob::GetNextTaskToRunWithLockAcquired(
base::span<const TaskCategory> categories) {
lock_.AssertAcquired();
@@ -572,7 +572,7 @@
return work_queue_.GetNextTaskToRun(category);
}
}
- return absl::nullopt;
+ return std::nullopt;
}
void CategorizedWorkerPoolJob::FlushForTesting() {
diff --git a/cc/raster/categorized_worker_pool.h b/cc/raster/categorized_worker_pool.h
index 3334497e..0a19bae 100644
--- a/cc/raster/categorized_worker_pool.h
+++ b/cc/raster/categorized_worker_pool.h
@@ -8,6 +8,7 @@
#include <memory>
#include <vector>
+#include <optional>
#include "base/containers/span.h"
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
@@ -22,7 +23,6 @@
#include "cc/raster/task_category.h"
#include "cc/raster/task_graph_runner.h"
#include "cc/raster/task_graph_work_queue.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace cc {
@@ -209,7 +209,7 @@
private:
~CategorizedWorkerPoolJob() override;
- absl::optional<TaskGraphWorkQueue::PrioritizedTask>
+ std::optional<TaskGraphWorkQueue::PrioritizedTask>
GetNextTaskToRunWithLockAcquired(base::span<const TaskCategory> categories);
base::JobHandle* ScheduleTasksWithLockAcquired(NamespaceToken token,
diff --git a/cc/raster/gpu_raster_buffer_provider.cc b/cc/raster/gpu_raster_buffer_provider.cc
index e79d8b8..4e6ef4f6 100644
--- a/cc/raster/gpu_raster_buffer_provider.cc
+++ b/cc/raster/gpu_raster_buffer_provider.cc
@@ -162,7 +162,7 @@
#if BUILDFLAG(IS_ANDROID)
{
- absl::optional<viz::RasterContextProvider::ScopedRasterContextLock> lock;
+ std::optional<viz::RasterContextProvider::ScopedRasterContextLock> lock;
lock.emplace(worker_context_provider);
auto is_using_vulkan =
worker_context_provider->ContextCapabilities().using_vulkan_context;
@@ -349,7 +349,7 @@
}
{
- absl::optional<base::ElapsedTimer> timer;
+ std::optional<base::ElapsedTimer> timer;
if (measure_raster_metric)
timer.emplace();
RasterizeSource(raster_source, raster_full_rect, playback_rect, transform,
diff --git a/cc/raster/playback_image_provider.cc b/cc/raster/playback_image_provider.cc
index 220ba65..5b6a24fb 100644
--- a/cc/raster/playback_image_provider.cc
+++ b/cc/raster/playback_image_provider.cc
@@ -22,7 +22,7 @@
PlaybackImageProvider::PlaybackImageProvider(
ImageDecodeCache* cache,
const TargetColorParams& target_color_params,
- absl::optional<Settings>&& settings)
+ std::optional<Settings>&& settings)
: cache_(cache),
target_color_params_(target_color_params),
settings_(std::move(settings)) {
diff --git a/cc/raster/playback_image_provider.h b/cc/raster/playback_image_provider.h
index 84c7cb1e..26d6f889 100644
--- a/cc/raster/playback_image_provider.h
+++ b/cc/raster/playback_image_provider.h
@@ -44,7 +44,7 @@
// If no settings are provided, all images are skipped during rasterization.
PlaybackImageProvider(ImageDecodeCache* cache,
const TargetColorParams& target_color_params,
- absl::optional<Settings>&& settings);
+ std::optional<Settings>&& settings);
PlaybackImageProvider(const PlaybackImageProvider&) = delete;
PlaybackImageProvider(PlaybackImageProvider&& other);
~PlaybackImageProvider() override;
@@ -61,7 +61,7 @@
// #union
RAW_PTR_EXCLUSION ImageDecodeCache* cache_;
TargetColorParams target_color_params_;
- absl::optional<Settings> settings_;
+ std::optional<Settings> settings_;
};
} // namespace cc
diff --git a/cc/raster/playback_image_provider_unittest.cc b/cc/raster/playback_image_provider_unittest.cc
index 7d17ce77..0fb3eeb 100644
--- a/cc/raster/playback_image_provider_unittest.cc
+++ b/cc/raster/playback_image_provider_unittest.cc
@@ -75,7 +75,7 @@
TEST(PlaybackImageProviderTest, SkipsAllImages) {
MockDecodeCache cache;
- PlaybackImageProvider provider(&cache, TargetColorParams(), absl::nullopt);
+ PlaybackImageProvider provider(&cache, TargetColorParams(), std::nullopt);
SkIRect rect = SkIRect::MakeWH(10, 10);
SkM44 matrix = SkM44();
@@ -98,7 +98,7 @@
MockDecodeCache cache;
PaintImage skip_image = CreateDiscardablePaintImage(gfx::Size(10, 10));
- absl::optional<PlaybackImageProvider::Settings> settings;
+ std::optional<PlaybackImageProvider::Settings> settings;
settings.emplace();
settings->images_to_skip = {skip_image.stable_id()};
@@ -115,7 +115,7 @@
TEST(PlaybackImageProviderTest, RefAndUnrefDecode) {
MockDecodeCache cache;
- absl::optional<PlaybackImageProvider::Settings> settings;
+ std::optional<PlaybackImageProvider::Settings> settings;
settings.emplace();
PlaybackImageProvider provider(&cache, TargetColorParams(),
std::move(settings));
@@ -143,7 +143,7 @@
base::flat_map<PaintImage::Id, size_t> image_to_frame;
image_to_frame[image.stable_id()] = 1u;
- absl::optional<PlaybackImageProvider::Settings> settings;
+ std::optional<PlaybackImageProvider::Settings> settings;
settings.emplace();
settings->image_to_current_frame_index = image_to_frame;
@@ -163,7 +163,7 @@
TEST(PlaybackImageProviderTest, BitmapImages) {
MockDecodeCache cache;
- absl::optional<PlaybackImageProvider::Settings> settings;
+ std::optional<PlaybackImageProvider::Settings> settings;
settings.emplace();
PlaybackImageProvider provider(&cache, TargetColorParams(),
std::move(settings));
@@ -186,7 +186,7 @@
TEST(PlaybackImageProviderTest, IgnoresImagesNotSupportedByCache) {
MockDecodeCache cache;
cache.set_use_cache_for_draw_image(false);
- absl::optional<PlaybackImageProvider::Settings> settings;
+ std::optional<PlaybackImageProvider::Settings> settings;
settings.emplace();
PlaybackImageProvider provider(&cache, TargetColorParams(),
std::move(settings));
diff --git a/cc/raster/raster_buffer_provider_unittest.cc b/cc/raster/raster_buffer_provider_unittest.cc
index 6e18be8..0c34fe0 100644
--- a/cc/raster/raster_buffer_provider_unittest.cc
+++ b/cc/raster/raster_buffer_provider_unittest.cc
@@ -321,7 +321,7 @@
return;
}
- absl::optional<viz::RasterContextProvider::ScopedRasterContextLock> lock;
+ std::optional<viz::RasterContextProvider::ScopedRasterContextLock> lock;
if (use_lock) {
lock.emplace(context_provider);
}
diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc
index be5f90ca..ea5f62b 100644
--- a/cc/scheduler/scheduler_unittest.cc
+++ b/cc/scheduler/scheduler_unittest.cc
@@ -295,7 +295,7 @@
std::vector<const char*> actions_;
raw_ptr<TestScheduler, DanglingUntriaged> scheduler_ = nullptr;
base::TimeDelta frame_interval_;
- absl::optional<FrameSkippedReason> last_frame_skipped_reason_;
+ std::optional<FrameSkippedReason> last_frame_skipped_reason_;
};
enum BeginFrameSourceType {
@@ -333,7 +333,7 @@
void RunTasksWhile(base::RepeatingCallback<bool()> condition) {
run_condition_ = condition;
FastForwardUntilNoTasksRemain();
- run_condition_ = absl::nullopt;
+ run_condition_ = std::nullopt;
// We've moved all the pending tasks away to break the execution loop,
// now we should restore them.
while (!tasks_to_requeue_.empty()) {
@@ -359,7 +359,7 @@
~SchedulerTestTaskRunner() override = default; // Ref-counted.
size_t task_count_ = 0u;
- absl::optional<base::RepeatingCallback<bool()>> run_condition_;
+ std::optional<base::RepeatingCallback<bool()>> run_condition_;
base::circular_deque<base::TestPendingTask> tasks_to_requeue_;
};
diff --git a/cc/slim/delayer_scheduler_unittest.cc b/cc/slim/delayer_scheduler_unittest.cc
index 945a7df2..3873cb9 100644
--- a/cc/slim/delayer_scheduler_unittest.cc
+++ b/cc/slim/delayer_scheduler_unittest.cc
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <optional>
#include "cc/slim/delayed_scheduler.h"
#include "cc/slim/scheduler.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace cc::slim {
@@ -28,12 +28,12 @@
}
void SetDoBeginFrameResult(bool result) { do_begin_frame_result_ = result; }
- absl::optional<viz::BeginFrameArgs> TakeLastDoBeginFrameArgs() {
+ std::optional<viz::BeginFrameArgs> TakeLastDoBeginFrameArgs() {
auto rv = last_do_begin_frame_args_;
last_do_begin_frame_args_.reset();
return rv;
}
- absl::optional<viz::BeginFrameArgs> TakeLastDidNotProduceFrameArgs() {
+ std::optional<viz::BeginFrameArgs> TakeLastDidNotProduceFrameArgs() {
auto rv = last_did_not_produce_frame_args_;
last_did_not_produce_frame_args_.reset();
return rv;
@@ -41,8 +41,8 @@
private:
const raw_ptr<Scheduler> scheduler_;
- absl::optional<viz::BeginFrameArgs> last_do_begin_frame_args_;
- absl::optional<viz::BeginFrameArgs> last_did_not_produce_frame_args_;
+ std::optional<viz::BeginFrameArgs> last_do_begin_frame_args_;
+ std::optional<viz::BeginFrameArgs> last_did_not_produce_frame_args_;
bool do_begin_frame_result_ = false;
};
diff --git a/cc/slim/frame_data.h b/cc/slim/frame_data.h
index 3c082f46..e7f4981 100644
--- a/cc/slim/frame_data.h
+++ b/cc/slim/frame_data.h
@@ -7,12 +7,12 @@
#include <vector>
+#include <optional>
#include "base/containers/flat_set.h"
#include "base/memory/raw_ref.h"
#include "cc/base/simple_enclosed_region.h"
#include "cc/slim/damage_data.h"
#include "components/viz/common/surfaces/surface_id.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/mask_filter_info.h"
namespace viz {
@@ -32,7 +32,7 @@
const raw_ref<std::vector<viz::HitTestRegion>, ExperimentalAsh>
hit_test_regions;
base::flat_set<viz::SurfaceId> activation_dependencies;
- absl::optional<uint32_t> deadline_in_frames;
+ std::optional<uint32_t> deadline_in_frames;
bool use_default_lower_bound_deadline = false;
// These fields are for a particular render pass (ie target) and the
diff --git a/cc/slim/frame_sink_impl.cc b/cc/slim/frame_sink_impl.cc
index 061337c..d6410b8 100644
--- a/cc/slim/frame_sink_impl.cc
+++ b/cc/slim/frame_sink_impl.cc
@@ -327,7 +327,7 @@
});
frame_sink_->SubmitCompositorFrame(
local_surface_id_, std::move(frame),
- send_new_hit_test_region_list ? hit_test_region_list_ : absl::nullopt,
+ send_new_hit_test_region_list ? hit_test_region_list_ : std::nullopt,
0);
}
num_unacked_frames_++;
diff --git a/cc/slim/frame_sink_impl.h b/cc/slim/frame_sink_impl.h
index dce4a41..c66c727 100644
--- a/cc/slim/frame_sink_impl.h
+++ b/cc/slim/frame_sink_impl.h
@@ -9,6 +9,7 @@
#include <string>
#include <vector>
+#include <optional>
#include "base/component_export.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
@@ -32,7 +33,6 @@
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "services/viz/public/mojom/compositing/compositor_frame_sink.mojom.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace cc::slim {
@@ -146,7 +146,7 @@
UploadedResourceMap uploaded_resources_;
viz::ClientResourceProvider resource_provider_;
// Last `HitTestRegionList` sent to viz.
- absl::optional<viz::HitTestRegionList> hit_test_region_list_;
+ std::optional<viz::HitTestRegionList> hit_test_region_list_;
base::PlatformThreadId io_thread_id_;
viz::LocalSurfaceId last_submitted_local_surface_id_;
diff --git a/cc/slim/layer.cc b/cc/slim/layer.cc
index c95d221..50c2fd8 100644
--- a/cc/slim/layer.cc
+++ b/cc/slim/layer.cc
@@ -466,12 +466,12 @@
return transform;
}
-absl::optional<gfx::Transform> Layer::ComputeTransformFromParent() const {
+std::optional<gfx::Transform> Layer::ComputeTransformFromParent() const {
// TODO(crbug.com/1408128): Consider caching this result since GetInverse
// may be expensive.
gfx::Transform inverse_transform;
if (!transform_.GetInverse(&inverse_transform)) {
- return absl::nullopt;
+ return std::nullopt;
}
// TransformFromParent is:
// transform_origin x inverse_transform x -transform_origin x -position
@@ -528,7 +528,7 @@
render_pass.CreateAndAppendSharedQuadState();
const gfx::Rect layer_rect{bounds()};
DCHECK(layer_rect.Contains(visible_rect));
- absl::optional<gfx::Rect> clip_opt;
+ std::optional<gfx::Rect> clip_opt;
if (clip_in_target) {
clip_opt = *clip_in_target;
}
diff --git a/cc/slim/layer.h b/cc/slim/layer.h
index ec4bff3..5b6a582 100644
--- a/cc/slim/layer.h
+++ b/cc/slim/layer.h
@@ -7,6 +7,7 @@
#include <vector>
+#include <optional>
#include "base/component_export.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
@@ -14,7 +15,6 @@
#include "cc/paint/filter_operations.h"
#include "cc/slim/filter.h"
#include "cc/slim/frame_data.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/geometry/linear_gradient.h"
#include "ui/gfx/geometry/point3_f.h"
@@ -224,7 +224,7 @@
// Called by LayerTree.
gfx::Transform ComputeTransformToParent() const;
- absl::optional<gfx::Transform> ComputeTransformFromParent() const;
+ std::optional<gfx::Transform> ComputeTransformFromParent() const;
bool HasFilters() const;
cc::FilterOperations GetFilters() const;
bool HasNonTrivialMaskFilterInfo() const;
diff --git a/cc/slim/layer_tree_cc_wrapper.h b/cc/slim/layer_tree_cc_wrapper.h
index 7bada0b..85809c3 100644
--- a/cc/slim/layer_tree_cc_wrapper.h
+++ b/cc/slim/layer_tree_cc_wrapper.h
@@ -67,7 +67,7 @@
void OnDeferCommitsChanged(
bool,
cc::PaintHoldingReason,
- absl::optional<cc::PaintHoldingCommitTrigger>) override {}
+ std::optional<cc::PaintHoldingCommitTrigger>) override {}
void OnCommitRequested() override {}
void BeginMainFrameNotExpectedSoon() override {}
void BeginMainFrameNotExpectedUntil(base::TimeTicks time) override {}
diff --git a/cc/slim/layer_tree_impl.cc b/cc/slim/layer_tree_impl.cc
index f25cbea..a92f80e 100644
--- a/cc/slim/layer_tree_impl.cc
+++ b/cc/slim/layer_tree_impl.cc
@@ -516,7 +516,7 @@
background_opaque && unoccluded_region.GetRegionComplexity() <= 1;
quad_state->SetAll(gfx::Transform(), gutter_bounding_rect,
gutter_bounding_rect, gfx::MaskFilterInfo(),
- /*clip=*/absl::nullopt, contents_opaque,
+ /*clip=*/std::nullopt, contents_opaque,
/*opacity_f=*/1.0f, SkBlendMode::kSrcOver,
/*sorting_context=*/0, /*layer_id=*/0u,
/*fast_rounded_corner=*/false);
@@ -573,7 +573,7 @@
return;
}
- absl::optional<gfx::Transform> transform_from_parent =
+ std::optional<gfx::Transform> transform_from_parent =
layer.ComputeTransformFromParent();
// If a 2d transform isn't invertible, then it must map the whole 2d space to
// a single line or pointer, neither is visible.
@@ -747,7 +747,7 @@
// Any clip introduced by this layer is already applied by the bounds of the
// new pass, so only need to apply any clips in parents target that came
// from parent.
- absl::optional<gfx::Rect> clip_opt;
+ std::optional<gfx::Rect> clip_opt;
if (parent_clip_in_target) {
clip_opt = gfx::ToEnclosingRect(*parent_clip_in_target);
}
@@ -799,7 +799,7 @@
const bool subtree_property_changed =
layer.GetAndResetSubtreePropertyChanged() ||
data.subtree_property_changed_from_parent;
- absl::optional<base::AutoReset<gfx::MaskFilterInfo>>
+ std::optional<base::AutoReset<gfx::MaskFilterInfo>>
auto_reset_mask_filter_info;
if (layer.HasNonTrivialMaskFilterInfo()) {
gfx::MaskFilterInfo info(gfx::RRectF(gfx::RectF(gfx::Rect(layer.bounds())),
diff --git a/cc/slim/layer_tree_impl.h b/cc/slim/layer_tree_impl.h
index 79b6b84..42f393b 100644
--- a/cc/slim/layer_tree_impl.h
+++ b/cc/slim/layer_tree_impl.h
@@ -11,6 +11,7 @@
#include <utility>
#include <vector>
+#include <optional>
#include "base/component_export.h"
#include "base/containers/circular_deque.h"
#include "base/functional/callback.h"
@@ -26,7 +27,6 @@
#include "components/viz/common/surfaces/child_local_surface_id_allocator.h"
#include "components/viz/common/surfaces/local_surface_id.h"
#include "components/viz/common/surfaces/surface_range.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rect_f.h"
@@ -212,7 +212,7 @@
gfx::Rect device_viewport_rect_;
float device_scale_factor_ = 1.0f;
SkColor4f background_color_ = SkColors::kWhite;
- absl::optional<float> top_controls_visible_height_;
+ std::optional<float> top_controls_visible_height_;
SurfaceRangesAndCounts referenced_surfaces_;
viz::FrameTokenGenerator next_frame_token_;
gfx::OverlayTransform display_transform_hint_ = gfx::OVERLAY_TRANSFORM_NONE;
diff --git a/cc/slim/slim_layer_tree_compositor_frame_unittest.cc b/cc/slim/slim_layer_tree_compositor_frame_unittest.cc
index 0759032..749b0fd 100644
--- a/cc/slim/slim_layer_tree_compositor_frame_unittest.cc
+++ b/cc/slim/slim_layer_tree_compositor_frame_unittest.cc
@@ -77,7 +77,7 @@
}
viz::CompositorFrame ProduceFrame(
- absl::optional<viz::HitTestRegionList>* out_list = nullptr) {
+ std::optional<viz::HitTestRegionList>* out_list = nullptr) {
layer_tree_->SetNeedsRedraw();
EXPECT_TRUE(layer_tree_->NeedsBeginFrames());
base::TimeTicks frame_time = base::TimeTicks::Now();
@@ -147,7 +147,7 @@
EXPECT_EQ(1.0f, metadata.device_scale_factor);
EXPECT_EQ(SkColors::kWhite, metadata.root_background_color);
EXPECT_EQ(gfx::OVERLAY_TRANSFORM_NONE, metadata.display_transform_hint);
- EXPECT_EQ(absl::nullopt, metadata.top_controls_visible_height);
+ EXPECT_EQ(std::nullopt, metadata.top_controls_visible_height);
}
IncrementLocalSurfaceId();
@@ -194,7 +194,7 @@
EXPECT_EQ(shared_quad_state->quad_layer_rect, viewport_);
EXPECT_EQ(shared_quad_state->visible_quad_layer_rect, viewport_);
- EXPECT_EQ(shared_quad_state->clip_rect, absl::nullopt);
+ EXPECT_EQ(shared_quad_state->clip_rect, std::nullopt);
EXPECT_EQ(shared_quad_state->are_contents_opaque, true);
EXPECT_EQ(shared_quad_state->blend_mode, SkBlendMode::kSrcOver);
}
@@ -344,8 +344,8 @@
CreateSolidColorLayer(viewport_.size(), SkColors::kGray);
layer_tree_->SetRoot(solid_color_layer);
- absl::optional<gfx::PresentationFeedback> feedback_opt_1;
- absl::optional<gfx::PresentationFeedback> feedback_opt_2;
+ std::optional<gfx::PresentationFeedback> feedback_opt_1;
+ std::optional<gfx::PresentationFeedback> feedback_opt_2;
layer_tree_->RequestPresentationTimeForNextFrame(base::BindLambdaForTesting(
[&](const gfx::PresentationFeedback& feedback) {
feedback_opt_1 = feedback;
@@ -373,14 +373,14 @@
CreateSolidColorLayer(viewport_.size(), SkColors::kGray);
layer_tree_->SetRoot(solid_color_layer);
- absl::optional<gfx::PresentationFeedback> feedback_opt_1;
+ std::optional<gfx::PresentationFeedback> feedback_opt_1;
layer_tree_->RequestPresentationTimeForNextFrame(base::BindLambdaForTesting(
[&](const gfx::PresentationFeedback& feedback) {
feedback_opt_1 = feedback;
}));
viz::CompositorFrame frame1 = ProduceFrame();
- absl::optional<gfx::PresentationFeedback> feedback_opt_2;
+ std::optional<gfx::PresentationFeedback> feedback_opt_2;
layer_tree_->RequestPresentationTimeForNextFrame(base::BindLambdaForTesting(
[&](const gfx::PresentationFeedback& feedback) {
feedback_opt_2 = feedback;
@@ -421,8 +421,8 @@
CreateSolidColorLayer(viewport_.size(), SkColors::kGray);
layer_tree_->SetRoot(solid_color_layer);
- absl::optional<base::TimeTicks> feedback_time_opt_1;
- absl::optional<base::TimeTicks> feedback_time_opt_2;
+ std::optional<base::TimeTicks> feedback_time_opt_1;
+ std::optional<base::TimeTicks> feedback_time_opt_2;
layer_tree_->RequestSuccessfulPresentationTimeForNextFrame(
base::BindLambdaForTesting(
[&](base::TimeTicks timeticks) { feedback_time_opt_1 = timeticks; }));
@@ -451,14 +451,14 @@
CreateSolidColorLayer(viewport_.size(), SkColors::kGray);
layer_tree_->SetRoot(solid_color_layer);
- absl::optional<base::TimeTicks> feedback_time_opt_1;
+ std::optional<base::TimeTicks> feedback_time_opt_1;
layer_tree_->RequestSuccessfulPresentationTimeForNextFrame(
base::BindLambdaForTesting(
[&](base::TimeTicks timeticks) { feedback_time_opt_1 = timeticks; }));
viz::CompositorFrame frame1 = ProduceFrame();
viz::CompositorFrame frame2 = ProduceFrame();
- absl::optional<base::TimeTicks> feedback_time_opt_2;
+ std::optional<base::TimeTicks> feedback_time_opt_2;
layer_tree_->RequestSuccessfulPresentationTimeForNextFrame(
base::BindLambdaForTesting(
[&](base::TimeTicks timeticks) { feedback_time_opt_2 = timeticks; }));
@@ -879,7 +879,7 @@
cc::DeadlinePolicy::UseDefaultDeadline();
surface_layer->SetSurfaceId(surface_id, deadline_policy);
- absl::optional<viz::HitTestRegionList> hit_test_region_list;
+ std::optional<viz::HitTestRegionList> hit_test_region_list;
viz::CompositorFrame frame = ProduceFrame(&hit_test_region_list);
ASSERT_TRUE(hit_test_region_list);
EXPECT_EQ(hit_test_region_list->bounds, viewport_);
@@ -908,7 +908,7 @@
child_surface_layer->SetSurfaceId(surface_id, deadline_policy);
{
- absl::optional<viz::HitTestRegionList> hit_test_region_list;
+ std::optional<viz::HitTestRegionList> hit_test_region_list;
viz::CompositorFrame frame = ProduceFrame(&hit_test_region_list);
ASSERT_TRUE(hit_test_region_list);
@@ -962,7 +962,7 @@
filter_layer->AddChild(surface_layer);
{
- absl::optional<viz::HitTestRegionList> hit_test_region_list;
+ std::optional<viz::HitTestRegionList> hit_test_region_list;
viz::CompositorFrame frame = ProduceFrame(&hit_test_region_list);
ASSERT_TRUE(hit_test_region_list);
EXPECT_EQ(hit_test_region_list->bounds, viewport_);
@@ -1105,7 +1105,7 @@
auto* shared_quad_state = render_pass_quad->shared_quad_state;
EXPECT_EQ(shared_quad_state->quad_layer_rect, gfx::Rect(50, 50));
EXPECT_EQ(shared_quad_state->visible_quad_layer_rect, gfx::Rect(50, 50));
- EXPECT_EQ(shared_quad_state->clip_rect, absl::nullopt);
+ EXPECT_EQ(shared_quad_state->clip_rect, std::nullopt);
}
TEST_F(SlimLayerTreeCompositorFrameTest, ChildPassOutputRect) {
@@ -1174,7 +1174,7 @@
EXPECT_EQ(shared_quad_state->quad_layer_rect, gfx::Rect(20, 20, 30, 30));
EXPECT_EQ(shared_quad_state->visible_quad_layer_rect,
gfx::Rect(20, 20, 30, 30));
- EXPECT_EQ(shared_quad_state->clip_rect, absl::nullopt);
+ EXPECT_EQ(shared_quad_state->clip_rect, std::nullopt);
}
}
@@ -1239,7 +1239,7 @@
auto* shared_quad_state = render_pass_quad->shared_quad_state;
EXPECT_EQ(shared_quad_state->quad_layer_rect, gfx::Rect(40, 40));
EXPECT_EQ(shared_quad_state->visible_quad_layer_rect, gfx::Rect(40, 40));
- EXPECT_EQ(shared_quad_state->clip_rect, absl::nullopt);
+ EXPECT_EQ(shared_quad_state->clip_rect, std::nullopt);
}
}
diff --git a/cc/slim/slim_layer_unittest.cc b/cc/slim/slim_layer_unittest.cc
index 16be087..6e78d70 100644
--- a/cc/slim/slim_layer_unittest.cc
+++ b/cc/slim/slim_layer_unittest.cc
@@ -199,7 +199,7 @@
viz::SurfaceId end(viz::FrameSinkId(1u, 2u),
viz::LocalSurfaceId(5u, 6u, token));
- EXPECT_EQ(layer->oldest_acceptable_fallback(), absl::nullopt);
+ EXPECT_EQ(layer->oldest_acceptable_fallback(), std::nullopt);
layer->SetOldestAcceptableFallback(start);
EXPECT_EQ(layer->oldest_acceptable_fallback(), start);
layer->SetSurfaceId(end, cc::DeadlinePolicy::UseDefaultDeadline());
diff --git a/cc/slim/surface_layer.cc b/cc/slim/surface_layer.cc
index b6ac050..96cc1f9 100644
--- a/cc/slim/surface_layer.cc
+++ b/cc/slim/surface_layer.cc
@@ -104,12 +104,12 @@
}
SetSurfaceRange(viz::SurfaceRange(
- surface_id.is_valid() ? absl::optional<viz::SurfaceId>(surface_id)
- : absl::nullopt,
+ surface_id.is_valid() ? std::optional<viz::SurfaceId>(surface_id)
+ : std::nullopt,
surface_range_.end()));
}
-const absl::optional<viz::SurfaceId>& SurfaceLayer::oldest_acceptable_fallback()
+const std::optional<viz::SurfaceId>& SurfaceLayer::oldest_acceptable_fallback()
const {
return cc_layer() ? cc_layer()->oldest_acceptable_fallback()
: surface_range_.start();
diff --git a/cc/slim/surface_layer.h b/cc/slim/surface_layer.h
index 69ae6eb..17c5839 100644
--- a/cc/slim/surface_layer.h
+++ b/cc/slim/surface_layer.h
@@ -5,12 +5,12 @@
#ifndef CC_SLIM_SURFACE_LAYER_H_
#define CC_SLIM_SURFACE_LAYER_H_
+#include <optional>
#include "base/component_export.h"
#include "cc/layers/deadline_policy.h"
#include "cc/slim/layer.h"
#include "components/viz/common/surfaces/surface_id.h"
#include "components/viz/common/surfaces/surface_range.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace cc {
class SurfaceLayer;
@@ -42,7 +42,7 @@
// surface being embedded isn't ready to be drawn yet (before first frame is
// submitted).
void SetOldestAcceptableFallback(const viz::SurfaceId& surface_id);
- const absl::optional<viz::SurfaceId>& oldest_acceptable_fallback() const;
+ const std::optional<viz::SurfaceId>& oldest_acceptable_fallback() const;
void SetLayerTree(LayerTree* layer_tree) override;
@@ -64,7 +64,7 @@
bool stretch_content_to_fill_bounds_ = false;
viz::SurfaceRange surface_range_;
- absl::optional<uint32_t> deadline_in_frames_;
+ std::optional<uint32_t> deadline_in_frames_;
};
} // namespace cc::slim
diff --git a/cc/slim/test_frame_sink_impl.cc b/cc/slim/test_frame_sink_impl.cc
index a36d405..f1a82c7 100644
--- a/cc/slim/test_frame_sink_impl.cc
+++ b/cc/slim/test_frame_sink_impl.cc
@@ -32,7 +32,7 @@
void SubmitCompositorFrame(
const viz::LocalSurfaceId& local_surface_id,
viz::CompositorFrame frame,
- absl::optional<::viz::HitTestRegionList> hit_test_region_list,
+ std::optional<::viz::HitTestRegionList> hit_test_region_list,
uint64_t submit_time) override {
did_submit_ = true;
last_frame_ = std::move(frame);
@@ -41,7 +41,7 @@
void SubmitCompositorFrameSync(
const viz::LocalSurfaceId& local_surface_id,
viz::CompositorFrame frame,
- absl::optional<::viz::HitTestRegionList> hit_test_region_list,
+ std::optional<::viz::HitTestRegionList> hit_test_region_list,
uint64_t submit_time,
SubmitCompositorFrameSyncCallback callback) override {}
void DidNotProduceFrame(const viz::BeginFrameAck& ack) override {
@@ -58,7 +58,7 @@
#endif
viz::CompositorFrame TakeLastFrame() { return std::move(last_frame_); }
- const absl::optional<::viz::HitTestRegionList>& hit_test_region_list() const {
+ const std::optional<::viz::HitTestRegionList>& hit_test_region_list() const {
return hit_test_region_list_;
}
@@ -76,7 +76,7 @@
private:
viz::CompositorFrame last_frame_;
- absl::optional<::viz::HitTestRegionList> hit_test_region_list_;
+ std::optional<::viz::HitTestRegionList> hit_test_region_list_;
bool did_submit_ = false;
bool did_not_produce_frame_ = false;
};
@@ -126,7 +126,7 @@
return mojo_sink_->TakeLastFrame();
}
-const absl::optional<::viz::HitTestRegionList>&
+const std::optional<::viz::HitTestRegionList>&
TestFrameSinkImpl::GetLastHitTestRegionList() const {
return mojo_sink_->hit_test_region_list();
}
diff --git a/cc/slim/test_frame_sink_impl.h b/cc/slim/test_frame_sink_impl.h
index e0bb9419..de3ff3e3 100644
--- a/cc/slim/test_frame_sink_impl.h
+++ b/cc/slim/test_frame_sink_impl.h
@@ -27,7 +27,7 @@
bool GetDidSubmitAndReset();
bool GetDidNotProduceFrameAndReset();
viz::CompositorFrame TakeLastFrame();
- const absl::optional<::viz::HitTestRegionList>& GetLastHitTestRegionList()
+ const std::optional<::viz::HitTestRegionList>& GetLastHitTestRegionList()
const;
bool bind_to_client_called() const { return bind_to_client_called_; }
bool needs_begin_frames() const { return needs_begin_frames_; }
diff --git a/cc/test/animation_test_common.cc b/cc/test/animation_test_common.cc
index 0d21f2e..239fd5e 100644
--- a/cc/test/animation_test_common.cc
+++ b/cc/test/animation_test_common.cc
@@ -291,7 +291,7 @@
float start_opacity,
float end_opacity,
bool use_timing_function,
- absl::optional<int> id) {
+ std::optional<int> id) {
return AddOpacityTransition(
animation, duration, start_opacity, end_opacity, use_timing_function,
id ? *id : AnimationIdProvider::NextKeyframeModelId());
diff --git a/cc/test/animation_test_common.h b/cc/test/animation_test_common.h
index 7b69a5f..e526326 100644
--- a/cc/test/animation_test_common.h
+++ b/cc/test/animation_test_common.h
@@ -91,7 +91,7 @@
float start_opacity,
float end_opacity,
bool use_timing_function,
- absl::optional<int> id = absl::nullopt);
+ std::optional<int> id = std::nullopt);
int AddAnimatedFilterToAnimation(Animation* animation,
double duration,
diff --git a/cc/test/animation_timelines_test_common.cc b/cc/test/animation_timelines_test_common.cc
index 1e0dd228..bc014c1 100644
--- a/cc/test/animation_timelines_test_common.cc
+++ b/cc/test/animation_timelines_test_common.cc
@@ -413,7 +413,7 @@
}
void TestAnimationDelegate::NotifyLocalTimeUpdated(
- absl::optional<base::TimeDelta> local_time) {}
+ std::optional<base::TimeDelta> local_time) {}
AnimationTimelinesTest::AnimationTimelinesTest()
: client_(ThreadInstance::kMain),
diff --git a/cc/test/animation_timelines_test_common.h b/cc/test/animation_timelines_test_common.h
index e160a3fc..010fa97f 100644
--- a/cc/test/animation_timelines_test_common.h
+++ b/cc/test/animation_timelines_test_common.h
@@ -258,7 +258,7 @@
base::TimeTicks animation_start_time,
std::unique_ptr<gfx::AnimationCurve> curve) override;
void NotifyLocalTimeUpdated(
- absl::optional<base::TimeDelta> local_time) override;
+ std::optional<base::TimeDelta> local_time) override;
bool started() { return started_; }
diff --git a/cc/test/fake_layer_tree_frame_sink_client.cc b/cc/test/fake_layer_tree_frame_sink_client.cc
index 382c6694..a102333 100644
--- a/cc/test/fake_layer_tree_frame_sink_client.cc
+++ b/cc/test/fake_layer_tree_frame_sink_client.cc
@@ -17,7 +17,7 @@
begin_frame_source_ = source;
}
-absl::optional<viz::HitTestRegionList>
+std::optional<viz::HitTestRegionList>
FakeLayerTreeFrameSinkClient::BuildHitTestData() {
return hit_test_region_list_;
}
diff --git a/cc/test/fake_layer_tree_frame_sink_client.h b/cc/test/fake_layer_tree_frame_sink_client.h
index 0f16a23..4ddaaea 100644
--- a/cc/test/fake_layer_tree_frame_sink_client.h
+++ b/cc/test/fake_layer_tree_frame_sink_client.h
@@ -24,7 +24,7 @@
~FakeLayerTreeFrameSinkClient() override;
void SetBeginFrameSource(viz::BeginFrameSource* source) override;
- absl::optional<viz::HitTestRegionList> BuildHitTestData() override;
+ std::optional<viz::HitTestRegionList> BuildHitTestData() override;
void DidReceiveCompositorFrameAck() override;
void DidPresentCompositorFrame(
uint32_t frame_token,
@@ -55,7 +55,7 @@
}
void set_hit_test_region_list(
- const absl::optional<viz::HitTestRegionList>& hit_test_region_list) {
+ const std::optional<viz::HitTestRegionList>& hit_test_region_list) {
hit_test_region_list_ = hit_test_region_list;
}
@@ -64,7 +64,7 @@
bool did_lose_layer_tree_frame_sink_called_ = false;
ManagedMemoryPolicy memory_policy_{0};
raw_ptr<viz::BeginFrameSource> begin_frame_source_;
- absl::optional<viz::HitTestRegionList> hit_test_region_list_;
+ std::optional<viz::HitTestRegionList> hit_test_region_list_;
};
} // namespace cc
diff --git a/cc/test/fake_layer_tree_host_impl.h b/cc/test/fake_layer_tree_host_impl.h
index 3846dd97..aa4262f 100644
--- a/cc/test/fake_layer_tree_host_impl.h
+++ b/cc/test/fake_layer_tree_host_impl.h
@@ -60,7 +60,7 @@
notify_tile_state_changed_called_ = called;
}
void set_target_color_params(
- absl::optional<TargetColorParams> target_color_params) {
+ std::optional<TargetColorParams> target_color_params) {
target_color_params_ = target_color_params;
}
@@ -72,7 +72,7 @@
FakeLayerTreeHostImplClient client_;
FakeRenderingStatsInstrumentation stats_instrumentation_;
bool notify_tile_state_changed_called_;
- absl::optional<TargetColorParams> target_color_params_;
+ std::optional<TargetColorParams> target_color_params_;
};
} // namespace cc
diff --git a/cc/test/layer_tree_json_parser.cc b/cc/test/layer_tree_json_parser.cc
index d380e8b..90e832f 100644
--- a/cc/test/layer_tree_json_parser.cc
+++ b/cc/test/layer_tree_json_parser.cc
@@ -38,16 +38,16 @@
if (bounds_list->size() < 2)
return nullptr;
- absl::optional<int> width = (*bounds_list)[0].GetIfInt();
- absl::optional<int> height = (*bounds_list)[1].GetIfInt();
+ std::optional<int> width = (*bounds_list)[0].GetIfInt();
+ std::optional<int> height = (*bounds_list)[1].GetIfInt();
if (!width.has_value() || !height.has_value())
return nullptr;
- absl::optional<bool> draws_content = dict.FindBool("DrawsContent");
+ std::optional<bool> draws_content = dict.FindBool("DrawsContent");
if (!draws_content.has_value())
return nullptr;
- absl::optional<bool> hit_testable = dict.FindBool("HitTestable");
+ std::optional<bool> hit_testable = dict.FindBool("HitTestable");
// If we cannot load hit_testable, we may try loading the old version, since
// we do not record |hit_testable_without_draws_content| in the past, we use
// |draws_content| as the value of |hit_testable|.
@@ -65,10 +65,10 @@
if (aperture_list->size() < 4)
return nullptr;
- absl::optional<int> aperture_x = (*aperture_list)[0].GetIfInt();
- absl::optional<int> aperture_y = (*aperture_list)[1].GetIfInt();
- absl::optional<int> aperture_width = (*aperture_list)[2].GetIfInt();
- absl::optional<int> aperture_height = (*aperture_list)[3].GetIfInt();
+ std::optional<int> aperture_x = (*aperture_list)[0].GetIfInt();
+ std::optional<int> aperture_y = (*aperture_list)[1].GetIfInt();
+ std::optional<int> aperture_width = (*aperture_list)[2].GetIfInt();
+ std::optional<int> aperture_height = (*aperture_list)[3].GetIfInt();
if (!(aperture_x.has_value() && aperture_y.has_value() &&
aperture_width.has_value() && aperture_height.has_value()))
return nullptr;
@@ -79,8 +79,8 @@
if (image_bounds_list->size() < 2)
return nullptr;
- absl::optional<double> image_width = (*image_bounds_list)[0].GetIfDouble();
- absl::optional<double> image_height = (*image_bounds_list)[1].GetIfDouble();
+ std::optional<double> image_width = (*image_bounds_list)[0].GetIfDouble();
+ std::optional<double> image_height = (*image_bounds_list)[1].GetIfDouble();
if (!(image_width.has_value() && image_height.has_value()))
return nullptr;
@@ -90,16 +90,16 @@
if (border_list->size() < 4)
return nullptr;
- absl::optional<int> border_x = (*border_list)[0].GetIfInt();
- absl::optional<int> border_y = (*border_list)[1].GetIfInt();
- absl::optional<int> border_width = (*border_list)[2].GetIfInt();
- absl::optional<int> border_height = (*border_list)[3].GetIfInt();
+ std::optional<int> border_x = (*border_list)[0].GetIfInt();
+ std::optional<int> border_y = (*border_list)[1].GetIfInt();
+ std::optional<int> border_width = (*border_list)[2].GetIfInt();
+ std::optional<int> border_height = (*border_list)[3].GetIfInt();
if (!(border_x.has_value() && border_y.has_value() &&
border_width.has_value() && border_height.has_value()))
return nullptr;
- absl::optional<bool> fill_center = dict.FindBool("FillCenter");
+ std::optional<bool> fill_center = dict.FindBool("FillCenter");
if (!fill_center.has_value())
return nullptr;
@@ -127,11 +127,11 @@
new_layer->SetIsDrawable(*draws_content);
new_layer->SetHitTestable(*hit_testable);
- absl::optional<double> opacity = dict.FindDouble("Opacity");
+ std::optional<double> opacity = dict.FindDouble("Opacity");
if (opacity.has_value())
new_layer->SetOpacity(*opacity);
- absl::optional<bool> contents_opaque = dict.FindBool("ContentsOpaque");
+ std::optional<bool> contents_opaque = dict.FindBool("ContentsOpaque");
if (contents_opaque.has_value())
new_layer->SetContentsOpaque(*contents_opaque);
@@ -140,10 +140,10 @@
if (touch_region_list) {
TouchActionRegion touch_action_region;
for (size_t i = 0; i + 3 < touch_region_list->size(); i += 4) {
- absl::optional<int> rect_x = (*touch_region_list)[i + 0].GetIfInt();
- absl::optional<int> rect_y = (*touch_region_list)[i + 1].GetIfInt();
- absl::optional<int> rect_width = (*touch_region_list)[i + 2].GetIfInt();
- absl::optional<int> rect_height = (*touch_region_list)[i + 3].GetIfInt();
+ std::optional<int> rect_x = (*touch_region_list)[i + 0].GetIfInt();
+ std::optional<int> rect_y = (*touch_region_list)[i + 1].GetIfInt();
+ std::optional<int> rect_width = (*touch_region_list)[i + 2].GetIfInt();
+ std::optional<int> rect_height = (*touch_region_list)[i + 3].GetIfInt();
if (!(rect_x.has_value() && rect_y.has_value() &&
rect_width.has_value() && rect_height.has_value()))
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc
index 9ad0f31..290b573 100644
--- a/cc/test/layer_tree_test.cc
+++ b/cc/test/layer_tree_test.cc
@@ -264,7 +264,7 @@
return test_hooks_->PrepareToDrawOnThread(this, frame, draw_result);
}
- absl::optional<SubmitInfo> DrawLayers(FrameData* frame) override {
+ std::optional<SubmitInfo> DrawLayers(FrameData* frame) override {
auto r = LayerTreeHostImpl::DrawLayers(frame);
test_hooks_->DrawLayersOnThread(this);
return r;
@@ -439,7 +439,7 @@
void OnDeferCommitsChanged(
bool,
PaintHoldingReason,
- absl::optional<PaintHoldingCommitTrigger>) override {}
+ std::optional<PaintHoldingCommitTrigger>) override {}
void OnCommitRequested() override {}
void RecordStartOfFrameMetrics() override {}
diff --git a/cc/test/paint_op_helper.h b/cc/test/paint_op_helper.h
index 6df195d..4682e9f 100644
--- a/cc/test/paint_op_helper.h
+++ b/cc/test/paint_op_helper.h
@@ -38,7 +38,7 @@
}
template <typename T>
- static std::string ToString(const absl::optional<T>& opt) {
+ static std::string ToString(const std::optional<T>& opt) {
return opt.has_value() ? ToString(*opt) : "(nil)";
}
diff --git a/cc/test/paint_op_matchers.h b/cc/test/paint_op_matchers.h
index c7640bf..7566ae3 100644
--- a/cc/test/paint_op_matchers.h
+++ b/cc/test/paint_op_matchers.h
@@ -10,12 +10,12 @@
#include <string>
#include <utility>
+#include <optional>
#include "base/memory/ref_counted.h"
#include "base/strings/stringprintf.h"
#include "cc/paint/paint_op_buffer.h"
#include "cc/test/paint_op_helper.h"
#include "testing/gmock/include/gmock/gmock.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace cc {
@@ -34,7 +34,7 @@
template <typename... Args>
explicit PaintOpEq(Args&&... args)
: expected_op_(base::MakeRefCounted<base::RefCountedData<OpT>>(
- absl::in_place,
+ std::in_place,
std::forward<Args>(args)...)) {}
bool MatchAndExplain(const PaintOp& op,
diff --git a/cc/test/render_pass_test_utils.cc b/cc/test/render_pass_test_utils.cc
index 991f28b..53334842 100644
--- a/cc/test/render_pass_test_utils.cc
+++ b/cc/test/render_pass_test_utils.cc
@@ -128,7 +128,7 @@
const gfx::Transform& transform) {
viz::SharedQuadState* shared_state = pass->CreateAndAppendSharedQuadState();
shared_state->SetAll(transform, rect, rect, gfx::MaskFilterInfo(),
- /*clip=*/absl::nullopt, /*contents_opaque=*/false,
+ /*clip=*/std::nullopt, /*contents_opaque=*/false,
/*opacity_f=*/1, SkBlendMode::kSrcOver,
/*sorting_context=*/0, /*layer_id=*/0u,
/*fast_rounded_corner=*/false);
@@ -144,7 +144,7 @@
viz::SharedQuadState* shared_state =
to_pass->CreateAndAppendSharedQuadState();
shared_state->SetAll(gfx::Transform(), output_rect, output_rect,
- gfx::MaskFilterInfo(), /*clip=*/absl::nullopt,
+ gfx::MaskFilterInfo(), /*clip=*/std::nullopt,
/*contents_opaque=*/false, /*opacity_f=*/1,
SkBlendMode::kSrcOver, /*sorting_context=*/0,
/*layer_id=*/0u, /*fast_rounded_corner=*/false);
@@ -179,7 +179,7 @@
to_pass->CreateAndAppendSharedQuadState();
shared_state->SetAll(
transform, output_rect, output_rect, gfx::MaskFilterInfo(),
- /*clip=*/absl::nullopt, /*contents_opaque=*/false, 1, blend_mode,
+ /*clip=*/std::nullopt, /*contents_opaque=*/false, 1, blend_mode,
/*sorting_context=*/0, /*layer_id=*/0u, /*fast_rounded_corner=*/false);
auto* quad =
to_pass->CreateAndAppendDrawQuad<viz::AggregatedRenderPassDrawQuad>();
@@ -227,7 +227,7 @@
viz::SharedQuadState* shared_state =
to_pass->CreateAndAppendSharedQuadState();
shared_state->SetAll(gfx::Transform(), rect, rect, gfx::MaskFilterInfo(),
- /*clip=*/absl::nullopt, /*contents_opaque=*/false,
+ /*clip=*/std::nullopt, /*contents_opaque=*/false,
/*opacity_f=*/1, SkBlendMode::kSrcOver,
/*sorting_context=*/0, /*layer_id=*/0u,
/*fast_rounded_corner=*/false);
@@ -297,7 +297,7 @@
viz::SharedQuadState* shared_state2 =
to_pass->CreateAndAppendSharedQuadState();
shared_state->SetAll(gfx::Transform(), rect, rect, gfx::MaskFilterInfo(),
- /*clip=*/absl::nullopt, /*contents_opaque=*/false,
+ /*clip=*/std::nullopt, /*contents_opaque=*/false,
/*opacity_f=*/1, SkBlendMode::kSrcOver,
/*sorting_context=*/0, /*layer_id=*/0u,
/*fast_rounded_corner=*/false);
@@ -313,7 +313,7 @@
gfx::Size(2, 2), plane_resources[0], plane_resources[1],
plane_resources[2], plane_resources[3],
gfx::ColorSpace::CreateREC601(), 0.0, 1.0, 8,
- gfx::ProtectedVideoType::kClear, absl::nullopt);
+ gfx::ProtectedVideoType::kClear, std::nullopt);
return {resource1, resource2, resource3,
resource4, resource5, resource6,
@@ -416,7 +416,7 @@
viz::SharedQuadState* shared_state =
to_pass->CreateAndAppendSharedQuadState();
shared_state->SetAll(gfx::Transform(), rect, rect, gfx::MaskFilterInfo(),
- /*clip=*/absl::nullopt, /*contents_opaque=*/false,
+ /*clip=*/std::nullopt, /*contents_opaque=*/false,
/*opacity_f=*/1, SkBlendMode::kSrcOver,
/*sorting_context=*/0, /*layer_id=*/0u,
/*fast_rounded_corner=*/false);
@@ -484,7 +484,7 @@
viz::SharedQuadState* shared_state2 =
to_pass->CreateAndAppendSharedQuadState();
shared_state2->SetAll(gfx::Transform(), rect, rect, gfx::MaskFilterInfo(),
- /*clip=*/absl::nullopt, /*contents_opaque=*/false,
+ /*clip=*/std::nullopt, /*contents_opaque=*/false,
/*opacity_f=*/1, SkBlendMode::kSrcOver,
/*sorting_context=*/0, /*layer_id=*/0u,
/*fast_rounded_corner=*/false);
@@ -502,7 +502,7 @@
gfx::Size(2, 1), mapped_plane_resources[0],
mapped_plane_resources[1], mapped_plane_resources[2],
mapped_plane_resources[3], gfx::ColorSpace::CreateREC601(),
- 0.0, 1.0, 8, gfx::ProtectedVideoType::kClear, absl::nullopt);
+ 0.0, 1.0, 8, gfx::ProtectedVideoType::kClear, std::nullopt);
}
} // namespace cc
diff --git a/cc/test/render_pass_test_utils.h b/cc/test/render_pass_test_utils.h
index 24fb004..ba42d1c 100644
--- a/cc/test/render_pass_test_utils.h
+++ b/cc/test/render_pass_test_utils.h
@@ -74,7 +74,7 @@
float opacity) {
viz::SharedQuadState* shared_state = pass->CreateAndAppendSharedQuadState();
shared_state->SetAll(gfx::Transform(), rect, rect, gfx::MaskFilterInfo(),
- /*clip=*/absl::nullopt, /*contents_opaque=*/false,
+ /*clip=*/std::nullopt, /*contents_opaque=*/false,
opacity, SkBlendMode::kSrcOver, /*sorting_context=*/0,
/*layer_id=*/0u, /*fast_rounded_corner=*/false);
auto* quad =
diff --git a/cc/test/skia_common.cc b/cc/test/skia_common.cc
index 5129fc03..5da21b7a 100644
--- a/cc/test/skia_common.cc
+++ b/cc/test/skia_common.cc
@@ -161,7 +161,7 @@
bool allocate_encoded_data,
PaintImage::Id id,
SkColorType color_type,
- absl::optional<YUVSubsampling> yuv_format,
+ std::optional<YUVSubsampling> yuv_format,
SkYUVAPixmapInfo::DataType yuv_data_type) {
if (!color_space)
color_space = SkColorSpace::MakeSRGB();
diff --git a/cc/test/skia_common.h b/cc/test/skia_common.h
index a59c3ff..1adf67c 100644
--- a/cc/test/skia_common.h
+++ b/cc/test/skia_common.h
@@ -9,6 +9,7 @@
#include <string>
#include <vector>
+#include <optional>
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_refptr.h"
@@ -19,7 +20,6 @@
#include "cc/paint/image_animation_count.h"
#include "cc/paint/paint_image.h"
#include "cc/paint/paint_image_generator.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColorSpace.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkRefCnt.h"
@@ -59,7 +59,7 @@
bool allocate_encoded_memory = true,
PaintImage::Id id = PaintImage::kInvalidId,
SkColorType color_type = kN32_SkColorType,
- absl::optional<YUVSubsampling> yuv_format = absl::nullopt,
+ std::optional<YUVSubsampling> yuv_format = std::nullopt,
SkYUVAPixmapInfo::DataType yuv_data_type =
SkYUVAPixmapInfo::DataType::kUnorm8);
diff --git a/cc/test/stub_layer_tree_host_client.h b/cc/test/stub_layer_tree_host_client.h
index d94648db..8de1e06 100644
--- a/cc/test/stub_layer_tree_host_client.h
+++ b/cc/test/stub_layer_tree_host_client.h
@@ -30,7 +30,7 @@
void OnDeferCommitsChanged(
bool,
PaintHoldingReason,
- absl::optional<PaintHoldingCommitTrigger>) override {}
+ std::optional<PaintHoldingCommitTrigger>) override {}
void OnCommitRequested() override {}
void RecordStartOfFrameMetrics() override {}
void RecordEndOfFrameMetrics(base::TimeTicks,
diff --git a/cc/test/test_hooks.h b/cc/test/test_hooks.h
index c5eecd3..66a71af4 100644
--- a/cc/test/test_hooks.h
+++ b/cc/test/test_hooks.h
@@ -142,7 +142,7 @@
base::TimeTicks animation_start_time,
std::unique_ptr<gfx::AnimationCurve> curve) override {}
void NotifyLocalTimeUpdated(
- absl::optional<base::TimeDelta> local_time) override {}
+ std::optional<base::TimeDelta> local_time) override {}
// OutputSurface indirections to the LayerTreeTest, that can be further
// overridden.
diff --git a/cc/test/test_options_provider.cc b/cc/test/test_options_provider.cc
index 2c364b31..439643a4 100644
--- a/cc/test/test_options_provider.cc
+++ b/cc/test/test_options_provider.cc
@@ -113,7 +113,7 @@
// Create a transfer cache entry for this image.
ClientImageTransferCacheEntry cache_entry(
ClientImageTransferCacheEntry::Image(&bitmap.pixmap()),
- false /* needs_mips */, absl::nullopt);
+ false /* needs_mips */, std::nullopt);
const uint32_t data_size = cache_entry.SerializedSize();
auto data = PaintOpWriter::AllocateAlignedBuffer<uint8_t>(data_size);
if (!cache_entry.Serialize(base::span<uint8_t>(data.get(), data_size))) {
diff --git a/cc/tiles/checker_image_tracker.h b/cc/tiles/checker_image_tracker.h
index fa042854..5b17d44 100644
--- a/cc/tiles/checker_image_tracker.h
+++ b/cc/tiles/checker_image_tracker.h
@@ -9,12 +9,12 @@
#include <unordered_map>
#include <vector>
+#include <optional>
#include "base/containers/contains.h"
#include "base/memory/raw_ptr.h"
#include "cc/cc_export.h"
#include "cc/paint/image_id.h"
#include "cc/tiles/image_controller.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkImage.h"
namespace cc {
@@ -201,7 +201,7 @@
// The currently outstanding image decode that has been scheduled with the
// decode service. There can be only one outstanding decode at a time.
- absl::optional<PaintImage> outstanding_image_decode_;
+ std::optional<PaintImage> outstanding_image_decode_;
// A map of ImageId to its DecodePolicy.
std::unordered_map<PaintImage::Id, DecodeState> image_async_decode_state_;
diff --git a/cc/tiles/gpu_image_decode_cache.cc b/cc/tiles/gpu_image_decode_cache.cc
index 46e4aa66..bf3c710b 100644
--- a/cc/tiles/gpu_image_decode_cache.cc
+++ b/cc/tiles/gpu_image_decode_cache.cc
@@ -503,7 +503,7 @@
size_t size_;
};
-absl::optional<SkYUVAPixmapInfo> GetYUVADecodeInfo(
+std::optional<SkYUVAPixmapInfo> GetYUVADecodeInfo(
const DrawImage& draw_image,
AuxImage aux_image,
const SkISize target_size,
@@ -511,7 +511,7 @@
SkYUVAPixmapInfo original_yuva_pixmap_info;
if (!draw_image.paint_image().IsYuv(yuva_supported_data_types, aux_image,
&original_yuva_pixmap_info)) {
- return absl::nullopt;
+ return std::nullopt;
}
DCHECK(original_yuva_pixmap_info.isValid());
@@ -1227,7 +1227,7 @@
{
// TODO(crbug.com/1110007): We shouldn't need to lock to get capabilities.
- absl::optional<viz::RasterContextProvider::ScopedRasterContextLock>
+ std::optional<viz::RasterContextProvider::ScopedRasterContextLock>
context_lock;
if (context_->GetLock())
context_lock.emplace(context_);
@@ -1584,7 +1584,7 @@
"GpuImageDecodeCache::SetShouldAggressivelyFreeResources",
"agressive_free_resources", aggressively_free_resources);
if (aggressively_free_resources) {
- absl::optional<viz::RasterContextProvider::ScopedRasterContextLock>
+ std::optional<viz::RasterContextProvider::ScopedRasterContextLock>
context_lock;
if (auto* lock = context_->GetLock()) {
// There are callers that might have already acquired the lock. Thus,
@@ -1954,12 +1954,12 @@
void GpuImageDecodeCache::UploadImageInTask(const DrawImage& draw_image) {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"),
"GpuImageDecodeCache::UploadImage");
- absl::optional<viz::RasterContextProvider::ScopedRasterContextLock>
+ std::optional<viz::RasterContextProvider::ScopedRasterContextLock>
context_lock;
if (context_->GetLock())
context_lock.emplace(context_);
- absl::optional<ScopedGrContextAccess> gr_context_access;
+ std::optional<ScopedGrContextAccess> gr_context_access;
if (!use_transfer_cache_)
gr_context_access.emplace(context_);
base::AutoLock lock(lock_);
@@ -2602,7 +2602,7 @@
draw_image.paint_image().HasGainmap())) {
target_color_space = nullptr;
}
- const absl::optional<gfx::HDRMetadata> hdr_metadata =
+ const std::optional<gfx::HDRMetadata> hdr_metadata =
draw_image.paint_image().GetHDRMetadata();
UploadImageIfNecessary_TransferCache_SoftwareDecode(
@@ -2676,7 +2676,7 @@
const DrawImage& draw_image,
ImageData* image_data,
sk_sp<SkColorSpace> decoded_color_space,
- const absl::optional<gfx::HDRMetadata>& hdr_metadata,
+ const std::optional<gfx::HDRMetadata>& hdr_metadata,
sk_sp<SkColorSpace> target_color_space) {
DCHECK_EQ(image_data->mode, DecodedDataMode::kTransferCache);
DCHECK(use_transfer_cache_);
diff --git a/cc/tiles/gpu_image_decode_cache.h b/cc/tiles/gpu_image_decode_cache.h
index fab354b..36c0553 100644
--- a/cc/tiles/gpu_image_decode_cache.h
+++ b/cc/tiles/gpu_image_decode_cache.h
@@ -12,6 +12,7 @@
#include <utility>
#include <vector>
+#include <optional>
#include "base/containers/flat_map.h"
#include "base/containers/lru_cache.h"
#include "base/feature_list.h"
@@ -28,7 +29,6 @@
#include "cc/cc_export.h"
#include "cc/paint/image_transfer_cache_entry.h"
#include "cc/tiles/image_decode_cache.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkRefCnt.h"
#include "third_party/skia/include/core/SkYUVAInfo.h"
@@ -478,7 +478,7 @@
}
// If in transfer cache mode.
- absl::optional<uint32_t> transfer_cache_id() const {
+ std::optional<uint32_t> transfer_cache_id() const {
DCHECK(mode_ == Mode::kTransferCache || mode_ == Mode::kNone);
return transfer_cache_id_;
}
@@ -559,21 +559,21 @@
// Used if |mode_| == kSkImage.
// May be null if image not yet uploaded / prepared.
sk_sp<SkImage> image_;
- absl::optional<YUVSkImages> image_yuv_planes_;
+ std::optional<YUVSkImages> image_yuv_planes_;
// TODO(crbug/910276): Change after alpha support.
bool is_alpha_ = false;
GrGLuint gl_id_ = 0;
- absl::optional<std::array<GrGLuint, kNumYUVPlanes>> gl_plane_ids_;
+ std::optional<std::array<GrGLuint, kNumYUVPlanes>> gl_plane_ids_;
// Used if |mode_| == kTransferCache.
- absl::optional<uint32_t> transfer_cache_id_;
+ std::optional<uint32_t> transfer_cache_id_;
// The original un-mipped image, for RGBX, or the representative image
// backed by three planes for YUV. It is retained until it can be safely
// deleted.
sk_sp<SkImage> unmipped_image_;
// Used for YUV decoding and null otherwise.
- absl::optional<YUVSkImages> unmipped_yuv_images_;
+ std::optional<YUVSkImages> unmipped_yuv_images_;
};
// A structure to represent either an RGBA or a YUVA image info.
@@ -587,8 +587,8 @@
~ImageInfo();
// At most one of `rgba` or `yuva` may be valid.
- absl::optional<SkImageInfo> rgba;
- absl::optional<SkYUVAPixmapInfo> yuva;
+ std::optional<SkImageInfo> rgba;
+ std::optional<SkYUVAPixmapInfo> yuva;
// The number of bytes used by this image.
size_t size = 0;
@@ -825,7 +825,7 @@
const DrawImage& draw_image,
ImageData* image_data,
sk_sp<SkColorSpace> decoded_target_colorspace,
- const absl::optional<gfx::HDRMetadata>& hdr_metadata,
+ const std::optional<gfx::HDRMetadata>& hdr_metadata,
sk_sp<SkColorSpace> target_color_space) EXCLUSIVE_LOCKS_REQUIRED(lock_);
void UploadImageIfNecessary_GpuCpu_YUVA(
const DrawImage& draw_image,
diff --git a/cc/tiles/gpu_image_decode_cache_unittest.cc b/cc/tiles/gpu_image_decode_cache_unittest.cc
index 5217c631..13e0279d 100644
--- a/cc/tiles/gpu_image_decode_cache_unittest.cc
+++ b/cc/tiles/gpu_image_decode_cache_unittest.cc
@@ -337,7 +337,7 @@
std::move(support), std::move(gl), std::move(raster));
}
- void SetContextCapabilitiesOverride(absl::optional<gpu::Capabilities> caps) {
+ void SetContextCapabilitiesOverride(std::optional<gpu::Capabilities> caps) {
capabilities_override_ = caps;
}
@@ -360,7 +360,7 @@
nullptr /* sii */,
true) {}
- absl::optional<gpu::Capabilities> capabilities_override_;
+ std::optional<gpu::Capabilities> capabilities_override_;
};
class FakeRasterDarkModeFilter : public RasterDarkModeFilter {
@@ -661,7 +661,7 @@
void CompareAllPlanesToMippedVersions(
GpuImageDecodeCache* cache,
const DrawImage& draw_image,
- const absl::optional<uint32_t> transfer_cache_id,
+ const std::optional<uint32_t> transfer_cache_id,
bool should_have_mips) {
for (size_t i = 0; i < kNumYUVPlanes; ++i) {
sk_sp<SkImage> original_uploaded_plane;
@@ -693,7 +693,7 @@
void VerifyUploadedPlaneSizes(
GpuImageDecodeCache* cache,
const DrawImage& draw_image,
- const absl::optional<uint32_t> transfer_cache_id,
+ const std::optional<uint32_t> transfer_cache_id,
const SkISize plane_sizes[SkYUVAInfo::kMaxPlanes],
SkYUVAPixmapInfo::DataType expected_type =
SkYUVAPixmapInfo::DataType::kUnorm8,
@@ -3236,7 +3236,7 @@
// it attached.
DecodedDrawImage serialized_decoded_draw_image =
cache->GetDecodedImageForDraw(draw_image);
- const absl::optional<uint32_t> transfer_cache_entry_id =
+ const std::optional<uint32_t> transfer_cache_entry_id =
serialized_decoded_draw_image.transfer_cache_entry_id();
DecodedDrawImage decoded_draw_image =
EnsureImageBacked(std::move(serialized_decoded_draw_image));
@@ -3307,7 +3307,7 @@
// it attached.
DecodedDrawImage serialized_decoded_draw_image =
cache->GetDecodedImageForDraw(draw_image);
- const absl::optional<uint32_t> transfer_cache_entry_id =
+ const std::optional<uint32_t> transfer_cache_entry_id =
serialized_decoded_draw_image.transfer_cache_entry_id();
DecodedDrawImage decoded_draw_image =
EnsureImageBacked(std::move(serialized_decoded_draw_image));
@@ -3355,7 +3355,7 @@
// it attached.
DecodedDrawImage serialized_decoded_draw_image =
cache->GetDecodedImageForDraw(draw_image);
- const absl::optional<uint32_t> transfer_cache_entry_id =
+ const std::optional<uint32_t> transfer_cache_entry_id =
serialized_decoded_draw_image.transfer_cache_entry_id();
DecodedDrawImage decoded_draw_image =
EnsureImageBacked(std::move(serialized_decoded_draw_image));
@@ -3412,7 +3412,7 @@
// it attached.
DecodedDrawImage serialized_decoded_draw_image =
cache->GetDecodedImageForDraw(draw_image);
- const absl::optional<uint32_t> transfer_cache_entry_id =
+ const std::optional<uint32_t> transfer_cache_entry_id =
serialized_decoded_draw_image.transfer_cache_entry_id();
DecodedDrawImage decoded_draw_image =
EnsureImageBacked(std::move(serialized_decoded_draw_image));
@@ -3453,7 +3453,7 @@
// it attached.
DecodedDrawImage serialized_decoded_draw_image =
cache->GetDecodedImageForDraw(draw_image);
- const absl::optional<uint32_t> transfer_cache_entry_id =
+ const std::optional<uint32_t> transfer_cache_entry_id =
serialized_decoded_draw_image.transfer_cache_entry_id();
DecodedDrawImage decoded_draw_image =
EnsureImageBacked(std::move(serialized_decoded_draw_image));
@@ -3552,7 +3552,7 @@
// it attached.
DecodedDrawImage serialized_decoded_draw_image =
cache->GetDecodedImageForDraw(draw_image);
- const absl::optional<uint32_t> transfer_cache_entry_id =
+ const std::optional<uint32_t> transfer_cache_entry_id =
serialized_decoded_draw_image.transfer_cache_entry_id();
DecodedDrawImage decoded_draw_image =
EnsureImageBacked(std::move(serialized_decoded_draw_image));
@@ -3650,7 +3650,7 @@
// it attached.
DecodedDrawImage serialized_decoded_draw_image =
cache->GetDecodedImageForDraw(draw_image);
- const absl::optional<uint32_t> transfer_cache_entry_id =
+ const std::optional<uint32_t> transfer_cache_entry_id =
serialized_decoded_draw_image.transfer_cache_entry_id();
DecodedDrawImage decoded_draw_image =
EnsureImageBacked(std::move(serialized_decoded_draw_image));
@@ -3863,7 +3863,7 @@
// has it attached.
DecodedDrawImage serialized_decoded_draw_image =
cache->GetDecodedImageForDraw(draw_image);
- const absl::optional<uint32_t> transfer_cache_entry_id =
+ const std::optional<uint32_t> transfer_cache_entry_id =
serialized_decoded_draw_image.transfer_cache_entry_id();
DecodedDrawImage decoded_draw_image =
EnsureImageBacked(std::move(serialized_decoded_draw_image));
diff --git a/cc/tiles/image_controller_unittest.cc b/cc/tiles/image_controller_unittest.cc
index 4ed33efe..47f5c79 100644
--- a/cc/tiles/image_controller_unittest.cc
+++ b/cc/tiles/image_controller_unittest.cc
@@ -7,6 +7,7 @@
#include <memory>
#include <utility>
+#include <optional>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/run_loop.h"
@@ -23,7 +24,6 @@
#include "cc/test/test_paint_worklet_input.h"
#include "cc/tiles/image_decode_cache.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace cc {
namespace {
diff --git a/cc/tiles/software_image_decode_cache.cc b/cc/tiles/software_image_decode_cache.cc
index 8025fde..969f9ba 100644
--- a/cc/tiles/software_image_decode_cache.cc
+++ b/cc/tiles/software_image_decode_cache.cc
@@ -392,7 +392,7 @@
} else {
// Attempt to find a cached decode to generate a scaled/subrected decode
// from.
- absl::optional<CacheKey> candidate_key = FindCachedCandidate(key);
+ std::optional<CacheKey> candidate_key = FindCachedCandidate(key);
SkISize desired_size = gfx::SizeToSkISize(key.target_size());
const bool should_decode_to_scale =
@@ -500,7 +500,7 @@
return TaskProcessingResult::kFullDecode;
}
-absl::optional<SoftwareImageDecodeCache::CacheKey>
+std::optional<SoftwareImageDecodeCache::CacheKey>
SoftwareImageDecodeCache::FindCachedCandidate(const CacheKey& key) {
auto image_keys_it = frame_key_to_image_keys_.find(key.frame_key());
// We know that we must have at least our own |entry| in this list, so it
@@ -534,7 +534,7 @@
}
}
- return absl::nullopt;
+ return std::nullopt;
}
bool SoftwareImageDecodeCache::UseCacheForDrawImage(
diff --git a/cc/tiles/software_image_decode_cache.h b/cc/tiles/software_image_decode_cache.h
index dd32486..02d35d6 100644
--- a/cc/tiles/software_image_decode_cache.h
+++ b/cc/tiles/software_image_decode_cache.h
@@ -134,7 +134,7 @@
EXCLUSIVE_LOCKS_REQUIRED(lock_);
void RemoveBudgetForImage(const CacheKey& key, CacheEntry* entry)
EXCLUSIVE_LOCKS_REQUIRED(lock_);
- absl::optional<CacheKey> FindCachedCandidate(const CacheKey& key)
+ std::optional<CacheKey> FindCachedCandidate(const CacheKey& key)
EXCLUSIVE_LOCKS_REQUIRED(lock_);
void UnrefImage(const CacheKey& key) EXCLUSIVE_LOCKS_REQUIRED(lock_);
diff --git a/cc/tiles/tile_manager.cc b/cc/tiles/tile_manager.cc
index 6d17130..d7e8dbc 100644
--- a/cc/tiles/tile_manager.cc
+++ b/cc/tiles/tile_manager.cc
@@ -10,6 +10,7 @@
#include <limits>
#include <string>
+#include <optional>
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
@@ -43,7 +44,6 @@
#include "cc/tiles/tile_priority.h"
#include "cc/tiles/tiles_with_resource_iterator.h"
#include "components/viz/common/resources/resource_sizes.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/axis_transform2d.h"
#include "ui/gfx/geometry/rect_conversions.h"
@@ -1484,7 +1484,7 @@
has_at_raster_images, has_hardware_accelerated_jpeg_candidates,
has_hardware_accelerated_webp_candidates);
- absl::optional<PlaybackImageProvider::Settings> settings;
+ std::optional<PlaybackImageProvider::Settings> settings;
if (!skip_images) {
settings.emplace();
settings->images_to_skip = std::move(images_to_skip);
diff --git a/cc/tiles/tiles_with_resource_iterator.h b/cc/tiles/tiles_with_resource_iterator.h
index 89b8063..641b440 100644
--- a/cc/tiles/tiles_with_resource_iterator.h
+++ b/cc/tiles/tiles_with_resource_iterator.h
@@ -8,11 +8,11 @@
#include <set>
#include <vector>
+#include <optional>
#include "base/memory/raw_ptr.h"
#include "cc/cc_export.h"
#include "cc/tiles/picture_layer_tiling.h"
#include "cc/tiles/prioritized_tile.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace cc {
@@ -73,14 +73,14 @@
// Iterates over the tiles from the current PictureLayerTiling. If this is
// not set, the end has been reached.
- absl::optional<PictureLayerTiling::TileIterator> tile_iterator_;
+ std::optional<PictureLayerTiling::TileIterator> tile_iterator_;
// Set of tiles that have been visited. Used to ensure the same tile isn't
// visited more than once.
std::set<Tile*> visited_;
// Created when GetCurrentAsPrioritizedTile() is called.
- absl::optional<PrioritizedTile> prioritized_tile_;
+ std::optional<PrioritizedTile> prioritized_tile_;
};
} // namespace cc
diff --git a/cc/trees/compositor_commit_data.cc b/cc/trees/compositor_commit_data.cc
index e50eef4..c09d3c3 100644
--- a/cc/trees/compositor_commit_data.cc
+++ b/cc/trees/compositor_commit_data.cc
@@ -17,7 +17,7 @@
CompositorCommitData::ScrollUpdateInfo::ScrollUpdateInfo(
ElementId id,
gfx::Vector2dF delta,
- absl::optional<TargetSnapAreaElementIds> snap_target_ids)
+ std::optional<TargetSnapAreaElementIds> snap_target_ids)
: element_id(id),
scroll_delta(delta),
snap_target_element_ids(snap_target_ids) {}
diff --git a/cc/trees/compositor_commit_data.h b/cc/trees/compositor_commit_data.h
index 0d39b31..ac59360 100644
--- a/cc/trees/compositor_commit_data.h
+++ b/cc/trees/compositor_commit_data.h
@@ -8,12 +8,12 @@
#include <memory>
#include <vector>
+#include <optional>
#include "cc/cc_export.h"
#include "cc/input/browser_controls_state.h"
#include "cc/input/scroll_snap_data.h"
#include "cc/paint/element_id.h"
#include "cc/trees/layer_tree_host_client.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/transform.h"
#include "ui/gfx/geometry/vector2d.h"
@@ -32,7 +32,7 @@
ScrollUpdateInfo();
ScrollUpdateInfo(ElementId id,
gfx::Vector2dF delta,
- absl::optional<TargetSnapAreaElementIds> snap_target_ids);
+ std::optional<TargetSnapAreaElementIds> snap_target_ids);
ScrollUpdateInfo(const ScrollUpdateInfo& other);
ScrollUpdateInfo& operator=(const ScrollUpdateInfo&);
ElementId element_id;
@@ -41,7 +41,7 @@
// The target snap area element ids of the scrolling element.
// This will have a value if the scrolled element's scroll node has snap
// container data and the scroll delta is non-zero.
- absl::optional<TargetSnapAreaElementIds> snap_target_element_ids;
+ std::optional<TargetSnapAreaElementIds> snap_target_element_ids;
bool operator==(const ScrollUpdateInfo& other) const {
return element_id == other.element_id &&
diff --git a/cc/trees/effect_node.h b/cc/trees/effect_node.h
index 45cbaac2..ebcf43b 100644
--- a/cc/trees/effect_node.h
+++ b/cc/trees/effect_node.h
@@ -5,13 +5,13 @@
#ifndef CC_TREES_EFFECT_NODE_H_
#define CC_TREES_EFFECT_NODE_H_
+#include <optional>
#include "cc/cc_export.h"
#include "cc/paint/element_id.h"
#include "cc/paint/filter_operations.h"
#include "cc/view_transition/view_transition_element_id.h"
#include "components/viz/common/surfaces/subtree_capture_id.h"
#include "components/viz/common/view_transition_element_resource_id.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkBlendMode.h"
#include "ui/gfx/geometry/mask_filter_info.h"
#include "ui/gfx/geometry/point_f.h"
@@ -80,7 +80,7 @@
FilterOperations filters;
FilterOperations backdrop_filters;
- absl::optional<gfx::RRectF> backdrop_filter_bounds;
+ std::optional<gfx::RRectF> backdrop_filter_bounds;
float backdrop_filter_quality;
gfx::PointF filters_origin;
diff --git a/cc/trees/image_animation_controller.cc b/cc/trees/image_animation_controller.cc
index bf10a00..24a6a558 100644
--- a/cc/trees/image_animation_controller.cc
+++ b/cc/trees/image_animation_controller.cc
@@ -83,7 +83,7 @@
DCHECK(images_animated_on_sync_tree_.empty());
scheduler_.WillAnimate();
- absl::optional<base::TimeTicks> next_invalidation_time;
+ std::optional<base::TimeTicks> next_invalidation_time;
for (auto id : registered_animations_) {
auto it = animation_state_map_.find(id);
@@ -136,7 +136,7 @@
void ImageAnimationController::UpdateStateFromDrivers() {
TRACE_EVENT0("cc", "UpdateStateFromAnimationDrivers");
- absl::optional<base::TimeTicks> next_invalidation_time;
+ std::optional<base::TimeTicks> next_invalidation_time;
for (auto image_id : registered_animations_) {
auto it = animation_state_map_.find(image_id);
DCHECK(it != animation_state_map_.end());
diff --git a/cc/trees/image_animation_controller_unittest.cc b/cc/trees/image_animation_controller_unittest.cc
index 7e301df..c73cc54 100644
--- a/cc/trees/image_animation_controller_unittest.cc
+++ b/cc/trees/image_animation_controller_unittest.cc
@@ -69,7 +69,7 @@
private:
~DelayTrackingTaskRunner() override = default;
- absl::optional<base::TimeDelta> last_delay_;
+ std::optional<base::TimeDelta> last_delay_;
raw_ptr<base::SingleThreadTaskRunner> task_runner_;
};
diff --git a/cc/trees/layer_tree_frame_sink_client.h b/cc/trees/layer_tree_frame_sink_client.h
index 25932a7..f1e50b0 100644
--- a/cc/trees/layer_tree_frame_sink_client.h
+++ b/cc/trees/layer_tree_frame_sink_client.h
@@ -5,13 +5,12 @@
#ifndef CC_TREES_LAYER_TREE_FRAME_SINK_CLIENT_H_
#define CC_TREES_LAYER_TREE_FRAME_SINK_CLIENT_H_
+#include <optional>
#include <vector>
-
#include "base/functional/callback.h"
#include "cc/cc_export.h"
#include "components/viz/common/resources/returned_resource.h"
#include "components/viz/common/surfaces/local_surface_id.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/rect.h"
namespace gfx {
@@ -39,7 +38,7 @@
// called during SubmitCompositorFrame().
// TODO(danakj): Just pass it into SubmitCompositorFrame(), with a
// LayerTreeSetting to enable it or not.
- virtual absl::optional<viz::HitTestRegionList> BuildHitTestData() = 0;
+ virtual std::optional<viz::HitTestRegionList> BuildHitTestData() = 0;
// Returns resources sent to SubmitCompositorFrame to be reused or freed.
virtual void ReclaimResources(
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index b1768fa..3795ad8b 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -687,7 +687,7 @@
void LayerTreeHost::OnDeferCommitsChanged(
bool defer_status,
PaintHoldingReason reason,
- absl::optional<PaintHoldingCommitTrigger> trigger) {
+ std::optional<PaintHoldingCommitTrigger> trigger) {
DCHECK(IsMainThread());
client_->OnDeferCommitsChanged(defer_status, reason, trigger);
}
@@ -1048,7 +1048,7 @@
void LayerTreeHost::UpdateScrollOffsetFromImpl(
const ElementId& id,
const gfx::Vector2dF& delta,
- const absl::optional<TargetSnapAreaElementIds>& snap_target_ids) {
+ const std::optional<TargetSnapAreaElementIds>& snap_target_ids) {
if (IsUsingLayerLists()) {
auto& scroll_tree = property_trees()->scroll_tree_mutable();
auto new_offset = scroll_tree.current_scroll_offset(id) + delta;
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h
index d6f9d33..d83833e 100644
--- a/cc/trees/layer_tree_host.h
+++ b/cc/trees/layer_tree_host.h
@@ -16,6 +16,7 @@
#include <utility>
#include <vector>
+#include <optional>
#include "base/cancelable_callback.h"
#include "base/containers/flat_map.h"
#include "base/containers/flat_set.h"
@@ -63,7 +64,6 @@
#include "cc/trees/viewport_property_ids.h"
#include "components/viz/common/surfaces/local_surface_id.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/delegated_ink_metadata.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/overlay_transform.h"
@@ -344,7 +344,7 @@
// Notification that the proxy started or stopped deferring commits.
void OnDeferCommitsChanged(bool defer_status,
PaintHoldingReason reason,
- absl::optional<PaintHoldingCommitTrigger> trigger);
+ std::optional<PaintHoldingCommitTrigger> trigger);
// Returns whether there are any outstanding ScopedDeferMainFrameUpdate,
// though commits may be deferred also when the local_surface_id_from_parent()
@@ -989,7 +989,7 @@
void UpdateScrollOffsetFromImpl(
const ElementId&,
const gfx::Vector2dF& delta,
- const absl::optional<TargetSnapAreaElementIds>&);
+ const std::optional<TargetSnapAreaElementIds>&);
const CompositorMode compositor_mode_;
diff --git a/cc/trees/layer_tree_host_client.h b/cc/trees/layer_tree_host_client.h
index 377e2cd8..abcd6ad 100644
--- a/cc/trees/layer_tree_host_client.h
+++ b/cc/trees/layer_tree_host_client.h
@@ -135,7 +135,7 @@
virtual void OnDeferCommitsChanged(
bool defer_status,
PaintHoldingReason reason,
- absl::optional<PaintHoldingCommitTrigger> trigger) = 0;
+ std::optional<PaintHoldingCommitTrigger> trigger) = 0;
// Notification that a compositing update has been requested.
virtual void OnCommitRequested() = 0;
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 41ac9d2..75adec33 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -14,6 +14,7 @@
#include <string>
#include <vector>
+#include <optional>
#include "base/auto_reset.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
@@ -124,7 +125,6 @@
#include "gpu/command_buffer/common/shared_image_capabilities.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/perfetto/protos/perfetto/trace/track_event/chrome_latency_info.pbzero.h"
#include "third_party/skia/include/core/SkSurface.h"
#include "third_party/skia/include/gpu/GrDirectContext.h"
@@ -849,7 +849,7 @@
for (const auto& entry : layer->GetPaintWorkletRecordMap()) {
const scoped_refptr<const PaintWorkletInput>& input = entry.first;
const PaintImage::Id& paint_image_id = entry.second.first;
- const absl::optional<PaintRecord>& record = entry.second.second;
+ const std::optional<PaintRecord>& record = entry.second.second;
// If we already have a record we can reuse it and so the
// PaintWorkletInput isn't dirty.
if (record)
@@ -1166,7 +1166,7 @@
target_render_pass->CreateAndAppendSharedQuadState();
shared_quad_state->SetAll(
gfx::Transform(), root_target_rect, root_target_rect,
- gfx::MaskFilterInfo(), absl::nullopt, screen_background_color.isOpaque(),
+ gfx::MaskFilterInfo(), std::nullopt, screen_background_color.isOpaque(),
/*opacity_f=*/1.f, SkBlendMode::kSrcOver, /*sorting_context=*/0,
/*layer_id=*/0u, /*fast_rounded_corner=*/false);
@@ -2484,7 +2484,7 @@
return metadata;
}
-absl::optional<LayerTreeHostImpl::SubmitInfo> LayerTreeHostImpl::DrawLayers(
+std::optional<LayerTreeHostImpl::SubmitInfo> LayerTreeHostImpl::DrawLayers(
FrameData* frame) {
DCHECK(CanDraw());
DCHECK_EQ(frame->has_no_damage, frame->render_passes.empty());
@@ -2509,7 +2509,7 @@
std::ignore = events_metrics_manager_.TakeSavedEventsMetrics();
}
- return absl::nullopt;
+ return std::nullopt;
}
layer_tree_frame_sink_->set_source_frame_number(
@@ -3132,10 +3132,10 @@
hit_test_region->transform = surface_to_root_transform.InverseOrIdentity();
}
-absl::optional<viz::HitTestRegionList> LayerTreeHostImpl::BuildHitTestData() {
+std::optional<viz::HitTestRegionList> LayerTreeHostImpl::BuildHitTestData() {
TRACE_EVENT0("cc", "LayerTreeHostImpl::BuildHitTestData");
- absl::optional<viz::HitTestRegionList> hit_test_region_list(absl::in_place);
+ std::optional<viz::HitTestRegionList> hit_test_region_list(std::in_place);
hit_test_region_list->flags = viz::HitTestRegionFlags::kHitTestMine |
viz::HitTestRegionFlags::kHitTestMouse |
viz::HitTestRegionFlags::kHitTestTouch;
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h
index aa4b0ad..316a9865 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -14,6 +14,7 @@
#include <utility>
#include <vector>
+#include <optional>
#include "base/containers/flat_map.h"
#include "base/containers/flat_set.h"
#include "base/containers/lru_cache.h"
@@ -68,7 +69,6 @@
#include "components/viz/common/surfaces/region_capture_bounds.h"
#include "components/viz/common/surfaces/surface_id.h"
#include "components/viz/common/surfaces/surface_range.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/rect.h"
namespace gfx {
@@ -215,7 +215,7 @@
bool has_missing_content = false;
std::vector<viz::SurfaceId> activation_dependencies;
- absl::optional<uint32_t> deadline_in_frames;
+ std::optional<uint32_t> deadline_in_frames;
bool use_default_lower_bound_deadline = false;
viz::CompositorRenderPassList render_passes;
raw_ptr<const RenderSurfaceList> render_surface_list = nullptr;
@@ -471,14 +471,14 @@
// regardless of whether `DrawLayers()` is called between the two.
virtual DrawResult PrepareToDraw(FrameData* frame);
- // If there is no damage, returns `absl::nullopt`; otherwise, returns
+ // If there is no damage, returns `std::nullopt`; otherwise, returns
// information about the submitted frame including submit time and a set of
// `EventMetrics` for the frame.
struct SubmitInfo {
base::TimeTicks time;
EventMetricsSet events_metrics;
};
- virtual absl::optional<SubmitInfo> DrawLayers(FrameData* frame);
+ virtual std::optional<SubmitInfo> DrawLayers(FrameData* frame);
// Must be called if and only if PrepareToDraw was called.
void DidDrawAllLayers(const FrameData& frame);
@@ -560,7 +560,7 @@
void SetExternalTilePriorityConstraints(
const gfx::Rect& viewport_rect,
const gfx::Transform& transform) override;
- absl::optional<viz::HitTestRegionList> BuildHitTestData() override;
+ std::optional<viz::HitTestRegionList> BuildHitTestData() override;
void DidLoseLayerTreeFrameSink() override;
void DidReceiveCompositorFrameAck() override;
void DidPresentCompositorFrame(
@@ -1238,7 +1238,7 @@
viz::LocalSurfaceId last_draw_local_surface_id_;
base::flat_set<viz::SurfaceRange> last_draw_referenced_surfaces_;
- absl::optional<RenderFrameMetadata> last_draw_render_frame_metadata_;
+ std::optional<RenderFrameMetadata> last_draw_render_frame_metadata_;
// The viz::LocalSurfaceId to unthrottle drawing for.
viz::LocalSurfaceId target_local_surface_id_;
viz::LocalSurfaceId evicted_local_surface_id_;
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 457462f8..6ab1da4d 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -10,6 +10,7 @@
#include <memory>
#include <utility>
+#include <optional>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/memory_pressure_listener.h"
@@ -91,7 +92,6 @@
#include "media/base/media.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkMallocPixelRef.h"
#include "ui/events/types/scroll_input_type.h"
#include "ui/gfx/geometry/angle_conversions.h"
@@ -773,9 +773,9 @@
return overflow;
}
- absl::optional<SnapContainerData> GetSnapContainerData(LayerImpl* layer) {
+ std::optional<SnapContainerData> GetSnapContainerData(LayerImpl* layer) {
return GetScrollNode(layer) ? GetScrollNode(layer)->snap_container_data
- : absl::nullopt;
+ : std::nullopt;
}
void ClearLayersAndPropertyTrees(LayerTreeImpl* layer_tree_impl) {
@@ -16752,13 +16752,13 @@
void DidEndScroll() override {}
#endif
- const absl::optional<RenderFrameMetadata>& last_metadata() const {
+ const std::optional<RenderFrameMetadata>& last_metadata() const {
return last_metadata_;
}
private:
bool increment_counter_;
- absl::optional<RenderFrameMetadata> last_metadata_;
+ std::optional<RenderFrameMetadata> last_metadata_;
};
TEST_F(LayerTreeHostImplTest, RenderFrameMetadata) {
@@ -17127,10 +17127,10 @@
base::UnguessableToken::Create());
viz::FrameSinkId frame_sink_id(2, 0);
viz::SurfaceId child_surface_id(frame_sink_id, child_local_surface_id);
- surface_child1->SetRange(viz::SurfaceRange(absl::nullopt, child_surface_id),
- absl::nullopt);
- surface_child2->SetRange(viz::SurfaceRange(absl::nullopt, child_surface_id),
- absl::nullopt);
+ surface_child1->SetRange(viz::SurfaceRange(std::nullopt, child_surface_id),
+ std::nullopt);
+ surface_child2->SetRange(viz::SurfaceRange(std::nullopt, child_surface_id),
+ std::nullopt);
CopyProperties(root, intermediate_layer);
intermediate_layer->SetOffsetToTransformParent(gfx::Vector2dF(200, 300));
@@ -17151,7 +17151,7 @@
constexpr gfx::Rect kFrameRect(0, 0, 1024, 768);
- absl::optional<viz::HitTestRegionList> hit_test_region_list =
+ std::optional<viz::HitTestRegionList> hit_test_region_list =
host_impl_->BuildHitTestData();
// Generating HitTestRegionList should have been enabled for this test.
ASSERT_TRUE(hit_test_region_list);
@@ -17225,13 +17225,13 @@
base::UnguessableToken::Create());
viz::FrameSinkId frame_sink_id(2, 0);
viz::SurfaceId child_surface_id(frame_sink_id, child_local_surface_id);
- surface_child1->SetRange(viz::SurfaceRange(absl::nullopt, child_surface_id),
- absl::nullopt);
+ surface_child1->SetRange(viz::SurfaceRange(std::nullopt, child_surface_id),
+ std::nullopt);
constexpr gfx::Rect kFrameRect(0, 0, 1024, 768);
UpdateDrawProperties(host_impl_->active_tree());
- absl::optional<viz::HitTestRegionList> hit_test_region_list =
+ std::optional<viz::HitTestRegionList> hit_test_region_list =
host_impl_->BuildHitTestData();
// Generating HitTestRegionList should have been enabled for this test.
ASSERT_TRUE(hit_test_region_list);
@@ -17281,8 +17281,8 @@
base::UnguessableToken::Create());
viz::FrameSinkId frame_sink_id(2, 0);
viz::SurfaceId child_surface_id(frame_sink_id, child_local_surface_id);
- surface_child->SetRange(viz::SurfaceRange(absl::nullopt, child_surface_id),
- absl::nullopt);
+ surface_child->SetRange(viz::SurfaceRange(std::nullopt, child_surface_id),
+ std::nullopt);
CopyProperties(root, surface_child);
@@ -17298,7 +17298,7 @@
constexpr gfx::Rect kFrameRect(0, 0, 1024, 768);
UpdateDrawProperties(host_impl_->active_tree());
- absl::optional<viz::HitTestRegionList> hit_test_region_list =
+ std::optional<viz::HitTestRegionList> hit_test_region_list =
host_impl_->BuildHitTestData();
// Generating HitTestRegionList should have been enabled for this test.
ASSERT_TRUE(hit_test_region_list);
@@ -17351,8 +17351,8 @@
base::UnguessableToken::Create());
viz::FrameSinkId frame_sink_id(2, 0);
viz::SurfaceId child_surface_id(frame_sink_id, child_local_surface_id);
- surface_child1->SetRange(viz::SurfaceRange(absl::nullopt, child_surface_id),
- absl::nullopt);
+ surface_child1->SetRange(viz::SurfaceRange(std::nullopt, child_surface_id),
+ std::nullopt);
auto* surface_child2 = AddLayer<SurfaceLayerImpl>(host_impl_->active_tree());
@@ -17363,13 +17363,13 @@
surface_child2->SetHasPointerEventsNone(false);
CopyProperties(root, surface_child2);
- surface_child2->SetRange(viz::SurfaceRange(absl::nullopt, viz::SurfaceId()),
- absl::nullopt);
+ surface_child2->SetRange(viz::SurfaceRange(std::nullopt, viz::SurfaceId()),
+ std::nullopt);
constexpr gfx::Rect kFrameRect(0, 0, 1024, 768);
UpdateDrawProperties(host_impl_->active_tree());
- absl::optional<viz::HitTestRegionList> hit_test_region_list =
+ std::optional<viz::HitTestRegionList> hit_test_region_list =
host_impl_->BuildHitTestData();
// Generating HitTestRegionList should have been enabled for this test.
ASSERT_TRUE(hit_test_region_list);
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 3f9882a..7119d18 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -3495,10 +3495,10 @@
void AfterTest() override { EXPECT_TRUE(sent_gesture_); }
// ScrollCallbacks
- void DidCompositorScroll(ElementId element_id,
- const gfx::PointF& scroll_offset,
- const absl::optional<TargetSnapAreaElementIds>&
- snap_target_ids) override {
+ void DidCompositorScroll(
+ ElementId element_id,
+ const gfx::PointF& scroll_offset,
+ const std::optional<TargetSnapAreaElementIds>& snap_target_ids) override {
last_scrolled_element_id_ = element_id;
last_scrolled_offset_ = scroll_offset;
}
@@ -9244,9 +9244,9 @@
// Check DelegatedInkMetadata on the CompositorFrameMetadata when the
// compositor frame is submitted.
- void ExpectMetadata(absl::optional<DelegatedInkBrowserMetadata>
- browser_delegated_ink_metadata,
- gfx::DelegatedInkMetadata* actual_metadata) {
+ void ExpectMetadata(
+ std::optional<DelegatedInkBrowserMetadata> browser_delegated_ink_metadata,
+ gfx::DelegatedInkMetadata* actual_metadata) {
if (expected_metadata_.has_value()) {
EXPECT_TRUE(browser_delegated_ink_metadata.has_value());
EXPECT_TRUE(actual_metadata);
@@ -9286,7 +9286,7 @@
#endif
protected:
- absl::optional<gfx::DelegatedInkMetadata> expected_metadata_;
+ std::optional<gfx::DelegatedInkMetadata> expected_metadata_;
base::TimeTicks metadata_frame_time_;
FakeContentLayerClient client_;
scoped_refptr<Layer> layer_;
@@ -9489,7 +9489,7 @@
/*is_inertial=*/false,
ScrollUpdateEventMetrics::ScrollUpdateType::kContinued,
/*delta=*/10.0f, event_time, arrived_in_browser_main_timestamp,
- &tick_clock, absl::nullopt);
+ &tick_clock, std::nullopt);
DCHECK_NE(metrics, nullptr);
{
tick_clock.Advance(base::Microseconds(10));
diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc
index 0078655..80b7cdda 100644
--- a/cc/trees/layer_tree_host_unittest_scroll.cc
+++ b/cc/trees/layer_tree_host_unittest_scroll.cc
@@ -90,10 +90,10 @@
}
// ScrollCallbacks
- void DidCompositorScroll(ElementId element_id,
- const gfx::PointF& scroll_offset,
- const absl::optional<TargetSnapAreaElementIds>&
- snap_target_ids) override {
+ void DidCompositorScroll(
+ ElementId element_id,
+ const gfx::PointF& scroll_offset,
+ const std::optional<TargetSnapAreaElementIds>& snap_target_ids) override {
// Simulates cc client (e.g Blink) behavior when handling impl-side scrolls.
SetScrollOffsetFromImplSide(layer_tree_host()->LayerByElementId(element_id),
scroll_offset);
@@ -615,10 +615,10 @@
}
}
- void DidCompositorScroll(ElementId element_id,
- const gfx::PointF& offset,
- const absl::optional<TargetSnapAreaElementIds>&
- snap_target_ids) override {
+ void DidCompositorScroll(
+ ElementId element_id,
+ const gfx::PointF& offset,
+ const std::optional<TargetSnapAreaElementIds>& snap_target_ids) override {
LayerTreeHostScrollTest::DidCompositorScroll(element_id, offset,
snap_target_ids);
if (element_id == expected_scroll_layer_->element_id()) {
@@ -1823,7 +1823,7 @@
void DidCompositorScroll(
ElementId element_id,
const gfx::PointF&,
- const absl::optional<TargetSnapAreaElementIds>&) override {
+ const std::optional<TargetSnapAreaElementIds>&) override {
if (scroll_destroy_whole_tree_) {
layer_tree_host()->SetRootLayer(nullptr);
layer_tree_host()->property_trees()->clear();
diff --git a/cc/trees/layer_tree_mutator.h b/cc/trees/layer_tree_mutator.h
index 73d1a4ca..d1d7ccff 100644
--- a/cc/trees/layer_tree_mutator.h
+++ b/cc/trees/layer_tree_mutator.h
@@ -10,13 +10,13 @@
#include <unordered_map>
#include <vector>
+#include <optional>
#include "base/check.h"
#include "base/functional/callback_forward.h"
#include "base/time/time.h"
#include "cc/cc_export.h"
#include "cc/trees/animation_effect_timings.h"
#include "cc/trees/animation_options.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace cc {
@@ -146,7 +146,7 @@
~AnimationState();
WorkletAnimationId worklet_animation_id;
- std::vector<absl::optional<base::TimeDelta>> local_times;
+ std::vector<std::optional<base::TimeDelta>> local_times;
};
AnimationWorkletOutput();
diff --git a/cc/trees/local_layer_context.cc b/cc/trees/local_layer_context.cc
index 7b52871..1e52fd5 100644
--- a/cc/trees/local_layer_context.cc
+++ b/cc/trees/local_layer_context.cc
@@ -75,7 +75,7 @@
void LocalLayerContext::OnDeferCommitsChanged(
bool defer_status,
PaintHoldingReason reason,
- absl::optional<PaintHoldingCommitTrigger> trigger) {}
+ std::optional<PaintHoldingCommitTrigger> trigger) {}
void LocalLayerContext::OnCommitRequested() {}
diff --git a/cc/trees/local_layer_context.h b/cc/trees/local_layer_context.h
index 4b535971..62409f0 100644
--- a/cc/trees/local_layer_context.h
+++ b/cc/trees/local_layer_context.h
@@ -43,7 +43,7 @@
void OnDeferCommitsChanged(
bool defer_status,
PaintHoldingReason reason,
- absl::optional<PaintHoldingCommitTrigger> trigger) override;
+ std::optional<PaintHoldingCommitTrigger> trigger) override;
void OnCommitRequested() override;
void BeginMainFrameNotExpectedSoon() override;
void BeginMainFrameNotExpectedUntil(base::TimeTicks time) override;
diff --git a/cc/trees/mutator_host_client.h b/cc/trees/mutator_host_client.h
index 7f4bc3a6..461162c 100644
--- a/cc/trees/mutator_host_client.h
+++ b/cc/trees/mutator_host_client.h
@@ -5,12 +5,12 @@
#ifndef CC_TREES_MUTATOR_HOST_CLIENT_H_
#define CC_TREES_MUTATOR_HOST_CLIENT_H_
+#include <optional>
#include "cc/base/protected_sequence_synchronizer.h"
#include "cc/paint/element_id.h"
#include "cc/paint/paint_worklet_input.h"
#include "cc/trees/property_animation_state.h"
#include "cc/trees/target_property.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace gfx {
class Transform;
diff --git a/cc/trees/property_tree.cc b/cc/trees/property_tree.cc
index b2255f8..6cdb219 100644
--- a/cc/trees/property_tree.cc
+++ b/cc/trees/property_tree.cc
@@ -1712,7 +1712,7 @@
ElementId id = map_entry.first;
- absl::optional<TargetSnapAreaElementIds> snap_target_ids;
+ std::optional<TargetSnapAreaElementIds> snap_target_ids;
if (snapped_elements.contains(id))
snap_target_ids = snapped_elements.at(id);
@@ -1956,7 +1956,7 @@
void ScrollTree::NotifyDidCompositorScroll(
ElementId scroll_element_id,
const gfx::PointF& scroll_offset,
- const absl::optional<TargetSnapAreaElementIds>& snap_target_ids) {
+ const std::optional<TargetSnapAreaElementIds>& snap_target_ids) {
DCHECK(property_trees()->is_main_thread());
if (callbacks_) {
callbacks_->DidCompositorScroll(scroll_element_id, scroll_offset,
diff --git a/cc/trees/property_tree.h b/cc/trees/property_tree.h
index c140244..1f76b357 100644
--- a/cc/trees/property_tree.h
+++ b/cc/trees/property_tree.h
@@ -14,6 +14,7 @@
#include <utility>
#include <vector>
+#include <optional>
#include "base/containers/flat_map.h"
#include "base/containers/flat_set.h"
#include "base/functional/callback.h"
@@ -32,7 +33,6 @@
#include "cc/trees/sticky_position_constraint.h"
#include "cc/trees/transform_node.h"
#include "components/viz/common/view_transition_element_resource_id.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/geometry/transform.h"
@@ -467,7 +467,7 @@
virtual void DidCompositorScroll(
ElementId scroll_element_id,
const gfx::PointF&,
- const absl::optional<TargetSnapAreaElementIds>&) = 0;
+ const std::optional<TargetSnapAreaElementIds>&) = 0;
// Called after the hidden status of composited scrollbars changed. Note that
// |scroll_element_id| is the element id of the scroll not of the scrollbars.
virtual void DidChangeScrollbarsHidden(ElementId scroll_element_id,
@@ -588,7 +588,7 @@
void NotifyDidCompositorScroll(
ElementId scroll_element_id,
const gfx::PointF& scroll_offset,
- const absl::optional<TargetSnapAreaElementIds>& snap_target_ids);
+ const std::optional<TargetSnapAreaElementIds>& snap_target_ids);
void NotifyDidChangeScrollbarsHidden(ElementId scroll_element_id,
bool hidden) const;
diff --git a/cc/trees/proxy_impl.cc b/cc/trees/proxy_impl.cc
index b00beb2..44dc9c0 100644
--- a/cc/trees/proxy_impl.cc
+++ b/cc/trees/proxy_impl.cc
@@ -896,7 +896,7 @@
}
if (draw_frame) {
- if (absl::optional<LayerTreeHostImpl::SubmitInfo> submit_info =
+ if (std::optional<LayerTreeHostImpl::SubmitInfo> submit_info =
host_impl_->DrawLayers(&frame)) {
DCHECK_NE(frame.frame_token, 0u);
// Drawing implies we submitted a frame to the LayerTreeFrameSink.
diff --git a/cc/trees/proxy_main.cc b/cc/trees/proxy_main.cc
index 5a399eda..73138cc 100644
--- a/cc/trees/proxy_main.cc
+++ b/cc/trees/proxy_main.cc
@@ -448,7 +448,7 @@
{
TRACE_EVENT0("cc,raf_investigation", "ProxyMain::BeginMainFrame::commit");
- absl::optional<DebugScopedSetMainThreadBlocked> main_thread_blocked;
+ std::optional<DebugScopedSetMainThreadBlocked> main_thread_blocked;
if (blocking)
main_thread_blocked.emplace(task_runner_provider_);
@@ -677,7 +677,7 @@
commits_restart_time_ = base::TimeTicks::Now() + timeout;
// Notify dependent systems that the deferral status has changed.
- layer_tree_host_->OnDeferCommitsChanged(true, reason, absl::nullopt);
+ layer_tree_host_->OnDeferCommitsChanged(true, reason, std::nullopt);
return true;
}
diff --git a/cc/trees/proxy_main.h b/cc/trees/proxy_main.h
index 185a2a3..b8125d8d 100644
--- a/cc/trees/proxy_main.h
+++ b/cc/trees/proxy_main.h
@@ -172,7 +172,7 @@
// defer_main_frame_update_ will also cause commits to be deferred, regardless
// of the setting for paint_holding_reason_.
bool defer_main_frame_update_;
- absl::optional<PaintHoldingReason> paint_holding_reason_;
+ std::optional<PaintHoldingReason> paint_holding_reason_;
bool pause_rendering_;
bool block_on_next_commit_ = false;
diff --git a/cc/trees/render_frame_metadata.h b/cc/trees/render_frame_metadata.h
index 1e01d61..65d7e811 100644
--- a/cc/trees/render_frame_metadata.h
+++ b/cc/trees/render_frame_metadata.h
@@ -5,12 +5,12 @@
#ifndef CC_TREES_RENDER_FRAME_METADATA_H_
#define CC_TREES_RENDER_FRAME_METADATA_H_
+#include <optional>
#include "build/build_config.h"
#include "cc/cc_export.h"
#include "components/viz/common/quads/selection.h"
#include "components/viz/common/surfaces/local_surface_id.h"
#include "components/viz/common/vertical_scroll_direction.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/geometry/size_f.h"
@@ -66,7 +66,7 @@
SkColor4f root_background_color = SkColors::kWhite;
// Scroll offset of the root layer.
- absl::optional<gfx::PointF> root_scroll_offset;
+ std::optional<gfx::PointF> root_scroll_offset;
// Selection region relative to the current viewport. If the selection is
// empty or otherwise unused, the bound types will indicate such.
@@ -84,7 +84,7 @@
// information to be used in making the forwarding decision. It exists the
// entire time points could be forwarded, and forwarding must stop as soon as
// it is null.
- absl::optional<DelegatedInkBrowserMetadata> delegated_ink_metadata;
+ std::optional<DelegatedInkBrowserMetadata> delegated_ink_metadata;
// The device scale factor used to generate a CompositorFrame.
float device_scale_factor = 1.f;
@@ -94,7 +94,7 @@
gfx::Size viewport_size_in_pixels;
// The last viz::LocalSurfaceId used to submit a CompositorFrame.
- absl::optional<viz::LocalSurfaceId> local_surface_id;
+ std::optional<viz::LocalSurfaceId> local_surface_id;
// Page scale factor (always 1.f for sub-frame renderers).
float page_scale_factor = 1.f;
diff --git a/cc/trees/scroll_node.h b/cc/trees/scroll_node.h
index c8edf41..dcc560b 100644
--- a/cc/trees/scroll_node.h
+++ b/cc/trees/scroll_node.h
@@ -5,13 +5,13 @@
#ifndef CC_TREES_SCROLL_NODE_H_
#define CC_TREES_SCROLL_NODE_H_
+#include <optional>
#include "cc/base/region.h"
#include "cc/cc_export.h"
#include "cc/input/overscroll_behavior.h"
#include "cc/input/scroll_snap_data.h"
#include "cc/paint/element_id.h"
#include "cc/paint/filter_operations.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
namespace base {
@@ -65,7 +65,7 @@
OverscrollBehavior overscroll_behavior;
- absl::optional<SnapContainerData> snap_container_data;
+ std::optional<SnapContainerData> snap_container_data;
bool is_composited : 1;
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc
index 9849b8a..aec81a9 100644
--- a/cc/trees/single_thread_proxy.cc
+++ b/cc/trees/single_thread_proxy.cc
@@ -397,7 +397,7 @@
commits_restart_time_ = base::TimeTicks::Now() + timeout;
// Notify dependent systems that the deferral status has changed.
- layer_tree_host_->OnDeferCommitsChanged(true, reason, absl::nullopt);
+ layer_tree_host_->OnDeferCommitsChanged(true, reason, std::nullopt);
return true;
}
@@ -882,7 +882,7 @@
draw_result = host_impl_->PrepareToDraw(frame);
draw_frame = draw_result == DrawResult::kSuccess;
if (draw_frame) {
- if (absl::optional<LayerTreeHostImpl::SubmitInfo> submit_info =
+ if (std::optional<LayerTreeHostImpl::SubmitInfo> submit_info =
host_impl_->DrawLayers(frame)) {
if (scheduler_on_impl_thread_) {
// Drawing implies we submitted a frame to the LayerTreeFrameSink.
diff --git a/cc/trees/single_thread_proxy.h b/cc/trees/single_thread_proxy.h
index 2dd8095..20d6b5de 100644
--- a/cc/trees/single_thread_proxy.h
+++ b/cc/trees/single_thread_proxy.h
@@ -214,7 +214,7 @@
bool inside_draw_;
bool defer_main_frame_update_;
bool pause_rendering_;
- absl::optional<PaintHoldingReason> paint_holding_reason_;
+ std::optional<PaintHoldingReason> paint_holding_reason_;
bool did_apply_compositor_deltas_ = false;
bool animate_requested_;
bool update_layers_requested_;
diff --git a/cc/trees/throttle_decider_unittest.cc b/cc/trees/throttle_decider_unittest.cc
index fe096e2..3b81f172 100644
--- a/cc/trees/throttle_decider_unittest.cc
+++ b/cc/trees/throttle_decider_unittest.cc
@@ -61,7 +61,7 @@
surface_quad->shared_quad_state = &sqs2;
surface_quad->material = viz::DrawQuad::Material::kSurfaceContent;
surface_quad->surface_range = viz::SurfaceRange(
- absl::nullopt,
+ std::nullopt,
viz::SurfaceId(frame_sink_id, viz::LocalSurfaceId(
1u, base::UnguessableToken::Create())));
surface_quad->rect = quad_rect;
@@ -75,7 +75,7 @@
// Put the backdrop filter within bounds (0,10 50x50).
render_passes[0]->backdrop_filter_bounds =
- absl::optional<gfx::RRectF>(gfx::RRectF(0.0f, 10.0f, 50.0f, 50.0f, 1.0f));
+ std::optional<gfx::RRectF>(gfx::RRectF(0.0f, 10.0f, 50.0f, 50.0f, 1.0f));
// The surface quad (0,0 100x100) is partially behind the backdrop filter on
// the rpdq (0,10 50x50) so it should not be throttled.
RunThrottleDecider(render_passes);
diff --git a/cc/trees/ukm_manager_unittest.cc b/cc/trees/ukm_manager_unittest.cc
index 2194cb8..339d436 100644
--- a/cc/trees/ukm_manager_unittest.cc
+++ b/cc/trees/ukm_manager_unittest.cc
@@ -167,7 +167,7 @@
return SetupEventMetrics(ScrollUpdateEventMetrics::CreateForTesting(
ui::ET_GESTURE_SCROLL_UPDATE, ui::ScrollInputType::kWheel, is_inertial,
scroll_update_type, /*delta=*/10.0f, event_time,
- arrived_in_browser_main_timestamp, &test_tick_clock_, absl::nullopt));
+ arrived_in_browser_main_timestamp, &test_tick_clock_, std::nullopt));
}
struct DispatchTimestamps {