diff options
author | danakj <danakj@chromium.org> | 2014-09-27 14:55:48 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-27 21:56:07 +0000 |
commit | f446a070a0aa29a153b0cf78b33ef22da84cb023 (patch) | |
tree | 58723080156284eca6c914ec067cbf93afac948b | |
parent | ea60a8e76d887c6b22acc495e5ea3c28540ae2ef (diff) | |
download | chromium_src-f446a070a0aa29a153b0cf78b33ef22da84cb023.zip chromium_src-f446a070a0aa29a153b0cf78b33ef22da84cb023.tar.gz chromium_src-f446a070a0aa29a153b0cf78b33ef22da84cb023.tar.bz2 |
cc: Remove use of PassAs() and constructor-casting with scoped_ptr.
Say you have class A and subclass B.
Previously it was required to PassAs() a scoped_ptr<B> into a
scoped_ptr<A>. This is no longer needed, so just use Pass(). For newly
created scoped_ptrs, you can just use make_scoped_ptr always now.
And when you want to return or assign an empty scoped_ptr(), you can
now use nullptr directly.
Also adds PRESUBMIT checks for:
- return scoped<T>(foo). This should be return make_scoped_ptr(foo).
- bar = scoped<T>(foo). This should be return bar = make_scoped_ptr(foo).
- return scoped<T>(). This should be return nullptr.
- bar = scoped<T>(). This should be return bar = nullptr.
This also replaces p.reset() with p = nullptr; But it does not add a
PRESUBMIT check for that because there are things other than scoped_ptr
with a reset() function.
R=enne@chromium.org
Committed: https://crrev.com/7bb3dbede19d87f0338797756ffd738adc6bca08
Cr-Commit-Position: refs/heads/master@{#297096}
Review URL: https://codereview.chromium.org/609663003
Cr-Commit-Position: refs/heads/master@{#297121}
124 files changed, 544 insertions, 619 deletions
diff --git a/cc/PRESUBMIT.py b/cc/PRESUBMIT.py index 6c08441..f381684 100644 --- a/cc/PRESUBMIT.py +++ b/cc/PRESUBMIT.py @@ -146,6 +146,40 @@ def CheckTodos(input_api, output_api): items=errors)] return [] +def CheckScopedPtr(input_api, output_api, + white_list=CC_SOURCE_FILES, black_list=None): + black_list = tuple(black_list or input_api.DEFAULT_BLACK_LIST) + source_file_filter = lambda x: input_api.FilterSourceFile(x, + white_list, + black_list) + errors = [] + for f in input_api.AffectedSourceFiles(source_file_filter): + for line_number, line in f.ChangedContents(): + # Disallow: + # return scoped_ptr<T>(foo); + # bar = scoped_ptr<T>(foo); + # But allow: + # return scoped_ptr<T[]>(foo); + # bar = scoped_ptr<T[]>(foo); + if re.search(r'(=|\breturn)\s*scoped_ptr<.*?(?<!])>\([^)]+\)', line): + errors.append(output_api.PresubmitError( + ('%s:%d uses explicit scoped_ptr constructor. ' + + 'Use make_scoped_ptr() instead.') % (f.LocalPath(), line_number))) + # Disallow: + # return scoped_ptr<T>(); + # bar = scoped_ptr<T>(); + if re.search(r'(=|\breturn)\s*scoped_ptr<.*?>\(\)', line): + errors.append(output_api.PresubmitError( + '%s:%d uses scoped_ptr<T>(). Use nullptr instead.' % + (f.LocalPath(), line_number))) + # Disallow: + # foo.PassAs<T>(); + if re.search(r'\bPassAs<.*?>\(\)', line): + errors.append(output_api.PresubmitError( + '%s:%d uses PassAs<T>(). Use Pass() instead.' % + (f.LocalPath(), line_number))) + return errors + def FindUnquotedQuote(contents, pos): match = re.search(r"(?<!\\)(?P<quote>\")", contents[pos:]) return -1 if not match else match.start("quote") + pos @@ -286,6 +320,7 @@ def CheckChangeOnUpload(input_api, output_api): results += CheckPassByValue(input_api, output_api) results += CheckChangeLintsClean(input_api, output_api) results += CheckTodos(input_api, output_api) + results += CheckScopedPtr(input_api, output_api) results += CheckNamespace(input_api, output_api) results += CheckForUseOfWrongClock(input_api, output_api) results += FindUselessIfdefs(input_api, output_api) diff --git a/cc/animation/animation_unittest.cc b/cc/animation/animation_unittest.cc index 378bb7e..7b70178 100644 --- a/cc/animation/animation_unittest.cc +++ b/cc/animation/animation_unittest.cc @@ -21,12 +21,11 @@ static base::TimeTicks TicksFromSecondsF(double seconds) { scoped_ptr<Animation> CreateAnimation(double iterations, double duration, double playback_rate) { - scoped_ptr<Animation> to_return(Animation::Create( - make_scoped_ptr( - new FakeFloatAnimationCurve(duration)).PassAs<AnimationCurve>(), - 0, - 1, - Animation::Opacity)); + scoped_ptr<Animation> to_return( + Animation::Create(make_scoped_ptr(new FakeFloatAnimationCurve(duration)), + 0, + 1, + Animation::Opacity)); to_return->set_iterations(iterations); to_return->set_playback_rate(playback_rate); return to_return.Pass(); diff --git a/cc/animation/keyframed_animation_curve.cc b/cc/animation/keyframed_animation_curve.cc index e98a2e6..f4e9e27 100644 --- a/cc/animation/keyframed_animation_curve.cc +++ b/cc/animation/keyframed_animation_curve.cc @@ -14,19 +14,19 @@ namespace { template <class Keyframe> void InsertKeyframe(scoped_ptr<Keyframe> keyframe, - ScopedPtrVector<Keyframe>& keyframes) { + ScopedPtrVector<Keyframe>* keyframes) { // Usually, the keyframes will be added in order, so this loop would be // unnecessary and we should skip it if possible. - if (!keyframes.empty() && keyframe->Time() < keyframes.back()->Time()) { - for (size_t i = 0; i < keyframes.size(); ++i) { - if (keyframe->Time() < keyframes[i]->Time()) { - keyframes.insert(keyframes.begin() + i, keyframe.Pass()); + if (!keyframes->empty() && keyframe->Time() < keyframes->back()->Time()) { + for (size_t i = 0; i < keyframes->size(); ++i) { + if (keyframe->Time() < keyframes->at(i)->Time()) { + keyframes->insert(keyframes->begin() + i, keyframe.Pass()); return; } } } - keyframes.push_back(keyframe.Pass()); + keyframes->push_back(keyframe.Pass()); } template <class Keyframes> @@ -169,7 +169,7 @@ KeyframedColorAnimationCurve::~KeyframedColorAnimationCurve() {} void KeyframedColorAnimationCurve::AddKeyframe( scoped_ptr<ColorKeyframe> keyframe) { - InsertKeyframe(keyframe.Pass(), keyframes_); + InsertKeyframe(keyframe.Pass(), &keyframes_); } double KeyframedColorAnimationCurve::Duration() const { @@ -177,11 +177,11 @@ double KeyframedColorAnimationCurve::Duration() const { } scoped_ptr<AnimationCurve> KeyframedColorAnimationCurve::Clone() const { - scoped_ptr<KeyframedColorAnimationCurve> to_return( - KeyframedColorAnimationCurve::Create()); + scoped_ptr<KeyframedColorAnimationCurve> to_return = + KeyframedColorAnimationCurve::Create(); for (size_t i = 0; i < keyframes_.size(); ++i) to_return->AddKeyframe(keyframes_[i]->Clone()); - return to_return.PassAs<AnimationCurve>(); + return to_return.Pass(); } SkColor KeyframedColorAnimationCurve::GetValue(double t) const { @@ -216,7 +216,7 @@ KeyframedFloatAnimationCurve::~KeyframedFloatAnimationCurve() {} void KeyframedFloatAnimationCurve::AddKeyframe( scoped_ptr<FloatKeyframe> keyframe) { - InsertKeyframe(keyframe.Pass(), keyframes_); + InsertKeyframe(keyframe.Pass(), &keyframes_); } double KeyframedFloatAnimationCurve::Duration() const { @@ -224,11 +224,11 @@ double KeyframedFloatAnimationCurve::Duration() const { } scoped_ptr<AnimationCurve> KeyframedFloatAnimationCurve::Clone() const { - scoped_ptr<KeyframedFloatAnimationCurve> to_return( - KeyframedFloatAnimationCurve::Create()); + scoped_ptr<KeyframedFloatAnimationCurve> to_return = + KeyframedFloatAnimationCurve::Create(); for (size_t i = 0; i < keyframes_.size(); ++i) to_return->AddKeyframe(keyframes_[i]->Clone()); - return to_return.PassAs<AnimationCurve>(); + return to_return.Pass(); } float KeyframedFloatAnimationCurve::GetValue(double t) const { @@ -261,7 +261,7 @@ KeyframedTransformAnimationCurve::~KeyframedTransformAnimationCurve() {} void KeyframedTransformAnimationCurve::AddKeyframe( scoped_ptr<TransformKeyframe> keyframe) { - InsertKeyframe(keyframe.Pass(), keyframes_); + InsertKeyframe(keyframe.Pass(), &keyframes_); } double KeyframedTransformAnimationCurve::Duration() const { @@ -269,11 +269,11 @@ double KeyframedTransformAnimationCurve::Duration() const { } scoped_ptr<AnimationCurve> KeyframedTransformAnimationCurve::Clone() const { - scoped_ptr<KeyframedTransformAnimationCurve> to_return( - KeyframedTransformAnimationCurve::Create()); + scoped_ptr<KeyframedTransformAnimationCurve> to_return = + KeyframedTransformAnimationCurve::Create(); for (size_t i = 0; i < keyframes_.size(); ++i) to_return->AddKeyframe(keyframes_[i]->Clone()); - return to_return.PassAs<AnimationCurve>(); + return to_return.Pass(); } // Assumes that (*keyframes).front()->Time() < t < (*keyframes).back()-Time(). @@ -376,7 +376,7 @@ KeyframedFilterAnimationCurve::~KeyframedFilterAnimationCurve() {} void KeyframedFilterAnimationCurve::AddKeyframe( scoped_ptr<FilterKeyframe> keyframe) { - InsertKeyframe(keyframe.Pass(), keyframes_); + InsertKeyframe(keyframe.Pass(), &keyframes_); } double KeyframedFilterAnimationCurve::Duration() const { @@ -384,11 +384,11 @@ double KeyframedFilterAnimationCurve::Duration() const { } scoped_ptr<AnimationCurve> KeyframedFilterAnimationCurve::Clone() const { - scoped_ptr<KeyframedFilterAnimationCurve> to_return( - KeyframedFilterAnimationCurve::Create()); + scoped_ptr<KeyframedFilterAnimationCurve> to_return = + KeyframedFilterAnimationCurve::Create(); for (size_t i = 0; i < keyframes_.size(); ++i) to_return->AddKeyframe(keyframes_[i]->Clone()); - return to_return.PassAs<AnimationCurve>(); + return to_return.Pass(); } FilterOperations KeyframedFilterAnimationCurve::GetValue(double t) const { diff --git a/cc/animation/keyframed_animation_curve_unittest.cc b/cc/animation/keyframed_animation_curve_unittest.cc index eceba6f..d9e2a3b 100644 --- a/cc/animation/keyframed_animation_curve_unittest.cc +++ b/cc/animation/keyframed_animation_curve_unittest.cc @@ -411,10 +411,7 @@ TEST(KeyframedAnimationCurveTest, CubicBezierTimingFunction) { scoped_ptr<KeyframedFloatAnimationCurve> curve( KeyframedFloatAnimationCurve::Create()); curve->AddKeyframe(FloatKeyframe::Create( - 0.0, - 0.f, - CubicBezierTimingFunction::Create(0.25f, 0.f, 0.75f, 1.f) - .PassAs<TimingFunction>())); + 0.0, 0.f, CubicBezierTimingFunction::Create(0.25f, 0.f, 0.75f, 1.f))); curve->AddKeyframe( FloatKeyframe::Create(1.0, 1.f, scoped_ptr<TimingFunction>())); diff --git a/cc/animation/layer_animation_controller_unittest.cc b/cc/animation/layer_animation_controller_unittest.cc index 3f8a89f..5ecf857 100644 --- a/cc/animation/layer_animation_controller_unittest.cc +++ b/cc/animation/layer_animation_controller_unittest.cc @@ -516,8 +516,8 @@ TEST(LayerAnimationControllerTest, TrivialTransformOnImpl) { curve->AddKeyframe( TransformKeyframe::Create(1, operations, scoped_ptr<TimingFunction>())); - scoped_ptr<Animation> animation(Animation::Create( - curve.PassAs<AnimationCurve>(), 1, 0, Animation::Transform)); + scoped_ptr<Animation> animation( + Animation::Create(curve.Pass(), 1, 0, Animation::Transform)); animation->set_is_impl_only(true); controller_impl->AddAnimation(animation.Pass()); @@ -568,8 +568,8 @@ TEST(LayerAnimationControllerTest, FilterTransition) { curve->AddKeyframe( FilterKeyframe::Create(1, end_filters, scoped_ptr<TimingFunction>())); - scoped_ptr<Animation> animation(Animation::Create( - curve.PassAs<AnimationCurve>(), 1, 0, Animation::Filter)); + scoped_ptr<Animation> animation( + Animation::Create(curve.Pass(), 1, 0, Animation::Filter)); controller->AddAnimation(animation.Pass()); controller->Animate(kInitialTickTime); @@ -617,8 +617,8 @@ TEST(LayerAnimationControllerTest, FilterTransitionOnImplOnly) { curve->AddKeyframe( FilterKeyframe::Create(1, end_filters, scoped_ptr<TimingFunction>())); - scoped_ptr<Animation> animation(Animation::Create( - curve.PassAs<AnimationCurve>(), 1, 0, Animation::Filter)); + scoped_ptr<Animation> animation( + Animation::Create(curve.Pass(), 1, 0, Animation::Filter)); animation->set_is_impl_only(true); controller_impl->AddAnimation(animation.Pass()); @@ -670,8 +670,8 @@ TEST(LayerAnimationControllerTest, ScrollOffsetTransition) { target_value, EaseInOutTimingFunction::Create().Pass())); - scoped_ptr<Animation> animation(Animation::Create( - curve.PassAs<AnimationCurve>(), 1, 0, Animation::ScrollOffset)); + scoped_ptr<Animation> animation( + Animation::Create(curve.Pass(), 1, 0, Animation::ScrollOffset)); animation->set_needs_synchronized_start_time(true); controller->AddAnimation(animation.Pass()); @@ -752,8 +752,8 @@ TEST(LayerAnimationControllerTest, ScrollOffsetTransitionNoImplProvider) { target_value, EaseInOutTimingFunction::Create().Pass())); - scoped_ptr<Animation> animation(Animation::Create( - curve.PassAs<AnimationCurve>(), 1, 0, Animation::ScrollOffset)); + scoped_ptr<Animation> animation( + Animation::Create(curve.Pass(), 1, 0, Animation::ScrollOffset)); animation->set_needs_synchronized_start_time(true); controller->AddAnimation(animation.Pass()); @@ -828,8 +828,8 @@ TEST(LayerAnimationControllerTest, ScrollOffsetTransitionOnImplOnly) { curve->SetInitialValue(initial_value); double duration_in_seconds = curve->Duration(); - scoped_ptr<Animation> animation(Animation::Create( - curve.PassAs<AnimationCurve>(), 1, 0, Animation::ScrollOffset)); + scoped_ptr<Animation> animation( + Animation::Create(curve.Pass(), 1, 0, Animation::ScrollOffset)); animation->set_is_impl_only(true); controller_impl->AddAnimation(animation.Pass()); @@ -1483,8 +1483,8 @@ TEST(LayerAnimationControllerTest, TransformAnimationBounds) { curve1->AddKeyframe(TransformKeyframe::Create( 1.0, operations1, scoped_ptr<TimingFunction>())); - scoped_ptr<Animation> animation(Animation::Create( - curve1.PassAs<AnimationCurve>(), 1, 1, Animation::Transform)); + scoped_ptr<Animation> animation( + Animation::Create(curve1.Pass(), 1, 1, Animation::Transform)); controller_impl->AddAnimation(animation.Pass()); scoped_ptr<KeyframedTransformAnimationCurve> curve2( @@ -1497,8 +1497,7 @@ TEST(LayerAnimationControllerTest, TransformAnimationBounds) { curve2->AddKeyframe(TransformKeyframe::Create( 1.0, operations2, scoped_ptr<TimingFunction>())); - animation = Animation::Create( - curve2.PassAs<AnimationCurve>(), 2, 2, Animation::Transform); + animation = Animation::Create(curve2.Pass(), 2, 2, Animation::Transform); controller_impl->AddAnimation(animation.Pass()); gfx::BoxF box(1.f, 2.f, -1.f, 3.f, 4.f, 5.f); @@ -1533,8 +1532,7 @@ TEST(LayerAnimationControllerTest, TransformAnimationBounds) { operations3.AppendMatrix(transform3); curve3->AddKeyframe(TransformKeyframe::Create( 1.0, operations3, scoped_ptr<TimingFunction>())); - animation = Animation::Create( - curve3.PassAs<AnimationCurve>(), 3, 3, Animation::Transform); + animation = Animation::Create(curve3.Pass(), 3, 3, Animation::Transform); controller_impl->AddAnimation(animation.Pass()); EXPECT_FALSE(controller_impl->TransformAnimationBoundsForBox(box, &bounds)); } @@ -1807,8 +1805,8 @@ TEST(LayerAnimationControllerTest, HasAnimationThatAffectsScale) { curve1->AddKeyframe(TransformKeyframe::Create( 1.0, operations1, scoped_ptr<TimingFunction>())); - scoped_ptr<Animation> animation(Animation::Create( - curve1.PassAs<AnimationCurve>(), 2, 2, Animation::Transform)); + scoped_ptr<Animation> animation( + Animation::Create(curve1.Pass(), 2, 2, Animation::Transform)); controller_impl->AddAnimation(animation.Pass()); // Translations don't affect scale. @@ -1824,8 +1822,7 @@ TEST(LayerAnimationControllerTest, HasAnimationThatAffectsScale) { curve2->AddKeyframe(TransformKeyframe::Create( 1.0, operations2, scoped_ptr<TimingFunction>())); - animation = Animation::Create( - curve2.PassAs<AnimationCurve>(), 3, 3, Animation::Transform); + animation = Animation::Create(curve2.Pass(), 3, 3, Animation::Transform); controller_impl->AddAnimation(animation.Pass()); EXPECT_TRUE(controller_impl->HasAnimationThatAffectsScale()); @@ -1862,8 +1859,8 @@ TEST(LayerAnimationControllerTest, HasOnlyTranslationTransforms) { curve1->AddKeyframe(TransformKeyframe::Create( 1.0, operations1, scoped_ptr<TimingFunction>())); - scoped_ptr<Animation> animation(Animation::Create( - curve1.PassAs<AnimationCurve>(), 2, 2, Animation::Transform)); + scoped_ptr<Animation> animation( + Animation::Create(curve1.Pass(), 2, 2, Animation::Transform)); controller_impl->AddAnimation(animation.Pass()); // The only transform animation we've added is a translation. @@ -1879,8 +1876,7 @@ TEST(LayerAnimationControllerTest, HasOnlyTranslationTransforms) { curve2->AddKeyframe(TransformKeyframe::Create( 1.0, operations2, scoped_ptr<TimingFunction>())); - animation = Animation::Create( - curve2.PassAs<AnimationCurve>(), 3, 3, Animation::Transform); + animation = Animation::Create(curve2.Pass(), 3, 3, Animation::Transform); controller_impl->AddAnimation(animation.Pass()); // A scale animation is not a translation. @@ -1912,8 +1908,8 @@ TEST(LayerAnimationControllerTest, MaximumScale) { curve1->AddKeyframe(TransformKeyframe::Create( 1.0, operations1, scoped_ptr<TimingFunction>())); - scoped_ptr<Animation> animation(Animation::Create( - curve1.PassAs<AnimationCurve>(), 1, 1, Animation::Transform)); + scoped_ptr<Animation> animation( + Animation::Create(curve1.Pass(), 1, 1, Animation::Transform)); controller_impl->AddAnimation(animation.Pass()); EXPECT_TRUE(controller_impl->MaximumScale(&max_scale)); @@ -1929,8 +1925,7 @@ TEST(LayerAnimationControllerTest, MaximumScale) { curve2->AddKeyframe(TransformKeyframe::Create( 1.0, operations2, scoped_ptr<TimingFunction>())); - animation = Animation::Create( - curve2.PassAs<AnimationCurve>(), 2, 2, Animation::Transform); + animation = Animation::Create(curve2.Pass(), 2, 2, Animation::Transform); controller_impl->AddAnimation(animation.Pass()); EXPECT_TRUE(controller_impl->MaximumScale(&max_scale)); @@ -1946,8 +1941,7 @@ TEST(LayerAnimationControllerTest, MaximumScale) { curve3->AddKeyframe(TransformKeyframe::Create( 1.0, operations3, scoped_ptr<TimingFunction>())); - animation = Animation::Create( - curve3.PassAs<AnimationCurve>(), 3, 3, Animation::Transform); + animation = Animation::Create(curve3.Pass(), 3, 3, Animation::Transform); controller_impl->AddAnimation(animation.Pass()); EXPECT_FALSE(controller_impl->MaximumScale(&max_scale)); diff --git a/cc/animation/scroll_offset_animation_curve.cc b/cc/animation/scroll_offset_animation_curve.cc index 8211a95..5d51621 100644 --- a/cc/animation/scroll_offset_animation_curve.cc +++ b/cc/animation/scroll_offset_animation_curve.cc @@ -38,8 +38,7 @@ static scoped_ptr<TimingFunction> EaseOutWithInitialVelocity(double velocity) { const double v2 = velocity * velocity; const double x1 = std::sqrt(r2 / (v2 + 1)); const double y1 = std::sqrt(r2 * v2 / (v2 + 1)); - return CubicBezierTimingFunction::Create(x1, y1, 0.58, 1) - .PassAs<TimingFunction>(); + return CubicBezierTimingFunction::Create(x1, y1, 0.58, 1); } } // namespace @@ -98,7 +97,7 @@ scoped_ptr<AnimationCurve> ScrollOffsetAnimationCurve::Clone() const { curve_clone->initial_value_ = initial_value_; curve_clone->total_animation_duration_ = total_animation_duration_; curve_clone->last_retarget_ = last_retarget_; - return curve_clone.PassAs<AnimationCurve>(); + return curve_clone.Pass(); } void ScrollOffsetAnimationCurve::UpdateTarget( diff --git a/cc/animation/timing_function.cc b/cc/animation/timing_function.cc index 97e0d4b..2531cc6 100644 --- a/cc/animation/timing_function.cc +++ b/cc/animation/timing_function.cc @@ -42,30 +42,25 @@ void CubicBezierTimingFunction::Range(float* min, float* max) const { } scoped_ptr<TimingFunction> CubicBezierTimingFunction::Clone() const { - return make_scoped_ptr(new CubicBezierTimingFunction(*this)) - .PassAs<TimingFunction>(); + return make_scoped_ptr(new CubicBezierTimingFunction(*this)); } // These numbers come from // http://www.w3.org/TR/css3-transitions/#transition-timing-function_tag. scoped_ptr<TimingFunction> EaseTimingFunction::Create() { - return CubicBezierTimingFunction::Create( - 0.25, 0.1, 0.25, 1.0).PassAs<TimingFunction>(); + return CubicBezierTimingFunction::Create(0.25, 0.1, 0.25, 1.0); } scoped_ptr<TimingFunction> EaseInTimingFunction::Create() { - return CubicBezierTimingFunction::Create( - 0.42, 0.0, 1.0, 1.0).PassAs<TimingFunction>(); + return CubicBezierTimingFunction::Create(0.42, 0.0, 1.0, 1.0); } scoped_ptr<TimingFunction> EaseOutTimingFunction::Create() { - return CubicBezierTimingFunction::Create( - 0.0, 0.0, 0.58, 1.0).PassAs<TimingFunction>(); + return CubicBezierTimingFunction::Create(0.0, 0.0, 0.58, 1.0); } scoped_ptr<TimingFunction> EaseInOutTimingFunction::Create() { - return CubicBezierTimingFunction::Create( - 0.42, 0.0, 0.58, 1).PassAs<TimingFunction>(); + return CubicBezierTimingFunction::Create(0.42, 0.0, 0.58, 1); } } // namespace cc diff --git a/cc/base/math_util.cc b/cc/base/math_util.cc index 5b01da9..7ed0c9a 100644 --- a/cc/base/math_util.cc +++ b/cc/base/math_util.cc @@ -693,7 +693,7 @@ scoped_ptr<base::Value> MathUtil::AsValue(const gfx::Size& s) { scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue()); res->SetDouble("width", s.width()); res->SetDouble("height", s.height()); - return res.PassAs<base::Value>(); + return res.Pass(); } scoped_ptr<base::Value> MathUtil::AsValue(const gfx::Rect& r) { @@ -702,7 +702,7 @@ scoped_ptr<base::Value> MathUtil::AsValue(const gfx::Rect& r) { res->AppendInteger(r.y()); res->AppendInteger(r.width()); res->AppendInteger(r.height()); - return res.PassAs<base::Value>(); + return res.Pass(); } bool MathUtil::FromValue(const base::Value* raw_value, gfx::Rect* out_rect) { @@ -730,7 +730,7 @@ scoped_ptr<base::Value> MathUtil::AsValue(const gfx::PointF& pt) { scoped_ptr<base::ListValue> res(new base::ListValue()); res->AppendDouble(pt.x()); res->AppendDouble(pt.y()); - return res.PassAs<base::Value>(); + return res.Pass(); } void MathUtil::AddToTracedValue(const gfx::Size& s, diff --git a/cc/base/region.cc b/cc/base/region.cc index 2484cc2..d752b20 100644 --- a/cc/base/region.cc +++ b/cc/base/region.cc @@ -127,7 +127,7 @@ scoped_ptr<base::Value> Region::AsValue() const { result->AppendInteger(rect.width()); result->AppendInteger(rect.height()); } - return result.PassAs<base::Value>(); + return result.Pass(); } void Region::AsValueInto(base::debug::TracedValue* result) const { diff --git a/cc/base/scoped_ptr_vector.h b/cc/base/scoped_ptr_vector.h index 7f86ce3..0b83e35 100644 --- a/cc/base/scoped_ptr_vector.h +++ b/cc/base/scoped_ptr_vector.h @@ -72,7 +72,7 @@ class ScopedPtrVector { scoped_ptr<T> take(iterator position) { if (position == end()) - return scoped_ptr<T>(); + return nullptr; DCHECK(position < end()); typename std::vector<T*>::iterator writable_position = position; @@ -84,7 +84,7 @@ class ScopedPtrVector { scoped_ptr<T> take_back() { DCHECK(!empty()); if (empty()) - return scoped_ptr<T>(NULL); + return nullptr; return take(end() - 1); } diff --git a/cc/blink/web_animation_curve_common.cc b/cc/blink/web_animation_curve_common.cc index 5abcf10..8230fab 100644 --- a/cc/blink/web_animation_curve_common.cc +++ b/cc/blink/web_animation_curve_common.cc @@ -20,9 +20,9 @@ scoped_ptr<cc::TimingFunction> CreateTimingFunction( case blink::WebCompositorAnimationCurve::TimingFunctionTypeEaseInOut: return cc::EaseInOutTimingFunction::Create(); case blink::WebCompositorAnimationCurve::TimingFunctionTypeLinear: - return scoped_ptr<cc::TimingFunction>(); + return nullptr; } - return scoped_ptr<cc::TimingFunction>(); + return nullptr; } } // namespace cc_blink diff --git a/cc/blink/web_filter_animation_curve_impl.cc b/cc/blink/web_filter_animation_curve_impl.cc index cfbe191..3761a51 100644 --- a/cc/blink/web_filter_animation_curve_impl.cc +++ b/cc/blink/web_filter_animation_curve_impl.cc @@ -46,8 +46,7 @@ void WebFilterAnimationCurveImpl::add(const WebFilterKeyframe& keyframe, curve_->AddKeyframe(cc::FilterKeyframe::Create( keyframe.time(), filter_operations, - cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2) - .PassAs<cc::TimingFunction>())); + cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2))); } scoped_ptr<cc::AnimationCurve> diff --git a/cc/blink/web_float_animation_curve_impl.cc b/cc/blink/web_float_animation_curve_impl.cc index e4c5fa9..243d133 100644 --- a/cc/blink/web_float_animation_curve_impl.cc +++ b/cc/blink/web_float_animation_curve_impl.cc @@ -43,8 +43,7 @@ void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, curve_->AddKeyframe(cc::FloatKeyframe::Create( keyframe.time, keyframe.value, - cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2) - .PassAs<cc::TimingFunction>())); + cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2))); } float WebFloatAnimationCurveImpl::getValue(double time) const { diff --git a/cc/blink/web_transform_animation_curve_impl.cc b/cc/blink/web_transform_animation_curve_impl.cc index a6d19da..3b2313f 100644 --- a/cc/blink/web_transform_animation_curve_impl.cc +++ b/cc/blink/web_transform_animation_curve_impl.cc @@ -50,8 +50,7 @@ void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, curve_->AddKeyframe(cc::TransformKeyframe::Create( keyframe.time(), transform_operations, - cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2) - .PassAs<cc::TimingFunction>())); + cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2))); } scoped_ptr<cc::AnimationCurve> diff --git a/cc/debug/micro_benchmark_controller.cc b/cc/debug/micro_benchmark_controller.cc index 8b20bdf..bf98100 100644 --- a/cc/debug/micro_benchmark_controller.cc +++ b/cc/debug/micro_benchmark_controller.cc @@ -28,19 +28,16 @@ scoped_ptr<MicroBenchmark> CreateBenchmark( scoped_ptr<base::Value> value, const MicroBenchmark::DoneCallback& callback) { if (name == "invalidation_benchmark") { - return scoped_ptr<MicroBenchmark>( - new InvalidationBenchmark(value.Pass(), callback)); + return make_scoped_ptr(new InvalidationBenchmark(value.Pass(), callback)); } else if (name == "picture_record_benchmark") { - return scoped_ptr<MicroBenchmark>( - new PictureRecordBenchmark(value.Pass(), callback)); + return make_scoped_ptr(new PictureRecordBenchmark(value.Pass(), callback)); } else if (name == "rasterize_and_record_benchmark") { - return scoped_ptr<MicroBenchmark>( + return make_scoped_ptr( new RasterizeAndRecordBenchmark(value.Pass(), callback)); } else if (name == "unittest_only_benchmark") { - return scoped_ptr<MicroBenchmark>( - new UnittestOnlyBenchmark(value.Pass(), callback)); + return make_scoped_ptr(new UnittestOnlyBenchmark(value.Pass(), callback)); } - return scoped_ptr<MicroBenchmark>(); + return nullptr; } class IsDonePredicate { diff --git a/cc/debug/micro_benchmark_controller_unittest.cc b/cc/debug/micro_benchmark_controller_unittest.cc index 50021da..1f2bfd8 100644 --- a/cc/debug/micro_benchmark_controller_unittest.cc +++ b/cc/debug/micro_benchmark_controller_unittest.cc @@ -33,9 +33,9 @@ class MicroBenchmarkControllerTest : public testing::Test { } virtual void TearDown() OVERRIDE { - layer_tree_host_impl_.reset(); - layer_tree_host_.reset(); - impl_proxy_.reset(); + layer_tree_host_impl_ = nullptr; + layer_tree_host_ = nullptr; + impl_proxy_ = nullptr; } FakeLayerTreeHostClient layer_tree_host_client_; @@ -126,7 +126,7 @@ TEST_F(MicroBenchmarkControllerTest, BenchmarkImplRan) { // Schedule a main thread benchmark. int id = layer_tree_host_->ScheduleMicroBenchmark( "unittest_only_benchmark", - settings.PassAs<base::Value>(), + settings.Pass(), base::Bind(&IncrementCallCount, base::Unretained(&run_count))); EXPECT_GT(id, 0); @@ -147,8 +147,8 @@ TEST_F(MicroBenchmarkControllerTest, SendMessage) { // Send valid message to invalid benchmark (id = 0) scoped_ptr<base::DictionaryValue> message(new base::DictionaryValue); message->SetBoolean("can_handle", true); - bool message_handled = layer_tree_host_->SendMessageToMicroBenchmark( - 0, message.PassAs<base::Value>()); + bool message_handled = + layer_tree_host_->SendMessageToMicroBenchmark(0, message.Pass()); EXPECT_FALSE(message_handled); // Schedule a benchmark @@ -160,17 +160,17 @@ TEST_F(MicroBenchmarkControllerTest, SendMessage) { EXPECT_GT(id, 0); // Send valid message to valid benchmark - message = scoped_ptr<base::DictionaryValue>(new base::DictionaryValue); + message = make_scoped_ptr(new base::DictionaryValue); message->SetBoolean("can_handle", true); - message_handled = layer_tree_host_->SendMessageToMicroBenchmark( - id, message.PassAs<base::Value>()); + message_handled = + layer_tree_host_->SendMessageToMicroBenchmark(id, message.Pass()); EXPECT_TRUE(message_handled); // Send invalid message to valid benchmark - message = scoped_ptr<base::DictionaryValue>(new base::DictionaryValue); + message = make_scoped_ptr(new base::DictionaryValue); message->SetBoolean("can_handle", false); - message_handled = layer_tree_host_->SendMessageToMicroBenchmark( - id, message.PassAs<base::Value>()); + message_handled = + layer_tree_host_->SendMessageToMicroBenchmark(id, message.Pass()); EXPECT_FALSE(message_handled); } diff --git a/cc/debug/picture_record_benchmark.cc b/cc/debug/picture_record_benchmark.cc index e6a5a65..2bda59d 100644 --- a/cc/debug/picture_record_benchmark.cc +++ b/cc/debug/picture_record_benchmark.cc @@ -80,7 +80,7 @@ void PictureRecordBenchmark::DidUpdateLayers(LayerTreeHost* host) { results->Append(result.release()); } - NotifyDone(results.PassAs<base::Value>()); + NotifyDone(results.Pass()); } void PictureRecordBenchmark::Run(Layer* layer) { diff --git a/cc/debug/rasterize_and_record_benchmark.cc b/cc/debug/rasterize_and_record_benchmark.cc index c2a47d0..9d1bfe6 100644 --- a/cc/debug/rasterize_and_record_benchmark.cc +++ b/cc/debug/rasterize_and_record_benchmark.cc @@ -80,12 +80,12 @@ void RasterizeAndRecordBenchmark::RecordRasterResults( results_->MergeDictionary(results); - NotifyDone(results_.PassAs<base::Value>()); + NotifyDone(results_.Pass()); } scoped_ptr<MicroBenchmarkImpl> RasterizeAndRecordBenchmark::CreateBenchmarkImpl( scoped_refptr<base::MessageLoopProxy> origin_loop) { - return scoped_ptr<MicroBenchmarkImpl>(new RasterizeAndRecordBenchmarkImpl( + return make_scoped_ptr(new RasterizeAndRecordBenchmarkImpl( origin_loop, settings_.get(), base::Bind(&RasterizeAndRecordBenchmark::RecordRasterResults, diff --git a/cc/debug/rasterize_and_record_benchmark_impl.cc b/cc/debug/rasterize_and_record_benchmark_impl.cc index d0a4726..dbf74a42 100644 --- a/cc/debug/rasterize_and_record_benchmark_impl.cc +++ b/cc/debug/rasterize_and_record_benchmark_impl.cc @@ -184,7 +184,7 @@ void RasterizeAndRecordBenchmarkImpl::DidCompleteCommit( result->SetInteger("total_picture_layers_off_screen", rasterize_results_.total_picture_layers_off_screen); - NotifyDone(result.PassAs<base::Value>()); + NotifyDone(result.Pass()); } void RasterizeAndRecordBenchmarkImpl::Run(LayerImpl* layer) { diff --git a/cc/debug/unittest_only_benchmark.cc b/cc/debug/unittest_only_benchmark.cc index 0f0694a..e8146ad 100644 --- a/cc/debug/unittest_only_benchmark.cc +++ b/cc/debug/unittest_only_benchmark.cc @@ -57,7 +57,7 @@ scoped_ptr<MicroBenchmarkImpl> UnittestOnlyBenchmark::CreateBenchmarkImpl( if (!create_impl_benchmark_) return make_scoped_ptr<MicroBenchmarkImpl>(NULL); - return scoped_ptr<MicroBenchmarkImpl>(new UnittestOnlyBenchmarkImpl( + return make_scoped_ptr(new UnittestOnlyBenchmarkImpl( origin_loop, NULL, base::Bind(&UnittestOnlyBenchmark::RecordImplResults, diff --git a/cc/input/top_controls_manager.cc b/cc/input/top_controls_manager.cc index e972247..79353f2 100644 --- a/cc/input/top_controls_manager.cc +++ b/cc/input/top_controls_manager.cc @@ -180,9 +180,7 @@ gfx::Vector2dF TopControlsManager::Animate(base::TimeTicks monotonic_time) { } void TopControlsManager::ResetAnimations() { - if (top_controls_animation_) - top_controls_animation_.reset(); - + top_controls_animation_ = nullptr; animation_direction_ = NO_ANIMATION; } diff --git a/cc/layers/content_layer.cc b/cc/layers/content_layer.cc index 8986686..3bd2379 100644 --- a/cc/layers/content_layer.cc +++ b/cc/layers/content_layer.cc @@ -99,8 +99,7 @@ LayerUpdater* ContentLayer::Updater() const { void ContentLayer::CreateUpdaterIfNeeded() { if (updater_.get()) return; - scoped_ptr<LayerPainter> painter = - ContentLayerPainter::Create(client_).PassAs<LayerPainter>(); + scoped_ptr<LayerPainter> painter = ContentLayerPainter::Create(client_); if (layer_tree_host()->settings().per_tile_painting_enabled) { updater_ = BitmapSkPictureContentLayerUpdater::Create( painter.Pass(), diff --git a/cc/layers/delegated_renderer_layer.cc b/cc/layers/delegated_renderer_layer.cc index 6ccdbec..bf90305 100644 --- a/cc/layers/delegated_renderer_layer.cc +++ b/cc/layers/delegated_renderer_layer.cc @@ -33,8 +33,7 @@ DelegatedRendererLayer::~DelegatedRendererLayer() { scoped_ptr<LayerImpl> DelegatedRendererLayer::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return DelegatedRendererLayerImpl::Create( - tree_impl, layer_id_).PassAs<LayerImpl>(); + return DelegatedRendererLayerImpl::Create(tree_impl, layer_id_); } void DelegatedRendererLayer::SetLayerTreeHost(LayerTreeHost* host) { diff --git a/cc/layers/delegated_renderer_layer_impl.cc b/cc/layers/delegated_renderer_layer_impl.cc index bd19086..c8af1fa 100644 --- a/cc/layers/delegated_renderer_layer_impl.cc +++ b/cc/layers/delegated_renderer_layer_impl.cc @@ -183,8 +183,7 @@ void DelegatedRendererLayerImpl::ClearRenderPasses() { scoped_ptr<LayerImpl> DelegatedRendererLayerImpl::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return DelegatedRendererLayerImpl::Create( - tree_impl, id()).PassAs<LayerImpl>(); + return DelegatedRendererLayerImpl::Create(tree_impl, id()); } void DelegatedRendererLayerImpl::ReleaseResources() { diff --git a/cc/layers/delegated_renderer_layer_impl_unittest.cc b/cc/layers/delegated_renderer_layer_impl_unittest.cc index d219f5a..832a483 100644 --- a/cc/layers/delegated_renderer_layer_impl_unittest.cc +++ b/cc/layers/delegated_renderer_layer_impl_unittest.cc @@ -40,8 +40,7 @@ class DelegatedRendererLayerImplTest : public testing::Test { host_impl_.reset( new FakeLayerTreeHostImpl(settings, &proxy_, &shared_bitmap_manager_)); - host_impl_->InitializeRenderer( - FakeOutputSurface::Create3d().PassAs<OutputSurface>()); + host_impl_->InitializeRenderer(FakeOutputSurface::Create3d()); host_impl_->SetViewportSize(gfx::Size(10, 10)); } @@ -58,12 +57,12 @@ class DelegatedRendererLayerImplTestSimple public: DelegatedRendererLayerImplTestSimple() : DelegatedRendererLayerImplTest() { - scoped_ptr<LayerImpl> root_layer = SolidColorLayerImpl::Create( - host_impl_->active_tree(), 1).PassAs<LayerImpl>(); - scoped_ptr<LayerImpl> layer_before = SolidColorLayerImpl::Create( - host_impl_->active_tree(), 2).PassAs<LayerImpl>(); - scoped_ptr<LayerImpl> layer_after = SolidColorLayerImpl::Create( - host_impl_->active_tree(), 3).PassAs<LayerImpl>(); + scoped_ptr<LayerImpl> root_layer = + SolidColorLayerImpl::Create(host_impl_->active_tree(), 1); + scoped_ptr<LayerImpl> layer_before = + SolidColorLayerImpl::Create(host_impl_->active_tree(), 2); + scoped_ptr<LayerImpl> layer_after = + SolidColorLayerImpl::Create(host_impl_->active_tree(), 3); scoped_ptr<FakeDelegatedRendererLayerImpl> delegated_renderer_layer = FakeDelegatedRendererLayerImpl::Create(host_impl_->active_tree(), 4); @@ -120,7 +119,7 @@ class DelegatedRendererLayerImplTestSimple // Force the delegated RenderPasses to come before the RenderPass from // layer_after. - layer_after->AddChild(delegated_renderer_layer.PassAs<LayerImpl>()); + layer_after->AddChild(delegated_renderer_layer.Pass()); root_layer->AddChild(layer_after.Pass()); // Get the RenderPass generated by layer_before to come before the delegated @@ -633,7 +632,7 @@ class DelegatedRendererLayerImplTestTransform root_layer_ = root_layer.get(); delegated_renderer_layer_ = delegated_renderer_layer.get(); - root_layer->AddChild(delegated_renderer_layer.PassAs<LayerImpl>()); + root_layer->AddChild(delegated_renderer_layer.Pass()); host_impl_->active_tree()->SetRootLayer(root_layer.Pass()); } @@ -1076,11 +1075,11 @@ class DelegatedRendererLayerImplTestClip origin_layer->SetPosition( gfx::PointAtOffsetFromOrigin(-clip_rect.OffsetFromOrigin())); - origin_layer->AddChild(delegated_renderer_layer.PassAs<LayerImpl>()); + origin_layer->AddChild(delegated_renderer_layer.Pass()); clip_layer->AddChild(origin_layer.Pass()); root_layer->AddChild(clip_layer.Pass()); } else { - root_layer->AddChild(delegated_renderer_layer.PassAs<LayerImpl>()); + root_layer->AddChild(delegated_renderer_layer.Pass()); } host_impl_->active_tree()->SetRootLayer(root_layer.Pass()); @@ -1330,8 +1329,8 @@ TEST_F(DelegatedRendererLayerImplTestClip, QuadsClipped_LayerClipped_Surface) { } TEST_F(DelegatedRendererLayerImplTest, InvalidRenderPassDrawQuad) { - scoped_ptr<LayerImpl> root_layer = LayerImpl::Create( - host_impl_->active_tree(), 1).PassAs<LayerImpl>(); + scoped_ptr<LayerImpl> root_layer = + LayerImpl::Create(host_impl_->active_tree(), 1); scoped_ptr<FakeDelegatedRendererLayerImpl> delegated_renderer_layer = FakeDelegatedRendererLayerImpl::Create(host_impl_->active_tree(), 4); @@ -1365,7 +1364,7 @@ TEST_F(DelegatedRendererLayerImplTest, InvalidRenderPassDrawQuad) { // The RenderPasses should be taken by the layer. EXPECT_EQ(0u, delegated_render_passes.size()); - root_layer->AddChild(delegated_renderer_layer.PassAs<LayerImpl>()); + root_layer->AddChild(delegated_renderer_layer.Pass()); host_impl_->active_tree()->SetRootLayer(root_layer.Pass()); LayerTreeHostImpl::FrameData frame; diff --git a/cc/layers/heads_up_display_layer.cc b/cc/layers/heads_up_display_layer.cc index 6adf8d0..5c91249 100644 --- a/cc/layers/heads_up_display_layer.cc +++ b/cc/layers/heads_up_display_layer.cc @@ -56,8 +56,7 @@ bool HeadsUpDisplayLayer::HasDrawableContent() const { scoped_ptr<LayerImpl> HeadsUpDisplayLayer::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return HeadsUpDisplayLayerImpl::Create(tree_impl, layer_id_). - PassAs<LayerImpl>(); + return HeadsUpDisplayLayerImpl::Create(tree_impl, layer_id_); } } // namespace cc diff --git a/cc/layers/heads_up_display_layer_impl.cc b/cc/layers/heads_up_display_layer_impl.cc index 51c0ed2..ab9e8a4 100644 --- a/cc/layers/heads_up_display_layer_impl.cc +++ b/cc/layers/heads_up_display_layer_impl.cc @@ -78,7 +78,7 @@ HeadsUpDisplayLayerImpl::~HeadsUpDisplayLayerImpl() {} scoped_ptr<LayerImpl> HeadsUpDisplayLayerImpl::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return HeadsUpDisplayLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); + return HeadsUpDisplayLayerImpl::Create(tree_impl, id()); } void HeadsUpDisplayLayerImpl::AcquireResource( diff --git a/cc/layers/heads_up_display_layer_impl_unittest.cc b/cc/layers/heads_up_display_layer_impl_unittest.cc index 2c057dd..828a93a 100644 --- a/cc/layers/heads_up_display_layer_impl_unittest.cc +++ b/cc/layers/heads_up_display_layer_impl_unittest.cc @@ -36,8 +36,7 @@ TEST(HeadsUpDisplayLayerImplTest, ResourcelessSoftwareDrawAfterResourceLoss) { TestSharedBitmapManager shared_bitmap_manager; FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); host_impl.CreatePendingTree(); - host_impl.InitializeRenderer( - FakeOutputSurface::Create3d().PassAs<OutputSurface>()); + host_impl.InitializeRenderer(FakeOutputSurface::Create3d()); scoped_ptr<HeadsUpDisplayLayerImpl> layer = HeadsUpDisplayLayerImpl::Create(host_impl.pending_tree(), 1); layer->SetContentBounds(gfx::Size(100, 100)); diff --git a/cc/layers/io_surface_layer.cc b/cc/layers/io_surface_layer.cc index 0682aee..05d5fb9 100644 --- a/cc/layers/io_surface_layer.cc +++ b/cc/layers/io_surface_layer.cc @@ -26,7 +26,7 @@ void IOSurfaceLayer::SetIOSurfaceProperties(uint32_t io_surface_id, scoped_ptr<LayerImpl> IOSurfaceLayer::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return IOSurfaceLayerImpl::Create(tree_impl, layer_id_).PassAs<LayerImpl>(); + return IOSurfaceLayerImpl::Create(tree_impl, layer_id_); } bool IOSurfaceLayer::HasDrawableContent() const { diff --git a/cc/layers/io_surface_layer_impl.cc b/cc/layers/io_surface_layer_impl.cc index e64c9e7..7cb86ce 100644 --- a/cc/layers/io_surface_layer_impl.cc +++ b/cc/layers/io_surface_layer_impl.cc @@ -38,7 +38,7 @@ void IOSurfaceLayerImpl::DestroyResource() { scoped_ptr<LayerImpl> IOSurfaceLayerImpl::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return IOSurfaceLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); + return IOSurfaceLayerImpl::Create(tree_impl, id()); } void IOSurfaceLayerImpl::PushPropertiesTo(LayerImpl* layer) { diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc index 1a22d92..1326b79 100644 --- a/cc/layers/layer.cc +++ b/cc/layers/layer.cc @@ -620,7 +620,7 @@ void Layer::AddScrollChild(Layer* child) { void Layer::RemoveScrollChild(Layer* child) { scroll_children_->erase(child); if (scroll_children_->empty()) - scroll_children_.reset(); + scroll_children_ = nullptr; SetNeedsCommit(); } @@ -650,7 +650,7 @@ void Layer::AddClipChild(Layer* child) { void Layer::RemoveClipChild(Layer* child) { clip_children_->erase(child); if (clip_children_->empty()) - clip_children_.reset(); + clip_children_ = nullptr; SetNeedsCommit(); } @@ -1085,7 +1085,7 @@ void Layer::CreateRenderSurface() { } void Layer::ClearRenderSurface() { - draw_properties_.render_surface.reset(); + draw_properties_.render_surface = nullptr; } void Layer::ClearRenderSurfaceLayerList() { diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc index 29bdfe7..224513c 100644 --- a/cc/layers/layer_impl.cc +++ b/cc/layers/layer_impl.cc @@ -119,7 +119,7 @@ scoped_ptr<LayerImpl> LayerImpl::RemoveChild(LayerImpl* child) { return ret.Pass(); } } - return scoped_ptr<LayerImpl>(); + return nullptr; } void LayerImpl::SetParent(LayerImpl* parent) { @@ -246,7 +246,7 @@ void LayerImpl::CreateRenderSurface() { } void LayerImpl::ClearRenderSurface() { - draw_properties_.render_surface.reset(); + draw_properties_.render_surface = nullptr; } void LayerImpl::ClearRenderSurfaceLayerList() { @@ -1324,7 +1324,7 @@ void LayerImpl::DidBecomeActive() { bool need_scrollbar_animation_controller = scrollable() && scrollbars_; if (!need_scrollbar_animation_controller) { - scrollbar_animation_controller_.reset(); + scrollbar_animation_controller_ = nullptr; return; } @@ -1358,7 +1358,7 @@ void LayerImpl::RemoveScrollbar(ScrollbarLayerImplBase* layer) { scrollbars_->erase(layer); if (scrollbars_->empty()) - scrollbars_.reset(); + scrollbars_ = nullptr; } bool LayerImpl::HasScrollbar(ScrollbarOrientation orientation) const { diff --git a/cc/layers/layer_impl_unittest.cc b/cc/layers/layer_impl_unittest.cc index c5cac8d..b9366ac 100644 --- a/cc/layers/layer_impl_unittest.cc +++ b/cc/layers/layer_impl_unittest.cc @@ -86,8 +86,7 @@ TEST(LayerImplTest, VerifyLayerChangesAreTrackedProperly) { FakeImplProxy proxy; TestSharedBitmapManager shared_bitmap_manager; FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); - EXPECT_TRUE(host_impl.InitializeRenderer( - FakeOutputSurface::Create3d().PassAs<OutputSurface>())); + EXPECT_TRUE(host_impl.InitializeRenderer(FakeOutputSurface::Create3d())); scoped_ptr<LayerImpl> root_clip = LayerImpl::Create(host_impl.active_tree(), 1); scoped_ptr<LayerImpl> root_ptr = @@ -247,8 +246,7 @@ TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) { FakeImplProxy proxy; TestSharedBitmapManager shared_bitmap_manager; FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); - EXPECT_TRUE(host_impl.InitializeRenderer( - FakeOutputSurface::Create3d().PassAs<OutputSurface>())); + EXPECT_TRUE(host_impl.InitializeRenderer(FakeOutputSurface::Create3d())); host_impl.active_tree()->SetRootLayer( LayerImpl::Create(host_impl.active_tree(), 1)); LayerImpl* root = host_impl.active_tree()->root_layer(); @@ -357,8 +355,7 @@ TEST(LayerImplTest, SafeOpaqueBackgroundColor) { FakeImplProxy proxy; TestSharedBitmapManager shared_bitmap_manager; FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); - EXPECT_TRUE(host_impl.InitializeRenderer( - FakeOutputSurface::Create3d().PassAs<OutputSurface>())); + EXPECT_TRUE(host_impl.InitializeRenderer(FakeOutputSurface::Create3d())); scoped_ptr<LayerImpl> layer = LayerImpl::Create(host_impl.active_tree(), 1); for (int contents_opaque = 0; contents_opaque < 2; ++contents_opaque) { diff --git a/cc/layers/layer_perftest.cc b/cc/layers/layer_perftest.cc index 5df2e8f..18b4355 100644 --- a/cc/layers/layer_perftest.cc +++ b/cc/layers/layer_perftest.cc @@ -46,7 +46,7 @@ class LayerPerfTest : public testing::Test { virtual void TearDown() OVERRIDE { layer_tree_host_->SetRootLayer(NULL); - layer_tree_host_.reset(); + layer_tree_host_ = nullptr; } FakeImplProxy proxy_; diff --git a/cc/layers/layer_unittest.cc b/cc/layers/layer_unittest.cc index 3950cf2..846951d 100644 --- a/cc/layers/layer_unittest.cc +++ b/cc/layers/layer_unittest.cc @@ -78,7 +78,7 @@ class LayerTest : public testing::Test { grand_child3_ = NULL; layer_tree_host_->SetRootLayer(NULL); - layer_tree_host_.reset(); + layer_tree_host_ = nullptr; } void VerifyTestTreeInitialState() const { @@ -1144,10 +1144,7 @@ static bool AddTestAnimation(Layer* layer) { 0.7f, scoped_ptr<TimingFunction>())); scoped_ptr<Animation> animation = - Animation::Create(curve.PassAs<AnimationCurve>(), - 0, - 0, - Animation::Opacity); + Animation::Create(curve.Pass(), 0, 0, Animation::Opacity); return layer->AddAnimation(animation.Pass()); } diff --git a/cc/layers/nine_patch_layer.cc b/cc/layers/nine_patch_layer.cc index e63b000..ad8f04d 100644 --- a/cc/layers/nine_patch_layer.cc +++ b/cc/layers/nine_patch_layer.cc @@ -24,7 +24,7 @@ NinePatchLayer::~NinePatchLayer() {} scoped_ptr<LayerImpl> NinePatchLayer::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return NinePatchLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); + return NinePatchLayerImpl::Create(tree_impl, id()); } void NinePatchLayer::SetBorder(const gfx::Rect& border) { diff --git a/cc/layers/nine_patch_layer_impl.cc b/cc/layers/nine_patch_layer_impl.cc index c27205f..ba3f30c 100644 --- a/cc/layers/nine_patch_layer_impl.cc +++ b/cc/layers/nine_patch_layer_impl.cc @@ -22,7 +22,7 @@ NinePatchLayerImpl::~NinePatchLayerImpl() {} scoped_ptr<LayerImpl> NinePatchLayerImpl::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return NinePatchLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); + return NinePatchLayerImpl::Create(tree_impl, id()); } void NinePatchLayerImpl::PushPropertiesTo(LayerImpl* layer) { diff --git a/cc/layers/painted_scrollbar_layer.cc b/cc/layers/painted_scrollbar_layer.cc index 65fb78d..83c12e8 100644 --- a/cc/layers/painted_scrollbar_layer.cc +++ b/cc/layers/painted_scrollbar_layer.cc @@ -23,7 +23,7 @@ namespace cc { scoped_ptr<LayerImpl> PaintedScrollbarLayer::CreateLayerImpl( LayerTreeImpl* tree_impl) { return PaintedScrollbarLayerImpl::Create( - tree_impl, id(), scrollbar_->Orientation()).PassAs<LayerImpl>(); + tree_impl, id(), scrollbar_->Orientation()); } scoped_refptr<PaintedScrollbarLayer> PaintedScrollbarLayer::Create( @@ -156,8 +156,8 @@ void PaintedScrollbarLayer::SetLayerTreeHost(LayerTreeHost* host) { // When the LTH is set to null or has changed, then this layer should remove // all of its associated resources. if (!host || host != layer_tree_host()) { - track_resource_.reset(); - thumb_resource_.reset(); + track_resource_ = nullptr; + thumb_resource_ = nullptr; } ContentsScalingLayer::SetLayerTreeHost(host); @@ -214,9 +214,8 @@ bool PaintedScrollbarLayer::Update(ResourceUpdateQueue* queue, if (track_rect_.IsEmpty() || scaled_track_rect.IsEmpty()) { if (track_resource_) { - track_resource_.reset(); - if (thumb_resource_) - thumb_resource_.reset(); + track_resource_ = nullptr; + thumb_resource_ = nullptr; SetNeedsPushProperties(); updated = true; } @@ -224,7 +223,7 @@ bool PaintedScrollbarLayer::Update(ResourceUpdateQueue* queue, } if (!has_thumb_ && thumb_resource_) { - thumb_resource_.reset(); + thumb_resource_ = nullptr; SetNeedsPushProperties(); } diff --git a/cc/layers/painted_scrollbar_layer_impl.cc b/cc/layers/painted_scrollbar_layer_impl.cc index d48c49f..16196dd 100644 --- a/cc/layers/painted_scrollbar_layer_impl.cc +++ b/cc/layers/painted_scrollbar_layer_impl.cc @@ -43,8 +43,7 @@ PaintedScrollbarLayerImpl::~PaintedScrollbarLayerImpl() {} scoped_ptr<LayerImpl> PaintedScrollbarLayerImpl::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return PaintedScrollbarLayerImpl::Create(tree_impl, id(), orientation()) - .PassAs<LayerImpl>(); + return PaintedScrollbarLayerImpl::Create(tree_impl, id(), orientation()); } void PaintedScrollbarLayerImpl::PushPropertiesTo(LayerImpl* layer) { diff --git a/cc/layers/picture_image_layer.cc b/cc/layers/picture_image_layer.cc index 98c0e9b..dba506e 100644 --- a/cc/layers/picture_image_layer.cc +++ b/cc/layers/picture_image_layer.cc @@ -21,7 +21,7 @@ PictureImageLayer::~PictureImageLayer() { scoped_ptr<LayerImpl> PictureImageLayer::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return PictureImageLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); + return PictureImageLayerImpl::Create(tree_impl, id()); } bool PictureImageLayer::HasDrawableContent() const { diff --git a/cc/layers/picture_image_layer_impl.cc b/cc/layers/picture_image_layer_impl.cc index 247c46a..a72ab01 100644 --- a/cc/layers/picture_image_layer_impl.cc +++ b/cc/layers/picture_image_layer_impl.cc @@ -24,7 +24,7 @@ const char* PictureImageLayerImpl::LayerTypeAsString() const { scoped_ptr<LayerImpl> PictureImageLayerImpl::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return PictureImageLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); + return PictureImageLayerImpl::Create(tree_impl, id()); } void PictureImageLayerImpl::GetDebugBorderProperties( diff --git a/cc/layers/picture_image_layer_impl_unittest.cc b/cc/layers/picture_image_layer_impl_unittest.cc index 06f53ef..3f1d36c 100644 --- a/cc/layers/picture_image_layer_impl_unittest.cc +++ b/cc/layers/picture_image_layer_impl_unittest.cc @@ -43,8 +43,7 @@ class PictureImageLayerImplTest : public testing::Test { &shared_bitmap_manager_) { tiling_client_.SetTileSize(ImplSidePaintingSettings().default_tile_size); host_impl_.CreatePendingTree(); - host_impl_.InitializeRenderer( - FakeOutputSurface::Create3d().PassAs<OutputSurface>()); + host_impl_.InitializeRenderer(FakeOutputSurface::Create3d()); } scoped_ptr<TestablePictureImageLayerImpl> CreateLayer(int id, @@ -126,7 +125,7 @@ TEST_F(PictureImageLayerImplTest, IgnoreIdealContentScale) { EXPECT_EQ(1.f, pending_layer->tilings()->tiling_at(0)->contents_scale()); // Push to active layer. - host_impl_.pending_tree()->SetRootLayer(pending_layer.PassAs<LayerImpl>()); + host_impl_.pending_tree()->SetRootLayer(pending_layer.Pass()); host_impl_.ActivateSyncTree(); TestablePictureImageLayerImpl* active_layer = static_cast<TestablePictureImageLayerImpl*>( diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc index d175a57..68d24ba 100644 --- a/cc/layers/picture_layer.cc +++ b/cc/layers/picture_layer.cc @@ -29,7 +29,7 @@ PictureLayer::~PictureLayer() { } scoped_ptr<LayerImpl> PictureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { - return PictureLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); + return PictureLayerImpl::Create(tree_impl, id()); } void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) { diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc index 9a43916..8960a80 100644 --- a/cc/layers/picture_layer_impl.cc +++ b/cc/layers/picture_layer_impl.cc @@ -89,7 +89,7 @@ const char* PictureLayerImpl::LayerTypeAsString() const { scoped_ptr<LayerImpl> PictureLayerImpl::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return PictureLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); + return PictureLayerImpl::Create(tree_impl, id()); } void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) { diff --git a/cc/layers/picture_layer_impl_perftest.cc b/cc/layers/picture_layer_impl_perftest.cc index 1aff9ad..a969027 100644 --- a/cc/layers/picture_layer_impl_perftest.cc +++ b/cc/layers/picture_layer_impl_perftest.cc @@ -46,8 +46,7 @@ class PictureLayerImplPerfTest : public testing::Test { kTimeCheckInterval) {} virtual void SetUp() OVERRIDE { - host_impl_.InitializeRenderer( - FakeOutputSurface::Create3d().PassAs<OutputSurface>()); + host_impl_.InitializeRenderer(FakeOutputSurface::Create3d()); } void SetupPendingTree(const gfx::Size& layer_bounds, @@ -61,7 +60,7 @@ class PictureLayerImplPerfTest : public testing::Test { scoped_ptr<FakePictureLayerImpl> pending_layer = FakePictureLayerImpl::CreateWithPile(pending_tree, 7, pile); pending_layer->SetDrawsContent(true); - pending_tree->SetRootLayer(pending_layer.PassAs<LayerImpl>()); + pending_tree->SetRootLayer(pending_layer.Pass()); pending_layer_ = static_cast<FakePictureLayerImpl*>( host_impl_.pending_tree()->LayerById(7)); diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc index c72d19c..b2492d3 100644 --- a/cc/layers/picture_layer_impl_unittest.cc +++ b/cc/layers/picture_layer_impl_unittest.cc @@ -76,8 +76,7 @@ class PictureLayerImplTest : public testing::Test { } virtual void InitializeRenderer() { - host_impl_.InitializeRenderer( - FakeOutputSurface::Create3d().PassAs<OutputSurface>()); + host_impl_.InitializeRenderer(FakeOutputSurface::Create3d()); } void SetupDefaultTrees(const gfx::Size& layer_bounds) { @@ -145,7 +144,7 @@ class PictureLayerImplTest : public testing::Test { scoped_ptr<FakePictureLayerImpl> pending_layer = FakePictureLayerImpl::CreateWithPile(pending_tree, id_, pile); pending_layer->SetDrawsContent(true); - pending_tree->SetRootLayer(pending_layer.PassAs<LayerImpl>()); + pending_tree->SetRootLayer(pending_layer.Pass()); pending_layer_ = static_cast<FakePictureLayerImpl*>( host_impl_.pending_tree()->LayerById(id_)); @@ -1294,8 +1293,8 @@ TEST_F(PictureLayerImplTest, ClampTilesToToMaxTileSize) { TestWebGraphicsContext3D::Create(); context->set_max_texture_size(140); host_impl_.DidLoseOutputSurface(); - host_impl_.InitializeRenderer(FakeOutputSurface::Create3d( - context.Pass()).PassAs<OutputSurface>()); + host_impl_.InitializeRenderer( + FakeOutputSurface::Create3d(context.Pass()).Pass()); SetupDrawPropertiesAndUpdateTiles(pending_layer_, 1.f, 1.f, 1.f, 1.f, false); ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings()); @@ -1341,8 +1340,8 @@ TEST_F(PictureLayerImplTest, ClampSingleTileToToMaxTileSize) { TestWebGraphicsContext3D::Create(); context->set_max_texture_size(140); host_impl_.DidLoseOutputSurface(); - host_impl_.InitializeRenderer(FakeOutputSurface::Create3d( - context.Pass()).PassAs<OutputSurface>()); + host_impl_.InitializeRenderer( + FakeOutputSurface::Create3d(context.Pass()).Pass()); SetupDrawPropertiesAndUpdateTiles(pending_layer_, 1.f, 1.f, 1.f, 1.f, false); ASSERT_LE(1u, pending_layer_->tilings()->num_tilings()); @@ -1860,7 +1859,7 @@ TEST_F(PictureLayerImplTest, ActivateUninitializedLayer) { scoped_ptr<FakePictureLayerImpl> pending_layer = FakePictureLayerImpl::CreateWithPile(pending_tree, id_, pending_pile); pending_layer->SetDrawsContent(true); - pending_tree->SetRootLayer(pending_layer.PassAs<LayerImpl>()); + pending_tree->SetRootLayer(pending_layer.Pass()); pending_layer_ = static_cast<FakePictureLayerImpl*>( host_impl_.pending_tree()->LayerById(id_)); @@ -2215,10 +2214,9 @@ class DeferredInitPictureLayerImplTest : public PictureLayerImplTest { public: virtual void InitializeRenderer() OVERRIDE { bool delegated_rendering = false; - host_impl_.InitializeRenderer( - FakeOutputSurface::CreateDeferredGL( - scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice), - delegated_rendering).PassAs<OutputSurface>()); + host_impl_.InitializeRenderer(FakeOutputSurface::CreateDeferredGL( + scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice), + delegated_rendering)); } virtual void SetUp() OVERRIDE { @@ -3502,7 +3500,7 @@ TEST_F(PictureLayerImplTest, UpdateTilesForMasksWithNoVisibleContent) { mask->SetDrawsContent(true); FakePictureLayerImpl* pending_mask_content = mask.get(); - layer_with_mask->SetMaskLayer(mask.PassAs<LayerImpl>()); + layer_with_mask->SetMaskLayer(mask.Pass()); scoped_ptr<FakePictureLayerImpl> child_of_layer_with_mask = FakePictureLayerImpl::Create(host_impl_.pending_tree(), 4); @@ -3511,9 +3509,9 @@ TEST_F(PictureLayerImplTest, UpdateTilesForMasksWithNoVisibleContent) { child_of_layer_with_mask->SetContentBounds(bounds); child_of_layer_with_mask->SetDrawsContent(true); - layer_with_mask->AddChild(child_of_layer_with_mask.PassAs<LayerImpl>()); + layer_with_mask->AddChild(child_of_layer_with_mask.Pass()); - root->AddChild(layer_with_mask.PassAs<LayerImpl>()); + root->AddChild(layer_with_mask.Pass()); host_impl_.pending_tree()->SetRootLayer(root.Pass()); @@ -3527,8 +3525,7 @@ class PictureLayerImplTestWithDelegatingRenderer : public PictureLayerImplTest { PictureLayerImplTestWithDelegatingRenderer() : PictureLayerImplTest() {} virtual void InitializeRenderer() OVERRIDE { - host_impl_.InitializeRenderer( - FakeOutputSurface::CreateDelegating3d().PassAs<OutputSurface>()); + host_impl_.InitializeRenderer(FakeOutputSurface::CreateDelegating3d()); } }; diff --git a/cc/layers/solid_color_layer.cc b/cc/layers/solid_color_layer.cc index 5a1e26f..25e0ab8 100644 --- a/cc/layers/solid_color_layer.cc +++ b/cc/layers/solid_color_layer.cc @@ -10,7 +10,7 @@ namespace cc { scoped_ptr<LayerImpl> SolidColorLayer::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return SolidColorLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); + return SolidColorLayerImpl::Create(tree_impl, id()); } scoped_refptr<SolidColorLayer> SolidColorLayer::Create() { diff --git a/cc/layers/solid_color_layer_impl.cc b/cc/layers/solid_color_layer_impl.cc index 5e0a640..618ea53 100644 --- a/cc/layers/solid_color_layer_impl.cc +++ b/cc/layers/solid_color_layer_impl.cc @@ -24,7 +24,7 @@ SolidColorLayerImpl::~SolidColorLayerImpl() {} scoped_ptr<LayerImpl> SolidColorLayerImpl::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return SolidColorLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); + return SolidColorLayerImpl::Create(tree_impl, id()); } void SolidColorLayerImpl::AppendSolidQuads( diff --git a/cc/layers/solid_color_scrollbar_layer.cc b/cc/layers/solid_color_scrollbar_layer.cc index 7ea7265..98b23a4 100644 --- a/cc/layers/solid_color_scrollbar_layer.cc +++ b/cc/layers/solid_color_scrollbar_layer.cc @@ -19,8 +19,7 @@ scoped_ptr<LayerImpl> SolidColorScrollbarLayer::CreateLayerImpl( thumb_thickness_, track_start_, is_left_side_vertical_scrollbar_, - kIsOverlayScrollbar) - .PassAs<LayerImpl>(); + kIsOverlayScrollbar); } scoped_refptr<SolidColorScrollbarLayer> SolidColorScrollbarLayer::Create( diff --git a/cc/layers/solid_color_scrollbar_layer_impl.cc b/cc/layers/solid_color_scrollbar_layer_impl.cc index 8fac881..a0c9609 100644 --- a/cc/layers/solid_color_scrollbar_layer_impl.cc +++ b/cc/layers/solid_color_scrollbar_layer_impl.cc @@ -38,8 +38,7 @@ scoped_ptr<LayerImpl> SolidColorScrollbarLayerImpl::CreateLayerImpl( thumb_thickness_, track_start_, is_left_side_vertical_scrollbar(), - is_overlay_scrollbar()) - .PassAs<LayerImpl>(); + is_overlay_scrollbar()); } SolidColorScrollbarLayerImpl::SolidColorScrollbarLayerImpl( diff --git a/cc/layers/surface_layer.cc b/cc/layers/surface_layer.cc index 3ca179f..ba577a0 100644 --- a/cc/layers/surface_layer.cc +++ b/cc/layers/surface_layer.cc @@ -24,7 +24,7 @@ void SurfaceLayer::SetSurfaceId(SurfaceId surface_id) { } scoped_ptr<LayerImpl> SurfaceLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { - return SurfaceLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); + return SurfaceLayerImpl::Create(tree_impl, id()); } bool SurfaceLayer::HasDrawableContent() const { diff --git a/cc/layers/surface_layer_impl.cc b/cc/layers/surface_layer_impl.cc index 0b102f2..352aca6 100644 --- a/cc/layers/surface_layer_impl.cc +++ b/cc/layers/surface_layer_impl.cc @@ -19,7 +19,7 @@ SurfaceLayerImpl::~SurfaceLayerImpl() {} scoped_ptr<LayerImpl> SurfaceLayerImpl::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return SurfaceLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); + return SurfaceLayerImpl::Create(tree_impl, id()); } void SurfaceLayerImpl::SetSurfaceId(SurfaceId surface_id) { diff --git a/cc/layers/texture_layer.cc b/cc/layers/texture_layer.cc index 3bccc7e..d8634ea 100644 --- a/cc/layers/texture_layer.cc +++ b/cc/layers/texture_layer.cc @@ -55,7 +55,7 @@ void TextureLayer::ClearTexture() { } scoped_ptr<LayerImpl> TextureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { - return TextureLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); + return TextureLayerImpl::Create(tree_impl, id()); } void TextureLayer::SetFlipped(bool flipped) { @@ -130,7 +130,7 @@ void TextureLayer::SetTextureMailboxInternal( holder_ref_ = TextureMailboxHolder::Create(mailbox, release_callback.Pass()); } else { - holder_ref_.reset(); + holder_ref_ = nullptr; } needs_set_mailbox_ = true; // If we are within a commit, no need to do it again immediately after. @@ -296,7 +296,7 @@ scoped_ptr<TextureLayer::TextureMailboxHolder::MainThreadReference> TextureLayer::TextureMailboxHolder::Create( const TextureMailbox& mailbox, scoped_ptr<SingleReleaseCallback> release_callback) { - return scoped_ptr<MainThreadReference>(new MainThreadReference( + return make_scoped_ptr(new MainThreadReference( new TextureMailboxHolder(mailbox, release_callback.Pass()))); } @@ -326,7 +326,7 @@ void TextureLayer::TextureMailboxHolder::InternalRelease() { if (!--internal_references_) { release_callback_->Run(sync_point_, is_lost_); mailbox_ = TextureMailbox(); - release_callback_.reset(); + release_callback_ = nullptr; } } diff --git a/cc/layers/texture_layer_impl.cc b/cc/layers/texture_layer_impl.cc index d02689f..206d8db 100644 --- a/cc/layers/texture_layer_impl.cc +++ b/cc/layers/texture_layer_impl.cc @@ -49,7 +49,7 @@ void TextureLayerImpl::SetTextureMailbox( scoped_ptr<LayerImpl> TextureLayerImpl::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return TextureLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); + return TextureLayerImpl::Create(tree_impl, id()); } void TextureLayerImpl::PushPropertiesTo(LayerImpl* layer) { @@ -83,7 +83,7 @@ bool TextureLayerImpl::WillDraw(DrawMode draw_mode, resource_provider->CreateResourceFromTextureMailbox( texture_mailbox_, release_callback_.Pass()); DCHECK(external_texture_resource_); - texture_copy_.reset(); + texture_copy_ = nullptr; valid_texture_copy_ = false; } if (external_texture_resource_) @@ -194,7 +194,7 @@ SimpleEnclosedRegion TextureLayerImpl::VisibleContentOpaqueRegion() const { void TextureLayerImpl::ReleaseResources() { FreeTextureMailbox(); - texture_copy_.reset(); + texture_copy_ = nullptr; external_texture_resource_ = 0; valid_texture_copy_ = false; } @@ -248,7 +248,7 @@ void TextureLayerImpl::FreeTextureMailbox() { layer_tree_impl()->BlockingMainThreadTaskRunner()); } texture_mailbox_ = TextureMailbox(); - release_callback_.reset(); + release_callback_ = nullptr; } else if (external_texture_resource_) { DCHECK(!own_mailbox_); ResourceProvider* resource_provider = diff --git a/cc/layers/texture_layer_unittest.cc b/cc/layers/texture_layer_unittest.cc index feb7126..b3c48fb 100644 --- a/cc/layers/texture_layer_unittest.cc +++ b/cc/layers/texture_layer_unittest.cc @@ -185,7 +185,7 @@ class TextureLayerTest : public testing::Test { EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); layer_tree_host_->SetRootLayer(NULL); - layer_tree_host_.reset(); + layer_tree_host_ = nullptr; } scoped_ptr<MockLayerTreeHost> layer_tree_host_; @@ -422,9 +422,7 @@ class TextureLayerMailboxHolderTest : public TextureLayerTest { SingleReleaseCallback::Create(test_data_.release_mailbox1_)).Pass(); } - void ReleaseMainRef() { - main_ref_.reset(); - } + void ReleaseMainRef() { main_ref_ = nullptr; } void CreateImplRef(scoped_ptr<SingleReleaseCallbackImpl>* impl_ref) { *impl_ref = main_ref_->holder()->GetCallbackForImplThread(); @@ -932,8 +930,7 @@ class TextureLayerImplWithMailboxTest : public TextureLayerTest { virtual void SetUp() { TextureLayerTest::SetUp(); layer_tree_host_.reset(new MockLayerTreeHost(&fake_client_)); - EXPECT_TRUE(host_impl_.InitializeRenderer( - FakeOutputSurface::Create3d().PassAs<OutputSurface>())); + EXPECT_TRUE(host_impl_.InitializeRenderer(FakeOutputSurface::Create3d())); } bool WillDraw(TextureLayerImpl* layer, DrawMode mode) { diff --git a/cc/layers/tiled_layer.cc b/cc/layers/tiled_layer.cc index 1f30b45..854a747 100644 --- a/cc/layers/tiled_layer.cc +++ b/cc/layers/tiled_layer.cc @@ -98,7 +98,7 @@ TiledLayer::TiledLayer() TiledLayer::~TiledLayer() {} scoped_ptr<LayerImpl> TiledLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { - return TiledLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); + return TiledLayerImpl::Create(tree_impl, id()); } void TiledLayer::UpdateTileSizeAndTilingOption() { @@ -277,7 +277,7 @@ UpdatableTile* TiledLayer::CreateTile(int i, int j) { tile->managed_resource()->SetDimensions(tiler_->tile_size(), texture_format_); UpdatableTile* added_tile = tile.get(); - tiler_->AddTile(tile.PassAs<LayerTilingData::Tile>(), i, j); + tiler_->AddTile(tile.Pass(), i, j); added_tile->dirty_rect = tiler_->TileRect(added_tile); diff --git a/cc/layers/tiled_layer_impl.cc b/cc/layers/tiled_layer_impl.cc index f7f9792..18d9d1e 100644 --- a/cc/layers/tiled_layer_impl.cc +++ b/cc/layers/tiled_layer_impl.cc @@ -85,7 +85,7 @@ DrawableTile* TiledLayerImpl::TileAt(int i, int j) const { DrawableTile* TiledLayerImpl::CreateTile(int i, int j) { scoped_ptr<DrawableTile> tile(DrawableTile::Create()); DrawableTile* added_tile = tile.get(); - tiler_->AddTile(tile.PassAs<LayerTilingData::Tile>(), i, j); + tiler_->AddTile(tile.Pass(), i, j); return added_tile; } @@ -98,7 +98,7 @@ void TiledLayerImpl::GetDebugBorderProperties(SkColor* color, scoped_ptr<LayerImpl> TiledLayerImpl::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return TiledLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); + return TiledLayerImpl::Create(tree_impl, id()); } void TiledLayerImpl::AsValueInto(base::debug::TracedValue* state) const { diff --git a/cc/layers/tiled_layer_unittest.cc b/cc/layers/tiled_layer_unittest.cc index e46d66b7..d2bc0a9 100644 --- a/cc/layers/tiled_layer_unittest.cc +++ b/cc/layers/tiled_layer_unittest.cc @@ -140,8 +140,8 @@ class TiledLayerTest : public testing::Test { DebugScopedSetImplThreadAndMainThreadBlocked impl_thread_and_main_thread_blocked(proxy_); - resource_provider_.reset(); - host_impl_.reset(); + resource_provider_ = nullptr; + host_impl_ = nullptr; } void ResourceManagerClearAllMemory( @@ -1665,10 +1665,8 @@ class UpdateTrackingTiledLayer : public FakeTiledLayer { : FakeTiledLayer(manager) { scoped_ptr<TrackingLayerPainter> painter(TrackingLayerPainter::Create()); tracking_layer_painter_ = painter.get(); - layer_updater_ = - BitmapContentLayerUpdater::Create(painter.PassAs<LayerPainter>(), - &stats_instrumentation_, - 0); + layer_updater_ = BitmapContentLayerUpdater::Create( + painter.Pass(), &stats_instrumentation_, 0); } TrackingLayerPainter* tracking_layer_painter() const { diff --git a/cc/layers/ui_resource_layer.cc b/cc/layers/ui_resource_layer.cc index 59fbe83..498ba33 100644 --- a/cc/layers/ui_resource_layer.cc +++ b/cc/layers/ui_resource_layer.cc @@ -69,7 +69,7 @@ UIResourceLayer::~UIResourceLayer() {} scoped_ptr<LayerImpl> UIResourceLayer::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return UIResourceLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); + return UIResourceLayerImpl::Create(tree_impl, id()); } void UIResourceLayer::SetUV(const gfx::PointF& top_left, @@ -112,7 +112,7 @@ void UIResourceLayer::SetLayerTreeHost(LayerTreeHost* host) { } void UIResourceLayer::RecreateUIResourceHolder() { - ui_resource_holder_.reset(); + ui_resource_holder_ = nullptr; if (layer_tree_host() && !bitmap_.empty()) { ui_resource_holder_ = ScopedUIResourceHolder::Create(layer_tree_host(), bitmap_); @@ -131,11 +131,10 @@ void UIResourceLayer::SetUIResourceId(UIResourceId resource_id) { if (ui_resource_holder_ && ui_resource_holder_->id() == resource_id) return; - if (resource_id) { + if (resource_id) ui_resource_holder_ = SharedUIResourceHolder::Create(resource_id); - } else { - ui_resource_holder_.reset(); - } + else + ui_resource_holder_ = nullptr; UpdateDrawsContent(HasDrawableContent()); SetNeedsCommit(); diff --git a/cc/layers/ui_resource_layer_impl.cc b/cc/layers/ui_resource_layer_impl.cc index 98843c6..8a7d3df 100644 --- a/cc/layers/ui_resource_layer_impl.cc +++ b/cc/layers/ui_resource_layer_impl.cc @@ -29,7 +29,7 @@ UIResourceLayerImpl::~UIResourceLayerImpl() {} scoped_ptr<LayerImpl> UIResourceLayerImpl::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return UIResourceLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); + return UIResourceLayerImpl::Create(tree_impl, id()); } void UIResourceLayerImpl::PushPropertiesTo(LayerImpl* layer) { diff --git a/cc/layers/video_layer.cc b/cc/layers/video_layer.cc index 995668b..fe37fbf4 100644 --- a/cc/layers/video_layer.cc +++ b/cc/layers/video_layer.cc @@ -25,7 +25,7 @@ VideoLayer::~VideoLayer() {} scoped_ptr<LayerImpl> VideoLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { scoped_ptr<VideoLayerImpl> impl = VideoLayerImpl::Create(tree_impl, id(), provider_, video_rotation_); - return impl.PassAs<LayerImpl>(); + return impl.Pass(); } bool VideoLayer::Update(ResourceUpdateQueue* queue, diff --git a/cc/layers/video_layer_impl.cc b/cc/layers/video_layer_impl.cc index 4bfd1cd..2edea94 100644 --- a/cc/layers/video_layer_impl.cc +++ b/cc/layers/video_layer_impl.cc @@ -59,8 +59,7 @@ VideoLayerImpl::~VideoLayerImpl() { scoped_ptr<LayerImpl> VideoLayerImpl::CreateLayerImpl( LayerTreeImpl* tree_impl) { - VideoLayerImpl* impl = new VideoLayerImpl(tree_impl, id(), video_rotation_); - return scoped_ptr<LayerImpl>(impl); + return make_scoped_ptr(new VideoLayerImpl(tree_impl, id(), video_rotation_)); } void VideoLayerImpl::PushPropertiesTo(LayerImpl* layer) { @@ -90,7 +89,7 @@ bool VideoLayerImpl::WillDraw(DrawMode draw_mode, if (!frame_.get()) { // Drop any resources used by the updater if there is no frame to display. - updater_.reset(); + updater_ = nullptr; provider_client_impl_->ReleaseLock(); return false; @@ -358,7 +357,7 @@ void VideoLayerImpl::DidDraw(ResourceProvider* resource_provider) { } void VideoLayerImpl::ReleaseResources() { - updater_.reset(); + updater_ = nullptr; } void VideoLayerImpl::SetNeedsRedraw() { diff --git a/cc/output/bsp_tree.cc b/cc/output/bsp_tree.cc index 2755c0b..e6596da 100644 --- a/cc/output/bsp_tree.cc +++ b/cc/output/bsp_tree.cc @@ -25,7 +25,7 @@ BspTree::BspTree(ScopedPtrDeque<DrawPolygon>* list) { if (list->size() == 0) return; - root_ = scoped_ptr<BspNode>(new BspNode(list->take_front())); + root_ = make_scoped_ptr(new BspNode(list->take_front())); BuildTree(root_.get(), list); } @@ -90,7 +90,7 @@ void BspTree::BuildTree(BspNode* node, // Build the back subtree using the front of the back_list as our splitter. if (back_list.size() > 0) { - node->back_child = scoped_ptr<BspNode>(new BspNode(back_list.take_front())); + node->back_child = make_scoped_ptr(new BspNode(back_list.take_front())); BuildTree(node->back_child.get(), &back_list); } diff --git a/cc/output/delegating_renderer_unittest.cc b/cc/output/delegating_renderer_unittest.cc index 99dc395..48bacd5 100644 --- a/cc/output/delegating_renderer_unittest.cc +++ b/cc/output/delegating_renderer_unittest.cc @@ -22,7 +22,7 @@ class DelegatingRendererTest : public LayerTreeTest { scoped_ptr<FakeOutputSurface> output_surface = FakeOutputSurface::CreateDelegating3d(); output_surface_ = output_surface.get(); - return output_surface.PassAs<OutputSurface>(); + return output_surface.Pass(); } protected: diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index bc64c67..ebc9a1a 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc @@ -145,7 +145,7 @@ class GLRenderer::ScopedUseGrContext { static scoped_ptr<ScopedUseGrContext> Create(GLRenderer* renderer, DrawingFrame* frame) { if (!renderer->output_surface_->context_provider()->GrContext()) - return scoped_ptr<ScopedUseGrContext>(); + return nullptr; return make_scoped_ptr(new ScopedUseGrContext(renderer, frame)); } @@ -968,7 +968,7 @@ scoped_ptr<ScopedResource> GLRenderer::GetBackgroundWithFilters( UseRenderPass(frame, target_render_pass); if (!using_background_texture) - return scoped_ptr<ScopedResource>(); + return nullptr; return background_texture.Pass(); } @@ -2165,7 +2165,7 @@ void GLRenderer::FinishDrawingFrame(DrawingFrame* frame) { pending_sync_queries_.push_back(current_sync_query_.Pass()); } - current_framebuffer_lock_.reset(); + current_framebuffer_lock_ = nullptr; swap_buffer_rect_.Union(gfx::ToEnclosingRect(frame->root_damage_rect)); GLC(gl_, gl_->Disable(GL_BLEND)); @@ -2643,7 +2643,7 @@ bool GLRenderer::UseScopedTexture(DrawingFrame* frame, } void GLRenderer::BindFramebufferToOutputSurface(DrawingFrame* frame) { - current_framebuffer_lock_.reset(); + current_framebuffer_lock_ = nullptr; output_surface_->BindFramebuffer(); if (output_surface_->HasExternalStencilTest()) { @@ -2659,7 +2659,7 @@ bool GLRenderer::BindFramebufferToTexture(DrawingFrame* frame, const gfx::Rect& target_rect) { DCHECK(texture->id()); - current_framebuffer_lock_.reset(); + current_framebuffer_lock_ = nullptr; SetStencilEnabled(false); GLC(gl_, gl_->BindFramebuffer(GL_FRAMEBUFFER, offscreen_framebuffer_id_)); @@ -3080,7 +3080,7 @@ GLRenderer::GetVideoStreamTextureProgram(TexCoordPrecision precision) { } void GLRenderer::CleanupSharedObjects() { - shared_geometry_.reset(); + shared_geometry_ = nullptr; for (int i = 0; i < NumTexCoordPrecisions; ++i) { for (int j = 0; j < NumSamplerTypes; ++j) { diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc index 4befaf5..c98652c 100644 --- a/cc/output/gl_renderer_unittest.cc +++ b/cc/output/gl_renderer_unittest.cc @@ -556,8 +556,8 @@ TEST_F(GLRendererTest, OpaqueBackground) { ClearCountingContext* context = context_owned.get(); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::Create3d(context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); scoped_ptr<SharedBitmapManager> shared_bitmap_manager( @@ -608,8 +608,8 @@ TEST_F(GLRendererTest, TransparentBackground) { ClearCountingContext* context = context_owned.get(); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::Create3d(context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); scoped_ptr<SharedBitmapManager> shared_bitmap_manager( @@ -653,8 +653,8 @@ TEST_F(GLRendererTest, OffscreenOutputSurface) { ClearCountingContext* context = context_owned.get(); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::CreateOffscreen( - context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::CreateOffscreen(context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); scoped_ptr<SharedBitmapManager> shared_bitmap_manager( @@ -732,8 +732,8 @@ TEST_F(GLRendererTest, VisibilityChangeIsLastCall) { new VisibilityChangeIsLastCallTrackingContext); VisibilityChangeIsLastCallTrackingContext* context = context_owned.get(); - scoped_refptr<TestContextProvider> provider = TestContextProvider::Create( - context_owned.PassAs<TestWebGraphicsContext3D>()); + scoped_refptr<TestContextProvider> provider = + TestContextProvider::Create(context_owned.Pass()); provider->support()->SetSurfaceVisibleCallback(base::Bind( &VisibilityChangeIsLastCallTrackingContext::set_last_call_was_visibility, @@ -811,8 +811,8 @@ TEST_F(GLRendererTest, ActiveTextureState) { TextureStateTrackingContext* context = context_owned.get(); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::Create3d(context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); scoped_ptr<SharedBitmapManager> shared_bitmap_manager( @@ -902,8 +902,8 @@ TEST_F(GLRendererTest, ShouldClearRootRenderPass) { NoClearRootRenderPassMockContext* mock_context = mock_context_owned.get(); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - mock_context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::Create3d(mock_context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); scoped_ptr<SharedBitmapManager> shared_bitmap_manager( @@ -1000,8 +1000,8 @@ TEST_F(GLRendererTest, ScissorTestWhenClearing) { new ScissorTestOnClearCheckingContext); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::Create3d(context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); scoped_ptr<SharedBitmapManager> shared_bitmap_manager( @@ -1098,8 +1098,7 @@ TEST_F(GLRendererTest, NoDiscardOnPartialUpdates) { FakeOutputSurfaceClient output_surface_client; scoped_ptr<NonReshapableOutputSurface> output_surface( - new NonReshapableOutputSurface( - context_owned.PassAs<TestWebGraphicsContext3D>())); + new NonReshapableOutputSurface(context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); output_surface->set_fixed_size(gfx::Size(100, 100)); @@ -1290,8 +1289,8 @@ TEST_F(GLRendererTest, ScissorAndViewportWithinNonreshapableSurface) { new FlippedScissorAndViewportContext); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(new NonReshapableOutputSurface( - context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + new NonReshapableOutputSurface(context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); scoped_ptr<SharedBitmapManager> shared_bitmap_manager( diff --git a/cc/output/output_surface_unittest.cc b/cc/output/output_surface_unittest.cc index 299baba..4c51e1a 100644 --- a/cc/output/output_surface_unittest.cc +++ b/cc/output/output_surface_unittest.cc @@ -209,8 +209,7 @@ TEST(OutputSurfaceTest, SoftwareOutputDeviceBackbufferManagement) { // TestOutputSurface now owns software_output_device and has responsibility to // free it. - scoped_ptr<TestSoftwareOutputDevice> p(software_output_device); - TestOutputSurface output_surface(p.PassAs<SoftwareOutputDevice>()); + TestOutputSurface output_surface(make_scoped_ptr(software_output_device)); EXPECT_EQ(0, software_output_device->ensure_backbuffer_count()); EXPECT_EQ(0, software_output_device->discard_backbuffer_count()); diff --git a/cc/output/renderer_unittest.cc b/cc/output/renderer_unittest.cc index 1d54608..99ff89d 100644 --- a/cc/output/renderer_unittest.cc +++ b/cc/output/renderer_unittest.cc @@ -38,8 +38,7 @@ scoped_ptr<Renderer> CreateRenderer<DelegatingRenderer>( OutputSurface* output_surface, ResourceProvider* resource_provider) { return DelegatingRenderer::Create( - client, settings, output_surface, resource_provider) - .PassAs<Renderer>(); + client, settings, output_surface, resource_provider); } template <> @@ -49,8 +48,7 @@ scoped_ptr<Renderer> CreateRenderer<GLRenderer>( OutputSurface* output_surface, ResourceProvider* resource_provider) { return GLRenderer::Create( - client, settings, output_surface, resource_provider, NULL, 0) - .PassAs<Renderer>(); + client, settings, output_surface, resource_provider, NULL, 0); } template <typename T> diff --git a/cc/output/software_renderer.cc b/cc/output/software_renderer.cc index 538bb6c..ae58b63 100644 --- a/cc/output/software_renderer.cc +++ b/cc/output/software_renderer.cc @@ -107,7 +107,7 @@ void SoftwareRenderer::BeginDrawingFrame(DrawingFrame* frame) { void SoftwareRenderer::FinishDrawingFrame(DrawingFrame* frame) { TRACE_EVENT0("cc", "SoftwareRenderer::FinishDrawingFrame"); - current_framebuffer_lock_.reset(); + current_framebuffer_lock_ = nullptr; current_canvas_ = NULL; root_canvas_ = NULL; @@ -150,7 +150,7 @@ void SoftwareRenderer::Finish() {} void SoftwareRenderer::BindFramebufferToOutputSurface(DrawingFrame* frame) { DCHECK(!output_surface_->HasExternalStencilTest()); - current_framebuffer_lock_.reset(); + current_framebuffer_lock_ = nullptr; current_canvas_ = root_canvas_; } @@ -158,7 +158,6 @@ bool SoftwareRenderer::BindFramebufferToTexture( DrawingFrame* frame, const ScopedResource* texture, const gfx::Rect& target_rect) { - current_framebuffer_lock_.reset(); current_framebuffer_lock_ = make_scoped_ptr( new ResourceProvider::ScopedWriteLockSoftware( resource_provider_, texture->id())); diff --git a/cc/output/software_renderer_unittest.cc b/cc/output/software_renderer_unittest.cc index 9bb55a3..2818ab6 100644 --- a/cc/output/software_renderer_unittest.cc +++ b/cc/output/software_renderer_unittest.cc @@ -128,7 +128,7 @@ TEST_F(SoftwareRendererTest, SolidColorQuad) { shared_quad_state, outer_rect, outer_rect, SK_ColorYELLOW, false); RenderPassList list; - list.push_back(root_render_pass.PassAs<RenderPass>()); + list.push_back(root_render_pass.Pass()); float device_scale_factor = 1.f; gfx::Rect device_viewport_rect(outer_size); @@ -224,7 +224,7 @@ TEST_F(SoftwareRendererTest, TileQuad) { false); RenderPassList list; - list.push_back(root_render_pass.PassAs<RenderPass>()); + list.push_back(root_render_pass.Pass()); float device_scale_factor = 1.f; gfx::Rect device_viewport_rect(outer_size); @@ -298,7 +298,7 @@ TEST_F(SoftwareRendererTest, TileQuadVisibleRect) { quad->visible_rect = visible_rect; RenderPassList list; - list.push_back(root_render_pass.PassAs<RenderPass>()); + list.push_back(root_render_pass.Pass()); float device_scale_factor = 1.f; gfx::Rect device_viewport_rect(tile_size); diff --git a/cc/quads/draw_polygon.cc b/cc/quads/draw_polygon.cc index bfc2b492..71dbf36 100644 --- a/cc/quads/draw_polygon.cc +++ b/cc/quads/draw_polygon.cc @@ -76,7 +76,7 @@ DrawPolygon::~DrawPolygon() { } scoped_ptr<DrawPolygon> DrawPolygon::CreateCopy() { - DrawPolygon* new_polygon = new DrawPolygon(); + scoped_ptr<DrawPolygon> new_polygon(new DrawPolygon()); new_polygon->order_index_ = order_index_; new_polygon->original_ref_ = original_ref_; new_polygon->points_.reserve(points_.size()); @@ -84,7 +84,7 @@ scoped_ptr<DrawPolygon> DrawPolygon::CreateCopy() { new_polygon->normal_.set_x(normal_.x()); new_polygon->normal_.set_y(normal_.y()); new_polygon->normal_.set_z(normal_.z()); - return scoped_ptr<DrawPolygon>(new_polygon); + return new_polygon.Pass(); } float DrawPolygon::SignedPointDistance(const gfx::Point3F& point) const { diff --git a/cc/quads/render_pass_unittest.cc b/cc/quads/render_pass_unittest.cc index 3ddf269..36e57d0 100644 --- a/cc/quads/render_pass_unittest.cc +++ b/cc/quads/render_pass_unittest.cc @@ -225,8 +225,8 @@ TEST(RenderPassTest, CopyAllShouldBeIdentical) { gfx::Vector2dF(), // filters_scale FilterOperations()); - pass_list.push_back(pass.PassAs<RenderPass>()); - pass_list.push_back(contrib.PassAs<RenderPass>()); + pass_list.push_back(pass.Pass()); + pass_list.push_back(contrib.Pass()); // Make a copy with CopyAll(). RenderPassList copy_list; @@ -310,7 +310,7 @@ TEST(RenderPassTest, CopyAllWithCulledQuads) { gfx::Rect(3, 3, 3, 3), SkColor()); - pass_list.push_back(pass.PassAs<RenderPass>()); + pass_list.push_back(pass.Pass()); // Make a copy with CopyAll(). RenderPassList copy_list; diff --git a/cc/resources/bitmap_content_layer_updater.cc b/cc/resources/bitmap_content_layer_updater.cc index 59cb48c..63ba336 100644 --- a/cc/resources/bitmap_content_layer_updater.cc +++ b/cc/resources/bitmap_content_layer_updater.cc @@ -50,7 +50,7 @@ BitmapContentLayerUpdater::~BitmapContentLayerUpdater() {} scoped_ptr<LayerUpdater::Resource> BitmapContentLayerUpdater::CreateResource( PrioritizedResourceManager* manager) { - return scoped_ptr<LayerUpdater::Resource>( + return make_scoped_ptr( new Resource(this, PrioritizedResource::Create(manager))); } diff --git a/cc/resources/bitmap_skpicture_content_layer_updater.cc b/cc/resources/bitmap_skpicture_content_layer_updater.cc index 06b6563..5b4187d 100644 --- a/cc/resources/bitmap_skpicture_content_layer_updater.cc +++ b/cc/resources/bitmap_skpicture_content_layer_updater.cc @@ -62,7 +62,7 @@ BitmapSkPictureContentLayerUpdater::~BitmapSkPictureContentLayerUpdater() {} scoped_ptr<LayerUpdater::Resource> BitmapSkPictureContentLayerUpdater::CreateResource( PrioritizedResourceManager* manager) { - return scoped_ptr<LayerUpdater::Resource>( + return make_scoped_ptr( new Resource(this, PrioritizedResource::Create(manager))); } diff --git a/cc/resources/image_layer_updater.cc b/cc/resources/image_layer_updater.cc index d5d62ed..0538d96 100644 --- a/cc/resources/image_layer_updater.cc +++ b/cc/resources/image_layer_updater.cc @@ -29,7 +29,7 @@ scoped_refptr<ImageLayerUpdater> ImageLayerUpdater::Create() { scoped_ptr<LayerUpdater::Resource> ImageLayerUpdater::CreateResource( PrioritizedResourceManager* manager) { - return scoped_ptr<LayerUpdater::Resource>( + return make_scoped_ptr( new Resource(this, PrioritizedResource::Create(manager))); } diff --git a/cc/resources/picture.cc b/cc/resources/picture.cc index ec1f333..6fa5abc 100644 --- a/cc/resources/picture.cc +++ b/cc/resources/picture.cc @@ -412,7 +412,7 @@ scoped_ptr<base::Value> Picture::AsValue() const { base::Base64Encode(std::string(serialized_picture.get(), serialized_size), &b64_picture); res->SetString("skp64", b64_picture); - return res.PassAs<base::Value>(); + return res.Pass(); } void Picture::EmitTraceSnapshot() const { diff --git a/cc/resources/prioritized_resource_unittest.cc b/cc/resources/prioritized_resource_unittest.cc index 68d81a2..05e87d9 100644 --- a/cc/resources/prioritized_resource_unittest.cc +++ b/cc/resources/prioritized_resource_unittest.cc @@ -39,7 +39,7 @@ class PrioritizedResourceTest : public testing::Test { virtual ~PrioritizedResourceTest() { DebugScopedSetImplThread impl_thread(&proxy_); - resource_provider_.reset(); + resource_provider_ = nullptr; } size_t TexturesMemorySize(size_t texture_count) { @@ -277,7 +277,7 @@ TEST_F(PrioritizedResourceTest, ReduceWastedMemory) { EXPECT_EQ(TexturesMemorySize(20), resource_manager->MemoryUseBytes()); // Destroy one texture, not enough is wasted to cause cleanup. - textures[0] = scoped_ptr<PrioritizedResource>(); + textures[0] = nullptr; PrioritizeTexturesAndBackings(resource_manager.get()); { DebugScopedSetImplThreadAndMainThreadBlocked @@ -290,7 +290,7 @@ TEST_F(PrioritizedResourceTest, ReduceWastedMemory) { // Destroy half the textures, leaving behind the backings. Now a cleanup // should happen. for (size_t i = 0; i < kMaxTextures / 2; ++i) - textures[i] = scoped_ptr<PrioritizedResource>(); + textures[i] = nullptr; PrioritizeTexturesAndBackings(resource_manager.get()); { DebugScopedSetImplThreadAndMainThreadBlocked @@ -357,7 +357,7 @@ TEST_F(PrioritizedResourceTest, InUseNotWastedMemory) { // sent to a parent compositor though, so they should not be considered wasted // and a cleanup should not happen. for (size_t i = 0; i < kMaxTextures / 2; ++i) - textures[i] = scoped_ptr<PrioritizedResource>(); + textures[i] = nullptr; PrioritizeTexturesAndBackings(resource_manager.get()); { DebugScopedSetImplThreadAndMainThreadBlocked @@ -565,7 +565,7 @@ TEST_F(PrioritizedResourceTest, EvictingTexturesInParent) { // Drop all the textures. Now we have backings that can be recycled. for (size_t i = 0; i < 8; ++i) - textures[0].reset(); + textures[0] = nullptr; PrioritizeTexturesAndBackings(resource_manager.get()); // The next commit finishes. @@ -728,7 +728,7 @@ TEST_F(PrioritizedResourceTest, ResourceManagerDestroyedFirst) { impl_thread_and_main_thread_blocked(&proxy_); resource_manager->ClearAllMemory(resource_provider()); } - resource_manager.reset(); + resource_manager = nullptr; EXPECT_FALSE(texture->can_acquire_backing_texture()); EXPECT_FALSE(texture->have_backing_texture()); @@ -758,7 +758,7 @@ TEST_F(PrioritizedResourceTest, TextureMovedToNewManager) { impl_thread_and_main_thread_blocked(&proxy_); resource_manager_one->ClearAllMemory(resource_provider()); } - resource_manager_one.reset(); + resource_manager_one = nullptr; EXPECT_FALSE(texture->can_acquire_backing_texture()); EXPECT_FALSE(texture->have_backing_texture()); diff --git a/cc/resources/raster_worker_pool_unittest.cc b/cc/resources/raster_worker_pool_unittest.cc index 823e59d..86755f8 100644 --- a/cc/resources/raster_worker_pool_unittest.cc +++ b/cc/resources/raster_worker_pool_unittest.cc @@ -174,6 +174,7 @@ class RasterWorkerPoolTest DCHECK(raster_worker_pool_); raster_worker_pool_->AsRasterizer()->SetClient(this); } + virtual void TearDown() OVERRIDE { raster_worker_pool_->AsRasterizer()->Shutdown(); raster_worker_pool_->AsRasterizer()->CheckForCompletedTasks(); diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc index 1522886..0e7c938 100644 --- a/cc/resources/resource_provider.cc +++ b/cc/resources/resource_provider.cc @@ -1102,9 +1102,9 @@ void ResourceProvider::CleanUpGLIfNeeded() { } #endif // DCHECK_IS_ON - texture_uploader_.reset(); - texture_id_allocator_.reset(); - buffer_id_allocator_.reset(); + texture_uploader_ = nullptr; + texture_id_allocator_ = nullptr; + buffer_id_allocator_ = nullptr; gl->Finish(); } diff --git a/cc/resources/resource_provider_unittest.cc b/cc/resources/resource_provider_unittest.cc index e1fd054..04d88c6 100644 --- a/cc/resources/resource_provider_unittest.cc +++ b/cc/resources/resource_provider_unittest.cc @@ -389,16 +389,15 @@ class ResourceProviderTest context3d_ = context3d.get(); scoped_refptr<TestContextProvider> context_provider = - TestContextProvider::Create( - context3d.PassAs<TestWebGraphicsContext3D>()); + TestContextProvider::Create(context3d.Pass()); output_surface_ = FakeOutputSurface::Create3d(context_provider); scoped_ptr<ResourceProviderContext> child_context_owned = ResourceProviderContext::Create(shared_data_.get()); child_context_ = child_context_owned.get(); - child_output_surface_ = FakeOutputSurface::Create3d( - child_context_owned.PassAs<TestWebGraphicsContext3D>()); + child_output_surface_ = + FakeOutputSurface::Create3d(child_context_owned.Pass()); break; } case ResourceProvider::Bitmap: @@ -1153,8 +1152,8 @@ TEST_P(ResourceProviderTest, TransferGLToSoftware) { ResourceProviderContext::Create(shared_data_.get())); FakeOutputSurfaceClient child_output_surface_client; - scoped_ptr<OutputSurface> child_output_surface(FakeOutputSurface::Create3d( - child_context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> child_output_surface( + FakeOutputSurface::Create3d(child_context_owned.Pass())); CHECK(child_output_surface->BindToClient(&child_output_surface_client)); scoped_ptr<ResourceProvider> child_resource_provider( @@ -1456,7 +1455,7 @@ TEST_P(ResourceProviderTest, DestroyChildWithExportedResources) { // Destroy the parent resource provider. The resource that's left should be // lost at this point, and returned. - resource_provider_.reset(); + resource_provider_ = nullptr; ASSERT_EQ(1u, returned_to_child.size()); if (GetParam() == ResourceProvider::GLTexture) { EXPECT_NE(0u, returned_to_child[0].sync_point); @@ -1633,8 +1632,8 @@ class ResourceProviderTestTextureFilters : public ResourceProviderTest { TextureStateTrackingContext* child_context = child_context_owned.get(); FakeOutputSurfaceClient child_output_surface_client; - scoped_ptr<OutputSurface> child_output_surface(FakeOutputSurface::Create3d( - child_context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> child_output_surface( + FakeOutputSurface::Create3d(child_context_owned.Pass())); CHECK(child_output_surface->BindToClient(&child_output_surface_client)); scoped_ptr<SharedBitmapManager> shared_bitmap_manager( new TestSharedBitmapManager()); @@ -1653,8 +1652,8 @@ class ResourceProviderTestTextureFilters : public ResourceProviderTest { TextureStateTrackingContext* parent_context = parent_context_owned.get(); FakeOutputSurfaceClient parent_output_surface_client; - scoped_ptr<OutputSurface> parent_output_surface(FakeOutputSurface::Create3d( - parent_context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> parent_output_surface( + FakeOutputSurface::Create3d(parent_context_owned.Pass())); CHECK(parent_output_surface->BindToClient(&parent_output_surface_client)); scoped_ptr<ResourceProvider> parent_resource_provider( @@ -2205,7 +2204,7 @@ TEST_P(ResourceProviderTest, Shutdown) { EXPECT_EQ(0u, release_sync_point); EXPECT_FALSE(lost_resource); - child_resource_provider_.reset(); + child_resource_provider_ = nullptr; if (GetParam() == ResourceProvider::GLTexture) { EXPECT_LE(sync_point, release_sync_point); @@ -2232,7 +2231,7 @@ TEST_P(ResourceProviderTest, ShutdownWithExportedResource) { EXPECT_EQ(0u, release_sync_point); EXPECT_FALSE(lost_resource); - child_resource_provider_.reset(); + child_resource_provider_ = nullptr; // Since the resource is in the parent, the child considers it lost. EXPECT_EQ(0u, release_sync_point); @@ -2268,7 +2267,7 @@ TEST_P(ResourceProviderTest, LostContext) { EXPECT_EQ(NULL, main_thread_task_runner); resource_provider_->DidLoseOutputSurface(); - resource_provider_.reset(); + resource_provider_ = nullptr; EXPECT_LE(sync_point, release_sync_point); EXPECT_TRUE(lost_resource); @@ -2285,8 +2284,8 @@ TEST_P(ResourceProviderTest, ScopedSampler) { TextureStateTrackingContext* context = context_owned.get(); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::Create3d(context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); scoped_ptr<ResourceProvider> resource_provider( @@ -2372,8 +2371,8 @@ TEST_P(ResourceProviderTest, ManagedResource) { TextureStateTrackingContext* context = context_owned.get(); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::Create3d(context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); scoped_ptr<ResourceProvider> resource_provider( @@ -2427,8 +2426,8 @@ TEST_P(ResourceProviderTest, TextureWrapMode) { TextureStateTrackingContext* context = context_owned.get(); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::Create3d(context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); scoped_ptr<ResourceProvider> resource_provider( @@ -2486,8 +2485,8 @@ TEST_P(ResourceProviderTest, TextureHint) { context->set_support_texture_usage(true); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::Create3d(context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); scoped_ptr<ResourceProvider> resource_provider( @@ -2611,8 +2610,8 @@ TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D) { TextureStateTrackingContext* context = context_owned.get(); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::Create3d(context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); scoped_ptr<ResourceProvider> resource_provider( @@ -2696,8 +2695,8 @@ TEST_P(ResourceProviderTest, TextureMailbox_GLTextureExternalOES) { TextureStateTrackingContext* context = context_owned.get(); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::Create3d(context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); scoped_ptr<ResourceProvider> resource_provider( @@ -2771,8 +2770,8 @@ TEST_P(ResourceProviderTest, TextureStateTrackingContext* context = context_owned.get(); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::Create3d(context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); scoped_ptr<ResourceProvider> resource_provider( @@ -2830,8 +2829,8 @@ TEST_P(ResourceProviderTest, TextureMailbox_WaitSyncPointIfNeeded_NoSyncPoint) { TextureStateTrackingContext* context = context_owned.get(); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::Create3d(context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); scoped_ptr<ResourceProvider> resource_provider( @@ -2958,8 +2957,8 @@ TEST_P(ResourceProviderTest, TextureAllocation) { AllocationTrackingContext3D* context = context_owned.get(); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::Create3d(context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); scoped_ptr<ResourceProvider> resource_provider( @@ -3038,8 +3037,8 @@ TEST_P(ResourceProviderTest, TextureAllocationHint) { context->set_support_texture_usage(true); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::Create3d(context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); scoped_ptr<ResourceProvider> resource_provider( @@ -3098,8 +3097,8 @@ TEST_P(ResourceProviderTest, TextureAllocationHint_BGRA) { context->set_support_texture_usage(true); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::Create3d(context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); scoped_ptr<ResourceProvider> resource_provider( @@ -3152,8 +3151,8 @@ TEST_P(ResourceProviderTest, PixelBuffer_GLTexture) { AllocationTrackingContext3D* context = context_owned.get(); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::Create3d(context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); gfx::Size size(2, 2); @@ -3199,8 +3198,8 @@ TEST_P(ResourceProviderTest, ForcingAsyncUploadToComplete) { AllocationTrackingContext3D* context = context_owned.get(); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::Create3d(context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); gfx::Size size(2, 2); @@ -3246,8 +3245,8 @@ TEST_P(ResourceProviderTest, PixelBufferLostContext) { AllocationTrackingContext3D* context = context_owned.get(); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::Create3d(context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); gfx::Size size(2, 2); @@ -3288,8 +3287,8 @@ TEST_P(ResourceProviderTest, Image_GLTexture) { AllocationTrackingContext3D* context = context_owned.get(); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::Create3d(context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); const int kWidth = 2; @@ -3398,8 +3397,8 @@ TEST_P(ResourceProviderTest, CopyResource_GLTexture) { context_owned->set_support_sync_query(true); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::Create3d(context_owned.Pass())); ASSERT_TRUE(output_surface->BindToClient(&output_surface_client)); const int kWidth = 2; @@ -3490,8 +3489,7 @@ void InitializeGLAndCheck(ContextSharedData* shared_data, ResourceProviderContext* context = context_owned.get(); scoped_refptr<TestContextProvider> context_provider = - TestContextProvider::Create( - context_owned.PassAs<TestWebGraphicsContext3D>()); + TestContextProvider::Create(context_owned.Pass()); output_surface->InitializeAndSetContext3d(context_provider); resource_provider->InitializeGL(); @@ -3543,8 +3541,8 @@ TEST_P(ResourceProviderTest, CompressedTextureETC1Allocate) { context_owned->set_support_compressed_texture_etc1(true); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::Create3d(context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); gfx::Size size(4, 4); @@ -3579,8 +3577,8 @@ TEST_P(ResourceProviderTest, CompressedTextureETC1SetPixels) { context_owned->set_support_compressed_texture_etc1(true); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::Create3d(context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); gfx::Size size(4, 4); @@ -3634,8 +3632,8 @@ TEST(ResourceProviderTest, TextureAllocationChunkSize) { TextureIdAllocationTrackingContext* context = context_owned.get(); FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - context_owned.PassAs<TestWebGraphicsContext3D>())); + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::Create3d(context_owned.Pass())); CHECK(output_surface->BindToClient(&output_surface_client)); scoped_ptr<SharedBitmapManager> shared_bitmap_manager( new TestSharedBitmapManager()); diff --git a/cc/resources/task_graph_runner_perftest.cc b/cc/resources/task_graph_runner_perftest.cc index bfa4ebe..533ea4b 100644 --- a/cc/resources/task_graph_runner_perftest.cc +++ b/cc/resources/task_graph_runner_perftest.cc @@ -49,7 +49,7 @@ class TaskGraphRunnerPerfTest : public testing::Test { task_graph_runner_ = make_scoped_ptr(new TaskGraphRunner); namespace_token_ = task_graph_runner_->GetNamespaceToken(); } - virtual void TearDown() OVERRIDE { task_graph_runner_.reset(); } + virtual void TearDown() OVERRIDE { task_graph_runner_ = nullptr; } void AfterTest(const std::string& test_name) { // Format matches chrome/test/perf/perf_test.h:PrintResult diff --git a/cc/resources/texture_mailbox_deleter_unittest.cc b/cc/resources/texture_mailbox_deleter_unittest.cc index 0d04c99..05e33a3 100644 --- a/cc/resources/texture_mailbox_deleter_unittest.cc +++ b/cc/resources/texture_mailbox_deleter_unittest.cc @@ -34,7 +34,7 @@ TEST(TextureMailboxDeleterTest, Destroy) { // When the deleter is destroyed, it immediately drops its ref on the // ContextProvider, and deletes the texture. - deleter.reset(); + deleter = nullptr; EXPECT_TRUE(context_provider->HasOneRef()); EXPECT_EQ(0u, context_provider->TestContext3d()->NumTextures()); diff --git a/cc/resources/tile_manager_perftest.cc b/cc/resources/tile_manager_perftest.cc index 38290de..e83596c 100644 --- a/cc/resources/tile_manager_perftest.cc +++ b/cc/resources/tile_manager_perftest.cc @@ -71,7 +71,7 @@ class FakeRasterizerImpl : public Rasterizer, public RasterizerTaskClient { // Overridden from RasterizerTaskClient: virtual scoped_ptr<RasterBuffer> AcquireBufferForRaster( const Resource* resource) OVERRIDE { - return scoped_ptr<RasterBuffer>(); + return nullptr; } virtual void ReleaseBufferForRaster( scoped_ptr<RasterBuffer> buffer) OVERRIDE {} @@ -119,8 +119,7 @@ class TileManagerPerfTest : public testing::Test { } virtual void InitializeRenderer() { - host_impl_.InitializeRenderer( - FakeOutputSurface::Create3d().PassAs<OutputSurface>()); + host_impl_.InitializeRenderer(FakeOutputSurface::Create3d().Pass()); tile_manager()->SetRasterizerForTesting(g_fake_rasterizer.Pointer()); } @@ -166,7 +165,7 @@ class TileManagerPerfTest : public testing::Test { scoped_ptr<FakePictureLayerImpl> pending_layer = FakePictureLayerImpl::CreateWithPile(pending_tree, id_, pile); pending_layer->SetDrawsContent(true); - pending_tree->SetRootLayer(pending_layer.PassAs<LayerImpl>()); + pending_tree->SetRootLayer(pending_layer.Pass()); pending_root_layer_ = static_cast<FakePictureLayerImpl*>( host_impl_.pending_tree()->LayerById(id_)); @@ -362,7 +361,7 @@ class TileManagerPerfTest : public testing::Test { host_impl_.pending_tree(), next_id, picture_pile_); layer->SetBounds(layer_bounds); layers.push_back(layer.get()); - pending_root_layer_->AddChild(layer.PassAs<LayerImpl>()); + pending_root_layer_->AddChild(layer.Pass()); FakePictureLayerImpl* fake_layer = static_cast<FakePictureLayerImpl*>(layers.back()); diff --git a/cc/resources/tile_manager_unittest.cc b/cc/resources/tile_manager_unittest.cc index 41c15cd..3fb5b13 100644 --- a/cc/resources/tile_manager_unittest.cc +++ b/cc/resources/tile_manager_unittest.cc @@ -520,8 +520,7 @@ class TileManagerTilePriorityQueueTest : public testing::Test { } virtual void InitializeRenderer() { - host_impl_.InitializeRenderer( - FakeOutputSurface::Create3d().PassAs<OutputSurface>()); + host_impl_.InitializeRenderer(FakeOutputSurface::Create3d()); } void SetupDefaultTrees(const gfx::Size& layer_bounds) { @@ -566,7 +565,7 @@ class TileManagerTilePriorityQueueTest : public testing::Test { scoped_ptr<FakePictureLayerImpl> pending_layer = FakePictureLayerImpl::CreateWithPile(pending_tree, id_, pile); pending_layer->SetDrawsContent(true); - pending_tree->SetRootLayer(pending_layer.PassAs<LayerImpl>()); + pending_tree->SetRootLayer(pending_layer.Pass()); pending_layer_ = static_cast<FakePictureLayerImpl*>( host_impl_.pending_tree()->LayerById(id_)); @@ -941,7 +940,7 @@ TEST_F(TileManagerTilePriorityQueueTest, scoped_ptr<FakePictureLayerImpl> pending_child = FakePictureLayerImpl::CreateWithPile( host_impl_.pending_tree(), 2, pending_pile); - pending_layer_->AddChild(pending_child.PassAs<LayerImpl>()); + pending_layer_->AddChild(pending_child.Pass()); FakePictureLayerImpl* pending_child_layer = static_cast<FakePictureLayerImpl*>(pending_layer_->children()[0]); @@ -1074,7 +1073,7 @@ TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueueEmptyLayers) { pending_layer->SetDrawsContent(true); pending_layer->DoPostCommitInitializationIfNeeded(); pending_layer->set_has_valid_tile_priorities(true); - pending_layer_->AddChild(pending_layer.PassAs<LayerImpl>()); + pending_layer_->AddChild(pending_layer.Pass()); } host_impl_.BuildRasterQueue(&queue, SAME_PRIORITY_FOR_BOTH_TREES); @@ -1123,7 +1122,7 @@ TEST_F(TileManagerTilePriorityQueueTest, EvictionTilePriorityQueueEmptyLayers) { pending_layer->SetDrawsContent(true); pending_layer->DoPostCommitInitializationIfNeeded(); pending_layer->set_has_valid_tile_priorities(true); - pending_layer_->AddChild(pending_layer.PassAs<LayerImpl>()); + pending_layer_->AddChild(pending_layer.Pass()); } host_impl_.BuildEvictionQueue(&queue, SAME_PRIORITY_FOR_BOTH_TREES); diff --git a/cc/resources/ui_resource_request.cc b/cc/resources/ui_resource_request.cc index 7568036..b8dd50a 100644 --- a/cc/resources/ui_resource_request.cc +++ b/cc/resources/ui_resource_request.cc @@ -26,7 +26,7 @@ UIResourceRequest& UIResourceRequest::operator=( if (request.bitmap_) { bitmap_ = make_scoped_ptr(new UIResourceBitmap(*request.bitmap_.get())); } else { - bitmap_.reset(); + bitmap_ = nullptr; } return *this; diff --git a/cc/surfaces/surface_aggregator.cc b/cc/surfaces/surface_aggregator.cc index 679d751..35107e8 100644 --- a/cc/surfaces/surface_aggregator.cc +++ b/cc/surfaces/surface_aggregator.cc @@ -355,7 +355,7 @@ scoped_ptr<CompositorFrame> SurfaceAggregator::Aggregate(SurfaceId surface_id) { contained_surfaces_[surface_id] = surface->frame_index(); const CompositorFrame* root_surface_frame = surface->GetEligibleFrame(); if (!root_surface_frame) - return scoped_ptr<CompositorFrame>(); + return nullptr; TRACE_EVENT0("cc", "SurfaceAggregator::Aggregate"); scoped_ptr<CompositorFrame> frame(new CompositorFrame); diff --git a/cc/test/animation_test_common.cc b/cc/test/animation_test_common.cc index 404e161..953dac4 100644 --- a/cc/test/animation_test_common.cc +++ b/cc/test/animation_test_common.cc @@ -41,11 +41,11 @@ int AddOpacityTransition(Target* target, int id = AnimationIdProvider::NextAnimationId(); - scoped_ptr<Animation> animation(Animation::Create( - curve.PassAs<AnimationCurve>(), - id, - AnimationIdProvider::NextGroupId(), - Animation::Opacity)); + scoped_ptr<Animation> animation( + Animation::Create(curve.Pass(), + id, + AnimationIdProvider::NextGroupId(), + Animation::Opacity)); animation->set_needs_synchronized_start_time(true); target->AddAnimation(animation.Pass()); @@ -70,11 +70,11 @@ int AddAnimatedTransform(Target* target, int id = AnimationIdProvider::NextAnimationId(); - scoped_ptr<Animation> animation(Animation::Create( - curve.PassAs<AnimationCurve>(), - id, - AnimationIdProvider::NextGroupId(), - Animation::Transform)); + scoped_ptr<Animation> animation( + Animation::Create(curve.Pass(), + id, + AnimationIdProvider::NextGroupId(), + Animation::Transform)); animation->set_needs_synchronized_start_time(true); target->AddAnimation(animation.Pass()); @@ -120,10 +120,7 @@ int AddAnimatedFilter(Target* target, int id = AnimationIdProvider::NextAnimationId(); scoped_ptr<Animation> animation(Animation::Create( - curve.PassAs<AnimationCurve>(), - id, - AnimationIdProvider::NextGroupId(), - Animation::Filter)); + curve.Pass(), id, AnimationIdProvider::NextGroupId(), Animation::Filter)); animation->set_needs_synchronized_start_time(true); target->AddAnimation(animation.Pass()); @@ -147,7 +144,7 @@ float FakeFloatAnimationCurve::GetValue(double now) const { } scoped_ptr<AnimationCurve> FakeFloatAnimationCurve::Clone() const { - return make_scoped_ptr(new FakeFloatAnimationCurve).PassAs<AnimationCurve>(); + return make_scoped_ptr(new FakeFloatAnimationCurve); } FakeTransformTransition::FakeTransformTransition(double duration) @@ -178,8 +175,7 @@ bool FakeTransformTransition::MaximumScale(float* max_scale) const { } scoped_ptr<AnimationCurve> FakeTransformTransition::Clone() const { - return make_scoped_ptr(new FakeTransformTransition(*this)) - .PassAs<AnimationCurve>(); + return make_scoped_ptr(new FakeTransformTransition(*this)); } @@ -242,8 +238,7 @@ gfx::Vector2dF FakeLayerAnimationValueProvider::ScrollOffsetForAnimation() } scoped_ptr<AnimationCurve> FakeFloatTransition::Clone() const { - return make_scoped_ptr(new FakeFloatTransition(*this)) - .PassAs<AnimationCurve>(); + return make_scoped_ptr(new FakeFloatTransition(*this)); } int AddOpacityTransitionToController(LayerAnimationController* controller, diff --git a/cc/test/cc_test_suite.cc b/cc/test/cc_test_suite.cc index abe61cb..f48f10a 100644 --- a/cc/test/cc_test_suite.cc +++ b/cc/test/cc_test_suite.cc @@ -29,7 +29,7 @@ void CCTestSuite::Initialize() { } void CCTestSuite::Shutdown() { - message_loop_.reset(); + message_loop_ = nullptr; base::TestSuite::Shutdown(); } diff --git a/cc/test/fake_content_layer.cc b/cc/test/fake_content_layer.cc index 87accc7..4025afd 100644 --- a/cc/test/fake_content_layer.cc +++ b/cc/test/fake_content_layer.cc @@ -32,7 +32,7 @@ FakeContentLayer::~FakeContentLayer() {} scoped_ptr<LayerImpl> FakeContentLayer::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return FakeContentLayerImpl::Create(tree_impl, layer_id_).PassAs<LayerImpl>(); + return FakeContentLayerImpl::Create(tree_impl, layer_id_); } bool FakeContentLayer::Update(ResourceUpdateQueue* queue, diff --git a/cc/test/fake_content_layer_impl.cc b/cc/test/fake_content_layer_impl.cc index 7e5a853..eb35bb6 100644 --- a/cc/test/fake_content_layer_impl.cc +++ b/cc/test/fake_content_layer_impl.cc @@ -14,7 +14,7 @@ FakeContentLayerImpl::~FakeContentLayerImpl() {} scoped_ptr<LayerImpl> FakeContentLayerImpl::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return FakeContentLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); + return FakeContentLayerImpl::Create(tree_impl, id()); } bool FakeContentLayerImpl::HaveResourceForTileAt(int i, int j) { diff --git a/cc/test/fake_delegated_renderer_layer.cc b/cc/test/fake_delegated_renderer_layer.cc index e8c2c0a..1ae8c40 100644 --- a/cc/test/fake_delegated_renderer_layer.cc +++ b/cc/test/fake_delegated_renderer_layer.cc @@ -16,8 +16,7 @@ FakeDelegatedRendererLayer::~FakeDelegatedRendererLayer() {} scoped_ptr<LayerImpl> FakeDelegatedRendererLayer::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return FakeDelegatedRendererLayerImpl::Create( - tree_impl, layer_id_).PassAs<LayerImpl>(); + return FakeDelegatedRendererLayerImpl::Create(tree_impl, layer_id_); } } // namespace cc diff --git a/cc/test/fake_delegated_renderer_layer_impl.cc b/cc/test/fake_delegated_renderer_layer_impl.cc index a898470..8925bdb 100644 --- a/cc/test/fake_delegated_renderer_layer_impl.cc +++ b/cc/test/fake_delegated_renderer_layer_impl.cc @@ -22,8 +22,7 @@ FakeDelegatedRendererLayerImpl::~FakeDelegatedRendererLayerImpl() {} scoped_ptr<LayerImpl> FakeDelegatedRendererLayerImpl::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return FakeDelegatedRendererLayerImpl::Create( - tree_impl, id()).PassAs<LayerImpl>(); + return FakeDelegatedRendererLayerImpl::Create(tree_impl, id()); } static ResourceProvider::ResourceId AddResourceToFrame( diff --git a/cc/test/fake_layer_tree_host_client.cc b/cc/test/fake_layer_tree_host_client.cc index 087cbb1..17ed10c 100644 --- a/cc/test/fake_layer_tree_host_client.cc +++ b/cc/test/fake_layer_tree_host_client.cc @@ -27,17 +27,15 @@ void FakeLayerTreeHostClient::RequestNewOutputSurface(bool fallback) { if (use_software_rendering_) { if (use_delegating_renderer_) { surface = FakeOutputSurface::CreateDelegatingSoftware( - make_scoped_ptr(new SoftwareOutputDevice)) - .PassAs<OutputSurface>(); + make_scoped_ptr(new SoftwareOutputDevice)); } else { surface = FakeOutputSurface::CreateSoftware( - make_scoped_ptr(new SoftwareOutputDevice)) - .PassAs<OutputSurface>(); + make_scoped_ptr(new SoftwareOutputDevice)); } } else if (use_delegating_renderer_) { - surface = FakeOutputSurface::CreateDelegating3d().PassAs<OutputSurface>(); + surface = FakeOutputSurface::CreateDelegating3d(); } else { - surface = FakeOutputSurface::Create3d().PassAs<OutputSurface>(); + surface = FakeOutputSurface::Create3d(); } host_->SetOutputSurface(surface.Pass()); } diff --git a/cc/test/fake_output_surface.cc b/cc/test/fake_output_surface.cc index 9c027ea..29680de 100644 --- a/cc/test/fake_output_surface.cc +++ b/cc/test/fake_output_surface.cc @@ -105,7 +105,7 @@ bool FakeOutputSurface::BindToClient(OutputSurfaceClient* client) { client_ = client; if (memory_policy_to_set_at_bind_) { client_->SetMemoryPolicy(*memory_policy_to_set_at_bind_.get()); - memory_policy_to_set_at_bind_.reset(); + memory_policy_to_set_at_bind_ = nullptr; } return true; } else { diff --git a/cc/test/fake_picture_layer.cc b/cc/test/fake_picture_layer.cc index 12cad83..bd169ba 100644 --- a/cc/test/fake_picture_layer.cc +++ b/cc/test/fake_picture_layer.cc @@ -22,7 +22,7 @@ FakePictureLayer::~FakePictureLayer() {} scoped_ptr<LayerImpl> FakePictureLayer::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return FakePictureLayerImpl::Create(tree_impl, layer_id_).PassAs<LayerImpl>(); + return FakePictureLayerImpl::Create(tree_impl, layer_id_); } bool FakePictureLayer::Update(ResourceUpdateQueue* queue, diff --git a/cc/test/fake_picture_layer_impl.cc b/cc/test/fake_picture_layer_impl.cc index f2a5d5c..79337fb 100644 --- a/cc/test/fake_picture_layer_impl.cc +++ b/cc/test/fake_picture_layer_impl.cc @@ -50,8 +50,7 @@ FakePictureLayerImpl::FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id) scoped_ptr<LayerImpl> FakePictureLayerImpl::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return make_scoped_ptr( - new FakePictureLayerImpl(tree_impl, id())).PassAs<LayerImpl>(); + return make_scoped_ptr(new FakePictureLayerImpl(tree_impl, id())); } void FakePictureLayerImpl::AppendQuads( diff --git a/cc/test/fake_tile_manager.cc b/cc/test/fake_tile_manager.cc index d11d0fd..6243ae2 100644 --- a/cc/test/fake_tile_manager.cc +++ b/cc/test/fake_tile_manager.cc @@ -51,7 +51,7 @@ class FakeRasterizerImpl : public Rasterizer, public RasterizerTaskClient { // Overridden from RasterizerTaskClient: virtual scoped_ptr<RasterBuffer> AcquireBufferForRaster( const Resource* resource) OVERRIDE { - return scoped_ptr<RasterBuffer>(); + return nullptr; } virtual void ReleaseBufferForRaster( scoped_ptr<RasterBuffer> buffer) OVERRIDE {} diff --git a/cc/test/layer_test_common.cc b/cc/test/layer_test_common.cc index be3606f..2870887 100644 --- a/cc/test/layer_test_common.cc +++ b/cc/test/layer_test_common.cc @@ -112,8 +112,7 @@ LayerTestCommon::LayerImplTest::LayerImplTest() root_layer_impl_(LayerImpl::Create(host_->host_impl()->active_tree(), 1)), render_pass_(RenderPass::Create()) { scoped_ptr<FakeOutputSurface> output_surface = FakeOutputSurface::Create3d(); - host_->host_impl()->InitializeRenderer( - output_surface.PassAs<OutputSurface>()); + host_->host_impl()->InitializeRenderer(FakeOutputSurface::Create3d()); } LayerTestCommon::LayerImplTest::~LayerImplTest() {} diff --git a/cc/test/layer_test_common.h b/cc/test/layer_test_common.h index 8e2fdfb..5ff96ef 100644 --- a/cc/test/layer_test_common.h +++ b/cc/test/layer_test_common.h @@ -55,7 +55,7 @@ class LayerTestCommon { T* AddChildToRoot() { scoped_ptr<T> layer = T::Create(host_->host_impl()->active_tree(), 2); T* ptr = layer.get(); - root_layer_impl_->AddChild(layer.template PassAs<LayerImpl>()); + root_layer_impl_->AddChild(layer.Pass()); return ptr; } @@ -63,7 +63,7 @@ class LayerTestCommon { T* AddChildToRoot(const A& a) { scoped_ptr<T> layer = T::Create(host_->host_impl()->active_tree(), 2, a); T* ptr = layer.get(); - root_layer_impl_->AddChild(layer.template PassAs<LayerImpl>()); + root_layer_impl_->AddChild(layer.Pass()); return ptr; } @@ -72,7 +72,7 @@ class LayerTestCommon { scoped_ptr<T> layer = T::Create(host_->host_impl()->active_tree(), 2, a, b); T* ptr = layer.get(); - root_layer_impl_->AddChild(layer.template PassAs<LayerImpl>()); + root_layer_impl_->AddChild(layer.Pass()); return ptr; } @@ -81,7 +81,7 @@ class LayerTestCommon { scoped_ptr<T> layer = T::Create(host_->host_impl()->active_tree(), 2, a, b, c, d); T* ptr = layer.get(); - root_layer_impl_->AddChild(layer.template PassAs<LayerImpl>()); + root_layer_impl_->AddChild(layer.Pass()); return ptr; } @@ -99,7 +99,7 @@ class LayerTestCommon { scoped_ptr<T> layer = T::Create(host_->host_impl()->active_tree(), 2, a, b, c, d, e); T* ptr = layer.get(); - root_layer_impl_->AddChild(layer.template PassAs<LayerImpl>()); + root_layer_impl_->AddChild(layer.Pass()); return ptr; } diff --git a/cc/test/layer_tree_pixel_test.cc b/cc/test/layer_tree_pixel_test.cc index 4e4e039..ed14e33 100644 --- a/cc/test/layer_tree_pixel_test.cc +++ b/cc/test/layer_tree_pixel_test.cc @@ -47,8 +47,7 @@ scoped_ptr<OutputSurface> LayerTreePixelTest::CreateOutputSurface( software_output_device->set_surface_expansion_size( surface_expansion_size); output_surface = make_scoped_ptr( - new PixelTestOutputSurface( - software_output_device.PassAs<SoftwareOutputDevice>())); + new PixelTestOutputSurface(software_output_device.Pass())); break; } @@ -61,7 +60,7 @@ scoped_ptr<OutputSurface> LayerTreePixelTest::CreateOutputSurface( } output_surface->set_surface_expansion_size(surface_expansion_size); - return output_surface.PassAs<OutputSurface>(); + return output_surface.Pass(); } void LayerTreePixelTest::CommitCompleteOnThread(LayerTreeHostImpl* impl) { @@ -229,7 +228,7 @@ scoped_ptr<SkBitmap> LayerTreePixelTest::CopyTextureMailboxToBitmap( const TextureMailbox& texture_mailbox) { DCHECK(texture_mailbox.IsTexture()); if (!texture_mailbox.IsTexture()) - return scoped_ptr<SkBitmap>(); + return nullptr; scoped_ptr<gpu::GLInProcessContext> context = CreateTestInProcessContext(); GLES2Interface* gl = context->GetImplementation(); diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc index 05e4fc5..15d15c1 100644 --- a/cc/test/layer_tree_test.cc +++ b/cc/test/layer_tree_test.cc @@ -55,10 +55,8 @@ class ThreadProxyForTest : public ThreadProxy { LayerTreeHost* host, scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { - return make_scoped_ptr( - new ThreadProxyForTest( - test_hooks, host, main_task_runner, impl_task_runner)) - .PassAs<Proxy>(); + return make_scoped_ptr(new ThreadProxyForTest( + test_hooks, host, main_task_runner, impl_task_runner)); } virtual ~ThreadProxyForTest() {} @@ -351,12 +349,12 @@ class LayerTreeHostForTesting : public LayerTreeHost { virtual scoped_ptr<LayerTreeHostImpl> CreateLayerTreeHostImpl( LayerTreeHostImplClient* host_impl_client) OVERRIDE { return LayerTreeHostImplForTesting::Create( - test_hooks_, - settings(), - host_impl_client, - proxy(), - shared_bitmap_manager_.get(), - rendering_stats_instrumentation()).PassAs<LayerTreeHostImpl>(); + test_hooks_, + settings(), + host_impl_client, + proxy(), + shared_bitmap_manager_.get(), + rendering_stats_instrumentation()); } virtual void SetNeedsCommit() OVERRIDE { @@ -654,7 +652,7 @@ void LayerTreeTest::RunTest(bool threaded, timeout_.Cancel(); ASSERT_FALSE(layer_tree_host_.get()); - client_.reset(); + client_ = nullptr; if (timed_out_) { FAIL() << "Test timed out"; return; @@ -678,7 +676,7 @@ scoped_ptr<OutputSurface> LayerTreeTest::CreateOutputSurface(bool fallback) { output_surface->capabilities().delegated_rendering); } output_surface_ = output_surface.get(); - return output_surface.PassAs<OutputSurface>(); + return output_surface.Pass(); } scoped_ptr<FakeOutputSurface> LayerTreeTest::CreateFakeOutputSurface( @@ -707,7 +705,7 @@ int LayerTreeTest::LastCommittedSourceFrameNumber(LayerTreeHostImpl* impl) void LayerTreeTest::DestroyLayerTreeHost() { if (layer_tree_host_ && layer_tree_host_->root_layer()) layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); - layer_tree_host_.reset(); + layer_tree_host_ = nullptr; } } // namespace cc diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc index de02e5b..6900319 100644 --- a/cc/test/pixel_test.cc +++ b/cc/test/pixel_test.cc @@ -131,7 +131,7 @@ void PixelTest::SetUpGLRenderer(bool use_skia_gpu_backend) { output_surface_.get(), resource_provider_.get(), texture_mailbox_deleter_.get(), - 0).PassAs<DirectRenderer>(); + 0); } void PixelTest::ForceExpandedViewport(const gfx::Size& surface_expansion) { @@ -169,10 +169,8 @@ void PixelTest::SetUpSoftwareRenderer() { false, 1, false); - renderer_ = - SoftwareRenderer::Create( - this, &settings_, output_surface_.get(), resource_provider_.get()) - .PassAs<DirectRenderer>(); + renderer_ = SoftwareRenderer::Create( + this, &settings_, output_surface_.get(), resource_provider_.get()); } } // namespace cc diff --git a/cc/test/render_pass_test_utils.cc b/cc/test/render_pass_test_utils.cc index 151b7b4..1f213163 100644 --- a/cc/test/render_pass_test_utils.cc +++ b/cc/test/render_pass_test_utils.cc @@ -22,7 +22,7 @@ TestRenderPass* AddRenderPass(RenderPassList* pass_list, scoped_ptr<TestRenderPass> pass(TestRenderPass::Create()); pass->SetNew(id, output_rect, output_rect, root_transform); TestRenderPass* saved = pass.get(); - pass_list->push_back(pass.PassAs<RenderPass>()); + pass_list->push_back(pass.Pass()); return saved; } diff --git a/cc/test/test_shared_bitmap_manager.cc b/cc/test/test_shared_bitmap_manager.cc index e985572..d7716dd 100644 --- a/cc/test/test_shared_bitmap_manager.cc +++ b/cc/test/test_shared_bitmap_manager.cc @@ -25,7 +25,7 @@ scoped_ptr<SharedBitmap> TestSharedBitmapManager::AllocateSharedBitmap( memory->CreateAndMapAnonymous(size.GetArea() * 4); SharedBitmapId id = SharedBitmap::GenerateId(); bitmap_map_[id] = memory.get(); - return scoped_ptr<SharedBitmap>( + return make_scoped_ptr( new SharedBitmap(memory.release(), id, base::Bind(&FreeSharedBitmap))); } @@ -34,8 +34,8 @@ scoped_ptr<SharedBitmap> TestSharedBitmapManager::GetSharedBitmapFromId( const SharedBitmapId& id) { base::AutoLock lock(lock_); if (bitmap_map_.find(id) == bitmap_map_.end()) - return scoped_ptr<SharedBitmap>(); - return scoped_ptr<SharedBitmap>( + return nullptr; + return make_scoped_ptr( new SharedBitmap(bitmap_map_[id], id, base::Bind(&IgnoreSharedBitmap))); } @@ -44,7 +44,7 @@ scoped_ptr<SharedBitmap> TestSharedBitmapManager::GetBitmapForSharedMemory( base::AutoLock lock(lock_); SharedBitmapId id = SharedBitmap::GenerateId(); bitmap_map_[id] = memory; - return scoped_ptr<SharedBitmap>( + return make_scoped_ptr( new SharedBitmap(memory, id, base::Bind(&IgnoreSharedBitmap))); } diff --git a/cc/test/test_web_graphics_context_3d.cc b/cc/test/test_web_graphics_context_3d.cc index e1e0f40..7f839f2 100644 --- a/cc/test/test_web_graphics_context_3d.cc +++ b/cc/test/test_web_graphics_context_3d.cc @@ -502,7 +502,7 @@ void TestWebGraphicsContext3D::bufferData(GLenum target, DCHECK_EQ(target, buffers.get(bound_buffer_)->target); Buffer* buffer = buffers.get(bound_buffer_); if (context_lost_) { - buffer->pixels.reset(); + buffer->pixels = nullptr; return; } @@ -541,7 +541,7 @@ GLboolean TestWebGraphicsContext3D::unmapBufferCHROMIUM( base::ScopedPtrHashMap<unsigned, Buffer>& buffers = namespace_->buffers; DCHECK_GT(buffers.count(bound_buffer_), 0u); DCHECK_EQ(target, buffers.get(bound_buffer_)->target); - buffers.get(bound_buffer_)->pixels.reset(); + buffers.get(bound_buffer_)->pixels = nullptr; return true; } diff --git a/cc/test/tiled_layer_test_common.cc b/cc/test/tiled_layer_test_common.cc index 029eccd..324feb9 100644 --- a/cc/test/tiled_layer_test_common.cc +++ b/cc/test/tiled_layer_test_common.cc @@ -58,7 +58,7 @@ void FakeLayerUpdater::SetRectToInvalidate(const gfx::Rect& rect, scoped_ptr<LayerUpdater::Resource> FakeLayerUpdater::CreateResource( PrioritizedResourceManager* manager) { - return scoped_ptr<LayerUpdater::Resource>( + return make_scoped_ptr( new Resource(this, PrioritizedResource::Create(manager))); } diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index 78373c7..6b86eb6 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc @@ -166,7 +166,7 @@ LayerTreeHost::~LayerTreeHost() { BreakSwapPromises(SwapPromise::COMMIT_FAILS); - overhang_ui_resource_.reset(); + overhang_ui_resource_ = nullptr; if (root_layer_.get()) root_layer_->SetLayerTreeHost(NULL); @@ -366,7 +366,7 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) { pending_page_scale_animation_->use_anchor, pending_page_scale_animation_->scale, pending_page_scale_animation_->duration); - pending_page_scale_animation_.reset(); + pending_page_scale_animation_ = nullptr; } if (!ui_resource_request_queue_.empty()) { diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc index 1efc110..82e34fa 100644 --- a/cc/trees/layer_tree_host_common_unittest.cc +++ b/cc/trees/layer_tree_host_common_unittest.cc @@ -7852,9 +7852,9 @@ TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) { AnimationScaleFactorTrackingLayerImpl* child_raw = child.get(); AnimationScaleFactorTrackingLayerImpl* grand_child_raw = grand_child.get(); - child->AddChild(grand_child.PassAs<LayerImpl>()); - parent->AddChild(child.PassAs<LayerImpl>()); - grand_parent->AddChild(parent.PassAs<LayerImpl>()); + child->AddChild(grand_child.Pass()); + parent->AddChild(child.Pass()); + grand_parent->AddChild(parent.Pass()); SetLayerPropertiesForTesting(grand_parent.get(), identity_matrix, diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 29e29c3..5771bbb 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -309,9 +309,9 @@ LayerTreeHostImpl::~LayerTreeHostImpl() { if (pending_tree_) pending_tree_->Shutdown(); active_tree_->Shutdown(); - recycle_tree_.reset(); - pending_tree_.reset(); - active_tree_.reset(); + recycle_tree_ = nullptr; + pending_tree_ = nullptr; + active_tree_ = nullptr; DestroyTileManager(); } @@ -446,7 +446,7 @@ void LayerTreeHostImpl::StartPageScaleAnimation( // Easing constants experimentally determined. scoped_ptr<TimingFunction> timing_function = - CubicBezierTimingFunction::Create(.8, 0, .3, .9).PassAs<TimingFunction>(); + CubicBezierTimingFunction::Create(.8, 0, .3, .9); page_scale_animation_ = PageScaleAnimation::Create(scroll_total, @@ -506,7 +506,7 @@ bool LayerTreeHostImpl::HaveTouchEventHandlersAt( scoped_ptr<SwapPromiseMonitor> LayerTreeHostImpl::CreateLatencyInfoSwapPromiseMonitor( ui::LatencyInfo* latency) { - return scoped_ptr<SwapPromiseMonitor>( + return make_scoped_ptr( new LatencyInfoSwapPromiseMonitor(latency, NULL, this)); } @@ -1171,16 +1171,16 @@ void LayerTreeHostImpl::ResetTreesForTesting() { active_tree_ = LayerTreeImpl::create(this); if (pending_tree_) pending_tree_->DetachLayerTree(); - pending_tree_.reset(); + pending_tree_ = nullptr; if (recycle_tree_) recycle_tree_->DetachLayerTree(); - recycle_tree_.reset(); + recycle_tree_ = nullptr; } void LayerTreeHostImpl::ResetRecycleTreeForTesting() { if (recycle_tree_) recycle_tree_->DetachLayerTree(); - recycle_tree_.reset(); + recycle_tree_ = nullptr; } void LayerTreeHostImpl::EnforceManagedMemoryPolicy( @@ -2041,10 +2041,10 @@ void LayerTreeHostImpl::CreateAndSetTileManager() { } void LayerTreeHostImpl::DestroyTileManager() { - tile_manager_.reset(); - resource_pool_.reset(); - staging_resource_pool_.reset(); - raster_worker_pool_.reset(); + tile_manager_ = nullptr; + resource_pool_ = nullptr; + staging_resource_pool_ = nullptr; + raster_worker_pool_ = nullptr; } bool LayerTreeHostImpl::UsePendingTreeForSync() const { @@ -2077,10 +2077,10 @@ bool LayerTreeHostImpl::InitializeRenderer( ReleaseTreeResources(); // Note: order is important here. - renderer_.reset(); + renderer_ = nullptr; DestroyTileManager(); - resource_provider_.reset(); - output_surface_.reset(); + resource_provider_ = nullptr; + output_surface_ = nullptr; if (!output_surface->BindToClient(this)) return false; @@ -2142,7 +2142,7 @@ void LayerTreeHostImpl::DeferredInitialize() { DCHECK(output_surface_->context_provider()); ReleaseTreeResources(); - renderer_.reset(); + renderer_ = nullptr; DestroyTileManager(); resource_provider_->InitializeGL(); @@ -2160,7 +2160,7 @@ void LayerTreeHostImpl::ReleaseGL() { DCHECK(output_surface_->context_provider()); ReleaseTreeResources(); - renderer_.reset(); + renderer_ = nullptr; DestroyTileManager(); resource_provider_->InitializeSoftware(); @@ -2428,7 +2428,7 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated( curve->SetInitialValue(current_offset); scoped_ptr<Animation> animation = - Animation::Create(curve.PassAs<AnimationCurve>(), + Animation::Create(curve.Pass(), AnimationIdProvider::NextAnimationId(), AnimationIdProvider::NextGroupId(), Animation::ScrollOffset); @@ -2992,7 +2992,7 @@ void LayerTreeHostImpl::AnimatePageScale(base::TimeTicks monotonic_time) { SetNeedsRedraw(); if (page_scale_animation_->IsAnimationCompleteAtTime(monotonic_time)) { - page_scale_animation_.reset(); + page_scale_animation_ = nullptr; client_->SetNeedsCommitOnImplThread(); client_->RenewTreePriority(); } else { diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index 85e6a91..2607431 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc @@ -379,7 +379,7 @@ class LayerTreeHostImplTest : public testing::Test, protected: virtual scoped_ptr<OutputSurface> CreateOutputSurface() { - return FakeOutputSurface::Create3d().PassAs<OutputSurface>(); + return FakeOutputSurface::Create3d(); } void DrawOneFrame() { @@ -415,9 +415,8 @@ TEST_F(LayerTreeHostImplTest, NotifyIfCanDrawChanged) { } TEST_F(LayerTreeHostImplTest, CanDrawIncompleteFrames) { - scoped_ptr<FakeOutputSurface> output_surface( - FakeOutputSurface::CreateAlwaysDrawAndSwap3d()); - CreateHostImpl(DefaultSettings(), output_surface.PassAs<OutputSurface>()); + CreateHostImpl(DefaultSettings(), + FakeOutputSurface::CreateAlwaysDrawAndSwap3d()); bool always_draw = true; CheckNotifyCalledIfCanDrawChanged(always_draw); @@ -527,12 +526,9 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutRenderer) { TestWebGraphicsContext3D::Create(); context_owned->set_context_lost(true); - scoped_ptr<FakeOutputSurface> output_surface(FakeOutputSurface::Create3d( - context_owned.Pass())); - // Initialization will fail. - EXPECT_FALSE(CreateHostImpl(DefaultSettings(), - output_surface.PassAs<OutputSurface>())); + EXPECT_FALSE(CreateHostImpl( + DefaultSettings(), FakeOutputSurface::Create3d(context_owned.Pass()))); SetupScrollAndContentsLayers(gfx::Size(100, 100)); @@ -1329,7 +1325,7 @@ class LayerTreeHostImplOverridePhysicalTime : public LayerTreeHostImpl { scroll->AddChild(contents.Pass()); \ root->AddChild(scroll.Pass()); \ scrollbar->SetScrollLayerAndClipLayerByIds(2, 1); \ - root->AddChild(scrollbar.PassAs<LayerImpl>()); \ + root->AddChild(scrollbar.Pass()); \ \ host_impl_->active_tree()->SetRootLayer(root.Pass()); \ host_impl_->active_tree()->SetViewportLayersFromIds( \ @@ -1497,7 +1493,7 @@ void LayerTreeHostImplTest::SetupMouseMoveAtWithDeviceScale( scroll->AddChild(contents.Pass()); root->AddChild(scroll.Pass()); scrollbar->SetScrollLayerAndClipLayerByIds(2, 1); - root->AddChild(scrollbar.PassAs<LayerImpl>()); + root->AddChild(scrollbar.Pass()); host_impl_->active_tree()->SetRootLayer(root.Pass()); host_impl_->active_tree()->SetViewportLayersFromIds(1, 2, Layer::INVALID_ID); @@ -1611,7 +1607,7 @@ TEST_F(LayerTreeHostImplTest, CompositorFrameMetadata) { class DidDrawCheckLayer : public LayerImpl { public: static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) { - return scoped_ptr<LayerImpl>(new DidDrawCheckLayer(tree_impl, id)); + return make_scoped_ptr(new DidDrawCheckLayer(tree_impl, id)); } virtual bool WillDraw(DrawMode draw_mode, ResourceProvider* provider) @@ -1837,13 +1833,12 @@ class MissingTextureAnimatingLayer : public DidDrawCheckLayer { bool had_incomplete_tile, bool animating, ResourceProvider* resource_provider) { - return scoped_ptr<LayerImpl>( - new MissingTextureAnimatingLayer(tree_impl, - id, - tile_missing, - had_incomplete_tile, - animating, - resource_provider)); + return make_scoped_ptr(new MissingTextureAnimatingLayer(tree_impl, + id, + tile_missing, + had_incomplete_tile, + animating, + resource_provider)); } virtual void AppendQuads(RenderPass* render_pass, @@ -3640,9 +3635,8 @@ class BlendStateCheckLayer : public LayerImpl { static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id, ResourceProvider* resource_provider) { - return scoped_ptr<LayerImpl>(new BlendStateCheckLayer(tree_impl, - id, - resource_provider)); + return make_scoped_ptr( + new BlendStateCheckLayer(tree_impl, id, resource_provider)); } virtual void AppendQuads(RenderPass* render_pass, @@ -3954,10 +3948,9 @@ class LayerTreeHostImplViewportCoveredTest : public LayerTreeHostImplTest { scoped_ptr<OutputSurface> CreateFakeOutputSurface(bool always_draw) { if (always_draw) { - return FakeOutputSurface::CreateAlwaysDrawAndSwap3d() - .PassAs<OutputSurface>(); + return FakeOutputSurface::CreateAlwaysDrawAndSwap3d(); } - return FakeOutputSurface::Create3d().PassAs<OutputSurface>(); + return FakeOutputSurface::Create3d(); } void SetupActiveTreeLayers() { @@ -4237,7 +4230,7 @@ TEST_F(LayerTreeHostImplViewportCoveredTest, ActiveTreeShrinkViewportInvalid) { class FakeDrawableLayerImpl: public LayerImpl { public: static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) { - return scoped_ptr<LayerImpl>(new FakeDrawableLayerImpl(tree_impl, id)); + return make_scoped_ptr(new FakeDrawableLayerImpl(tree_impl, id)); } protected: FakeDrawableLayerImpl(LayerTreeImpl* tree_impl, int id) @@ -4407,7 +4400,7 @@ TEST_F(LayerTreeHostImplTest, RootLayerDoesntCreateExtraSurface) { class FakeLayerWithQuads : public LayerImpl { public: static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) { - return scoped_ptr<LayerImpl>(new FakeLayerWithQuads(tree_impl, id)); + return make_scoped_ptr(new FakeLayerWithQuads(tree_impl, id)); } virtual void AppendQuads(RenderPass* render_pass, @@ -4521,15 +4514,13 @@ class MockContextHarness { TEST_F(LayerTreeHostImplTest, NoPartialSwap) { scoped_ptr<MockContext> mock_context_owned(new MockContext); MockContext* mock_context = mock_context_owned.get(); - - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - mock_context_owned.PassAs<TestWebGraphicsContext3D>())); MockContextHarness harness(mock_context); // Run test case LayerTreeSettings settings = DefaultSettings(); settings.partial_swap_enabled = false; - CreateHostImpl(settings, output_surface.Pass()); + CreateHostImpl(settings, + FakeOutputSurface::Create3d(mock_context_owned.Pass())); SetupRootLayerImpl(FakeLayerWithQuads::Create(host_impl_->active_tree(), 1)); // Without partial swap, and no clipping, no scissor is set. @@ -4560,13 +4551,11 @@ TEST_F(LayerTreeHostImplTest, NoPartialSwap) { TEST_F(LayerTreeHostImplTest, PartialSwap) { scoped_ptr<MockContext> context_owned(new MockContext); MockContext* mock_context = context_owned.get(); - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - context_owned.PassAs<TestWebGraphicsContext3D>())); MockContextHarness harness(mock_context); LayerTreeSettings settings = DefaultSettings(); settings.partial_swap_enabled = true; - CreateHostImpl(settings, output_surface.Pass()); + CreateHostImpl(settings, FakeOutputSurface::Create3d(context_owned.Pass())); SetupRootLayerImpl(FakeLayerWithQuads::Create(host_impl_->active_tree(), 1)); // The first frame is not a partially-swapped one. @@ -4749,7 +4738,7 @@ TEST_F(LayerTreeHostImplTest, LayersFreeTextures) { video_layer->SetBounds(gfx::Size(10, 10)); video_layer->SetContentBounds(gfx::Size(10, 10)); video_layer->SetDrawsContent(true); - root_layer->AddChild(video_layer.PassAs<LayerImpl>()); + root_layer->AddChild(video_layer.Pass()); scoped_ptr<IOSurfaceLayerImpl> io_surface_layer = IOSurfaceLayerImpl::Create(host_impl_->active_tree(), 5); @@ -4757,7 +4746,7 @@ TEST_F(LayerTreeHostImplTest, LayersFreeTextures) { io_surface_layer->SetContentBounds(gfx::Size(10, 10)); io_surface_layer->SetDrawsContent(true); io_surface_layer->SetIOSurfaceProperties(1, gfx::Size(10, 10)); - root_layer->AddChild(io_surface_layer.PassAs<LayerImpl>()); + root_layer->AddChild(io_surface_layer.Pass()); host_impl_->active_tree()->SetRootLayer(root_layer.Pass()); @@ -4792,13 +4781,11 @@ TEST_F(LayerTreeHostImplTest, HasTransparentBackground) { new MockDrawQuadsToFillScreenContext); MockDrawQuadsToFillScreenContext* mock_context = mock_context_owned.get(); - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( - mock_context_owned.PassAs<TestWebGraphicsContext3D>())); - // Run test case LayerTreeSettings settings = DefaultSettings(); settings.partial_swap_enabled = false; - CreateHostImpl(settings, output_surface.Pass()); + CreateHostImpl(settings, + FakeOutputSurface::Create3d(mock_context_owned.Pass())); SetupRootLayerImpl(LayerImpl::Create(host_impl_->active_tree(), 1)); host_impl_->active_tree()->set_background_color(SK_ColorWHITE); @@ -4867,7 +4854,7 @@ class LayerTreeHostImplTestWithDelegatingRenderer : public LayerTreeHostImplTest { protected: virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE { - return FakeOutputSurface::CreateDelegating3d().PassAs<OutputSurface>(); + return FakeOutputSurface::CreateDelegating3d(); } void DrawFrameAndTestDamage(const gfx::RectF& expected_damage) { @@ -4922,9 +4909,9 @@ TEST_F(LayerTreeHostImplTestWithDelegatingRenderer, FrameIncludesDamageRect) { child->SetBounds(gfx::Size(1, 1)); child->SetContentBounds(gfx::Size(1, 1)); child->SetDrawsContent(true); - root->AddChild(child.PassAs<LayerImpl>()); + root->AddChild(child.Pass()); - host_impl_->active_tree()->SetRootLayer(root.PassAs<LayerImpl>()); + host_impl_->active_tree()->SetRootLayer(root.Pass()); // Draw a frame. In the first frame, the entire viewport should be damaged. gfx::Rect full_frame_damage(host_impl_->DrawViewportSize()); @@ -4994,7 +4981,7 @@ TEST_F(LayerTreeHostImplTest, MaskLayerWithScaling) { scoped_ptr<FakeMaskLayerImpl> scoped_mask_layer = FakeMaskLayerImpl::Create(host_impl_->active_tree(), 4); FakeMaskLayerImpl* mask_layer = scoped_mask_layer.get(); - content_layer->SetMaskLayer(scoped_mask_layer.PassAs<LayerImpl>()); + content_layer->SetMaskLayer(scoped_mask_layer.Pass()); gfx::Size root_size(100, 100); root->SetBounds(root_size); @@ -5123,7 +5110,7 @@ TEST_F(LayerTreeHostImplTest, MaskLayerWithDifferentBounds) { scoped_ptr<FakeMaskLayerImpl> scoped_mask_layer = FakeMaskLayerImpl::Create(host_impl_->active_tree(), 4); FakeMaskLayerImpl* mask_layer = scoped_mask_layer.get(); - content_layer->SetMaskLayer(scoped_mask_layer.PassAs<LayerImpl>()); + content_layer->SetMaskLayer(scoped_mask_layer.Pass()); gfx::Size root_size(100, 100); root->SetBounds(root_size); @@ -5274,7 +5261,7 @@ TEST_F(LayerTreeHostImplTest, ReflectionMaskLayerWithDifferentBounds) { scoped_ptr<FakeMaskLayerImpl> scoped_mask_layer = FakeMaskLayerImpl::Create(host_impl_->active_tree(), 4); FakeMaskLayerImpl* mask_layer = scoped_mask_layer.get(); - replica_layer->SetMaskLayer(scoped_mask_layer.PassAs<LayerImpl>()); + replica_layer->SetMaskLayer(scoped_mask_layer.Pass()); gfx::Size root_size(100, 100); root->SetBounds(root_size); @@ -5426,7 +5413,7 @@ TEST_F(LayerTreeHostImplTest, ReflectionMaskLayerForSurfaceWithUnclippedChild) { scoped_ptr<FakeMaskLayerImpl> scoped_mask_layer = FakeMaskLayerImpl::Create(host_impl_->active_tree(), 5); FakeMaskLayerImpl* mask_layer = scoped_mask_layer.get(); - replica_layer->SetMaskLayer(scoped_mask_layer.PassAs<LayerImpl>()); + replica_layer->SetMaskLayer(scoped_mask_layer.Pass()); gfx::Size root_size(100, 100); root->SetBounds(root_size); @@ -5546,7 +5533,7 @@ TEST_F(LayerTreeHostImplTest, MaskLayerForSurfaceWithClippedLayer) { scoped_ptr<FakeMaskLayerImpl> scoped_mask_layer = FakeMaskLayerImpl::Create(host_impl_->active_tree(), 6); FakeMaskLayerImpl* mask_layer = scoped_mask_layer.get(); - content_layer->SetMaskLayer(scoped_mask_layer.PassAs<LayerImpl>()); + content_layer->SetMaskLayer(scoped_mask_layer.Pass()); gfx::Size root_size(100, 100); root->SetBounds(root_size); @@ -5647,7 +5634,7 @@ TEST_F(LayerTreeHostImplTest, FarAwayQuadsDontNeedAA) { scoped_ptr<FakePictureLayerImpl> scoped_content_layer = FakePictureLayerImpl::CreateWithPile(host_impl_->pending_tree(), 3, pile); LayerImpl* content_layer = scoped_content_layer.get(); - scrolling_layer->AddChild(scoped_content_layer.PassAs<LayerImpl>()); + scrolling_layer->AddChild(scoped_content_layer.Pass()); content_layer->SetBounds(content_layer_bounds); content_layer->SetDrawsContent(true); @@ -5795,8 +5782,8 @@ TEST_F(LayerTreeHostImplTest, video_layer->SetBounds(gfx::Size(10, 10)); video_layer->SetContentBounds(gfx::Size(10, 10)); video_layer->SetDrawsContent(true); - root_layer->AddChild(video_layer.PassAs<LayerImpl>()); - SetupRootLayerImpl(root_layer.PassAs<LayerImpl>()); + root_layer->AddChild(video_layer.Pass()); + SetupRootLayerImpl(root_layer.Pass()); LayerTreeHostImpl::FrameData frame; EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); @@ -5821,12 +5808,11 @@ class LayerTreeHostImplTestDeferredInitialize : public LayerTreeHostImplTest { delegated_rendering)); output_surface_ = output_surface.get(); - EXPECT_TRUE(CreateHostImpl(DefaultSettings(), - output_surface.PassAs<OutputSurface>())); + EXPECT_TRUE(CreateHostImpl(DefaultSettings(), output_surface.Pass())); scoped_ptr<SolidColorLayerImpl> root_layer = SolidColorLayerImpl::Create(host_impl_->active_tree(), 1); - SetupRootLayerImpl(root_layer.PassAs<LayerImpl>()); + SetupRootLayerImpl(root_layer.Pass()); onscreen_context_provider_ = TestContextProvider::Create(); } @@ -6024,7 +6010,7 @@ TEST_F(LayerTreeHostImplTest, UIResourceManagement) { TestWebGraphicsContext3D::Create(); TestWebGraphicsContext3D* context3d = context.get(); scoped_ptr<FakeOutputSurface> output_surface = FakeOutputSurface::Create3d(); - CreateHostImpl(DefaultSettings(), output_surface.PassAs<OutputSurface>()); + CreateHostImpl(DefaultSettings(), output_surface.Pass()); EXPECT_EQ(0u, context3d->NumTextures()); @@ -6068,8 +6054,7 @@ TEST_F(LayerTreeHostImplTest, CreateETC1UIResource) { scoped_ptr<TestWebGraphicsContext3D> context = TestWebGraphicsContext3D::Create(); TestWebGraphicsContext3D* context3d = context.get(); - scoped_ptr<FakeOutputSurface> output_surface = FakeOutputSurface::Create3d(); - CreateHostImpl(DefaultSettings(), output_surface.PassAs<OutputSurface>()); + CreateHostImpl(DefaultSettings(), FakeOutputSurface::Create3d()); EXPECT_EQ(0u, context3d->NumTextures()); @@ -6098,9 +6083,8 @@ TEST_F(LayerTreeHostImplTest, ShutdownReleasesContext) { scoped_refptr<TestContextProvider> context_provider = TestContextProvider::Create(); - CreateHostImpl( - DefaultSettings(), - FakeOutputSurface::Create3d(context_provider).PassAs<OutputSurface>()); + CreateHostImpl(DefaultSettings(), + FakeOutputSurface::Create3d(context_provider)); SetupRootLayerImpl(LayerImpl::Create(host_impl_->active_tree(), 1)); @@ -6120,7 +6104,7 @@ TEST_F(LayerTreeHostImplTest, ShutdownReleasesContext) { EXPECT_FALSE(context_provider->HasOneRef()); EXPECT_EQ(1u, context_provider->TestContext3d()->NumTextures()); - host_impl_.reset(); + host_impl_ = nullptr; // The CopyOutputResult's callback was cancelled, the CopyOutputResult // released, and the texture deleted. @@ -6452,7 +6436,7 @@ TEST_F(LayerTreeHostImplTest, LatencyInfoPassedToCompositorFrameMetadata) { root->SetContentBounds(gfx::Size(10, 10)); root->SetDrawsContent(true); - host_impl_->active_tree()->SetRootLayer(root.PassAs<LayerImpl>()); + host_impl_->active_tree()->SetRootLayer(root.Pass()); FakeOutputSurface* fake_output_surface = static_cast<FakeOutputSurface*>(host_impl_->output_surface()); @@ -6492,7 +6476,7 @@ TEST_F(LayerTreeHostImplTest, SelectionBoundsPassedToCompositorFrameMetadata) { root->SetContentBounds(gfx::Size(10, 10)); root->SetDrawsContent(true); - host_impl_->active_tree()->SetRootLayer(root.PassAs<LayerImpl>()); + host_impl_->active_tree()->SetRootLayer(root.Pass()); // Ensure the default frame selection bounds are empty. FakeOutputSurface* fake_output_surface = @@ -7126,7 +7110,7 @@ TEST_F(LayerTreeHostImplTest, DidBecomeActive) { FakePictureLayerImpl::Create(pending_tree, 10); pending_layer->DoPostCommitInitializationIfNeeded(); FakePictureLayerImpl* raw_pending_layer = pending_layer.get(); - pending_tree->SetRootLayer(pending_layer.PassAs<LayerImpl>()); + pending_tree->SetRootLayer(pending_layer.Pass()); ASSERT_EQ(raw_pending_layer, pending_tree->root_layer()); EXPECT_EQ(0u, raw_pending_layer->did_become_active_call_count()); @@ -7137,7 +7121,7 @@ TEST_F(LayerTreeHostImplTest, DidBecomeActive) { FakePictureLayerImpl::Create(pending_tree, 11); mask_layer->DoPostCommitInitializationIfNeeded(); FakePictureLayerImpl* raw_mask_layer = mask_layer.get(); - raw_pending_layer->SetMaskLayer(mask_layer.PassAs<LayerImpl>()); + raw_pending_layer->SetMaskLayer(mask_layer.Pass()); ASSERT_EQ(raw_mask_layer, raw_pending_layer->mask_layer()); EXPECT_EQ(1u, raw_pending_layer->did_become_active_call_count()); @@ -7152,8 +7136,8 @@ TEST_F(LayerTreeHostImplTest, DidBecomeActive) { FakePictureLayerImpl::Create(pending_tree, 13); replica_mask_layer->DoPostCommitInitializationIfNeeded(); FakePictureLayerImpl* raw_replica_mask_layer = replica_mask_layer.get(); - replica_layer->SetMaskLayer(replica_mask_layer.PassAs<LayerImpl>()); - raw_pending_layer->SetReplicaLayer(replica_layer.PassAs<LayerImpl>()); + replica_layer->SetMaskLayer(replica_mask_layer.Pass()); + raw_pending_layer->SetReplicaLayer(replica_layer.Pass()); ASSERT_EQ(raw_replica_mask_layer, raw_pending_layer->replica_layer()->mask_layer()); diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc index 876d8ae..7f9eb3b 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc @@ -1664,8 +1664,7 @@ bool EvictionTestLayer::Update(ResourceUpdateQueue* queue, scoped_ptr<LayerImpl> EvictionTestLayer::CreateLayerImpl( LayerTreeImpl* tree_impl) { - return EvictionTestLayerImpl::Create(tree_impl, layer_id_) - .PassAs<LayerImpl>(); + return EvictionTestLayerImpl::Create(tree_impl, layer_id_); } void EvictionTestLayer::PushPropertiesTo(LayerImpl* layer_impl) { @@ -1903,7 +1902,7 @@ class LayerTreeHostWithProxy : public LayerTreeHost { : LayerTreeHost(client, NULL, settings) { proxy->SetLayerTreeHost(this); client->SetLayerTreeHost(this); - InitializeForTesting(proxy.PassAs<Proxy>()); + InitializeForTesting(proxy.Pass()); } }; @@ -2476,13 +2475,10 @@ class LayerTreeHostTestIOSurfaceDrawing : public LayerTreeHostTest { new MockIOSurfaceWebGraphicsContext3D); mock_context_ = mock_context_owned.get(); - if (delegating_renderer()) { - return FakeOutputSurface::CreateDelegating3d( - mock_context_owned.PassAs<TestWebGraphicsContext3D>()); - } else { - return FakeOutputSurface::Create3d( - mock_context_owned.PassAs<TestWebGraphicsContext3D>()); - } + if (delegating_renderer()) + return FakeOutputSurface::CreateDelegating3d(mock_context_owned.Pass()); + else + return FakeOutputSurface::Create3d(mock_context_owned.Pass()); } virtual void SetupTree() OVERRIDE { @@ -2868,7 +2864,7 @@ class LayerTreeHostTestUIResource : public LayerTreeHostTest { // Must clear all resources before exiting. void ClearResources() { for (int i = 0; i < num_ui_resources_; i++) - ui_resources_[i].reset(); + ui_resources_[i] = nullptr; } void CreateResource() { @@ -2901,8 +2897,7 @@ class PushPropertiesCountingLayerImpl : public LayerImpl { virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) OVERRIDE { - return PushPropertiesCountingLayerImpl::Create(tree_impl, id()). - PassAs<LayerImpl>(); + return PushPropertiesCountingLayerImpl::Create(tree_impl, id()); } size_t push_properties_count() const { return push_properties_count_; } @@ -2933,8 +2928,7 @@ class PushPropertiesCountingLayer : public Layer { virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) OVERRIDE { - return PushPropertiesCountingLayerImpl::Create(tree_impl, id()). - PassAs<LayerImpl>(); + return PushPropertiesCountingLayerImpl::Create(tree_impl, id()); } void SetDrawsContent(bool draws_content) { SetIsDrawable(draws_content); } @@ -4734,7 +4728,7 @@ class LayerTreeHostTestHighResRequiredAfterEvictingUIResources PostSetNeedsCommitToMainThread(); break; case 2: - ui_resource_.reset(); + ui_resource_ = nullptr; EndTest(); break; } diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc index 37e19ad..d7668c1 100644 --- a/cc/trees/layer_tree_host_unittest_animation.cc +++ b/cc/trees/layer_tree_host_unittest_animation.cc @@ -1044,8 +1044,8 @@ class LayerTreeHostAnimationTestScrollOffsetChangesArePropagated ScrollOffsetAnimationCurve::Create( gfx::Vector2dF(500.f, 550.f), EaseInOutTimingFunction::Create())); - scoped_ptr<Animation> animation(Animation::Create( - curve.PassAs<AnimationCurve>(), 1, 0, Animation::ScrollOffset)); + scoped_ptr<Animation> animation( + Animation::Create(curve.Pass(), 1, 0, Animation::ScrollOffset)); animation->set_needs_synchronized_start_time(true); bool animation_added = scroll_layer_->AddAnimation(animation.Pass()); bool impl_scrolling_supported = diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc index 75c2842..07e12a2 100644 --- a/cc/trees/layer_tree_host_unittest_context.cc +++ b/cc/trees/layer_tree_host_unittest_context.cc @@ -86,7 +86,7 @@ class LayerTreeHostContextTest : public LayerTreeTest { if (times_to_fail_create_) { --times_to_fail_create_; ExpectCreateToFail(); - return scoped_ptr<FakeOutputSurface>(); + return nullptr; } scoped_ptr<TestWebGraphicsContext3D> context3d = CreateContext3d(); @@ -363,7 +363,7 @@ class LayerTreeHostClientNotReadyDoesNotCreateOutputSurface virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) OVERRIDE { EXPECT_TRUE(false); - return scoped_ptr<OutputSurface>(); + return nullptr; } virtual void DidInitializeOutputSurface() OVERRIDE { EXPECT_TRUE(false); } @@ -878,8 +878,8 @@ class LayerTreeHostContextTestDontUseLostResources pass->AppendOneOfEveryQuadType(child_resource_provider_.get(), RenderPassId(2, 1)); - frame_data->render_pass_list.push_back(pass_for_quad.PassAs<RenderPass>()); - frame_data->render_pass_list.push_back(pass.PassAs<RenderPass>()); + frame_data->render_pass_list.push_back(pass_for_quad.Pass()); + frame_data->render_pass_list.push_back(pass.Pass()); delegated_resource_collection_ = new DelegatedFrameResourceCollection; delegated_frame_provider_ = new DelegatedFrameProvider( @@ -1256,7 +1256,7 @@ class UIResourceLostAfterCommit : public UIResourceLostTestSimple { break; case 4: // Release resource before ending the test. - ui_resource_.reset(); + ui_resource_ = nullptr; EndTest(); break; case 5: @@ -1316,7 +1316,7 @@ class UIResourceLostBeforeCommit : public UIResourceLostTestSimple { // Currently one resource has been created. test_id0_ = ui_resource_->id(); // Delete this resource. - ui_resource_.reset(); + ui_resource_ = nullptr; // Create another resource. ui_resource_ = FakeScopedUIResource::Create(layer_tree_host()); test_id1_ = ui_resource_->id(); @@ -1327,7 +1327,7 @@ class UIResourceLostBeforeCommit : public UIResourceLostTestSimple { break; case 3: // Clear the manager of resources. - ui_resource_.reset(); + ui_resource_ = nullptr; PostSetNeedsCommitToMainThread(); break; case 4: @@ -1337,7 +1337,7 @@ class UIResourceLostBeforeCommit : public UIResourceLostTestSimple { // Sanity check the UIResourceId should not be 0. EXPECT_NE(0, test_id0_); // Usually ScopedUIResource are deleted from the manager in their - // destructor (so usually ui_resource_.reset()). But here we need + // destructor (so usually ui_resource_ = nullptr). But here we need // ui_resource_ for the next step, so call DeleteUIResource directly. layer_tree_host()->DeleteUIResource(test_id0_); // Delete the resouce and then lose the context. @@ -1345,7 +1345,7 @@ class UIResourceLostBeforeCommit : public UIResourceLostTestSimple { break; case 5: // Release resource before ending the test. - ui_resource_.reset(); + ui_resource_ = nullptr; EndTest(); break; case 6: @@ -1409,12 +1409,12 @@ class UIResourceLostBeforeActivateTree : public UIResourceLostTest { break; case 3: test_id_ = ui_resource_->id(); - ui_resource_.reset(); + ui_resource_ = nullptr; PostSetNeedsCommitToMainThread(); break; case 5: // Release resource before ending the test. - ui_resource_.reset(); + ui_resource_ = nullptr; EndTest(); break; case 6: @@ -1505,7 +1505,7 @@ class UIResourceLostEviction : public UIResourceLostTestSimple { break; case 3: // Release resource before ending the test. - ui_resource_.reset(); + ui_resource_ = nullptr; EndTest(); break; case 4: diff --git a/cc/trees/layer_tree_host_unittest_copyrequest.cc b/cc/trees/layer_tree_host_unittest_copyrequest.cc index 89a267a..6af1756 100644 --- a/cc/trees/layer_tree_host_unittest_copyrequest.cc +++ b/cc/trees/layer_tree_host_unittest_copyrequest.cc @@ -592,7 +592,7 @@ class LayerTreeHostCopyRequestTestLostOutputSurface // Now destroy the CopyOutputResult, releasing the texture inside back // to the compositor. EXPECT_TRUE(result_); - result_.reset(); + result_ = nullptr; // Check that it is released. ImplThreadTaskRunner()->PostTask( diff --git a/cc/trees/layer_tree_host_unittest_no_message_loop.cc b/cc/trees/layer_tree_host_unittest_no_message_loop.cc index 862f34bb..9e38f1c 100644 --- a/cc/trees/layer_tree_host_unittest_no_message_loop.cc +++ b/cc/trees/layer_tree_host_unittest_no_message_loop.cc @@ -113,8 +113,8 @@ class LayerTreeHostNoMessageLoopTest void TearDownLayerTreeHost() { // Explicit teardown to make failures easier to debug. - layer_tree_host_.reset(); - root_layer_ = NULL; + layer_tree_host_ = nullptr; + root_layer_ = nullptr; } // All protected member variables are accessed only on |no_loop_thread_|. diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc index d2db83a..9f2786c 100644 --- a/cc/trees/layer_tree_host_unittest_scroll.cc +++ b/cc/trees/layer_tree_host_unittest_scroll.cc @@ -1121,7 +1121,7 @@ TEST(LayerTreeHostFlingTest, DidStopFlingingThread) { base::Unretained(&input_handler_client))); layer_tree_host->DidStopFlinging(); - layer_tree_host.reset(); + layer_tree_host = nullptr; impl_thread.Stop(); EXPECT_TRUE(received_stop_flinging); } diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc index 6e44bfc..ea9c1d01 100644 --- a/cc/trees/layer_tree_impl.cc +++ b/cc/trees/layer_tree_impl.cc @@ -108,7 +108,9 @@ LayerTreeImpl::~LayerTreeImpl() { DCHECK(layers_with_copy_output_request_.empty()); } -void LayerTreeImpl::Shutdown() { root_layer_.reset(); } +void LayerTreeImpl::Shutdown() { + root_layer_ = nullptr; +} void LayerTreeImpl::ReleaseResources() { if (root_layer_) @@ -120,8 +122,8 @@ void LayerTreeImpl::SetRootLayer(scoped_ptr<LayerImpl> layer) { inner_viewport_scroll_layer_->SetScrollOffsetDelegate(NULL); if (outer_viewport_scroll_layer_) outer_viewport_scroll_layer_->SetScrollOffsetDelegate(NULL); - inner_viewport_scroll_delegate_proxy_.reset(); - outer_viewport_scroll_delegate_proxy_.reset(); + inner_viewport_scroll_delegate_proxy_ = nullptr; + outer_viewport_scroll_delegate_proxy_ = nullptr; root_layer_ = layer.Pass(); currently_scrolling_layer_ = NULL; @@ -181,8 +183,8 @@ scoped_ptr<LayerImpl> LayerTreeImpl::DetachLayerTree() { inner_viewport_scroll_layer_->SetScrollOffsetDelegate(NULL); if (outer_viewport_scroll_layer_) outer_viewport_scroll_layer_->SetScrollOffsetDelegate(NULL); - inner_viewport_scroll_delegate_proxy_.reset(); - outer_viewport_scroll_delegate_proxy_.reset(); + inner_viewport_scroll_delegate_proxy_ = nullptr; + outer_viewport_scroll_delegate_proxy_ = nullptr; inner_viewport_scroll_layer_ = NULL; outer_viewport_scroll_layer_ = NULL; page_scale_layer_ = NULL; @@ -783,19 +785,17 @@ LayerTreeImpl::CreateScrollbarAnimationController(LayerImpl* scrolling_layer) { switch (settings().scrollbar_animator) { case LayerTreeSettings::LinearFade: { return ScrollbarAnimationControllerLinearFade::Create( - scrolling_layer, layer_tree_host_impl_, delay, duration) - .PassAs<ScrollbarAnimationController>(); + scrolling_layer, layer_tree_host_impl_, delay, duration); } case LayerTreeSettings::Thinning: { return ScrollbarAnimationControllerThinning::Create( - scrolling_layer, layer_tree_host_impl_, delay, duration) - .PassAs<ScrollbarAnimationController>(); + scrolling_layer, layer_tree_host_impl_, delay, duration); } case LayerTreeSettings::NoAnimator: NOTREACHED(); break; } - return scoped_ptr<ScrollbarAnimationController>(); + return nullptr; } void LayerTreeImpl::DidAnimateScrollOffset() { @@ -881,8 +881,8 @@ void LayerTreeImpl::SetRootLayerScrollOffsetDelegate( InnerViewportScrollLayer()->SetScrollOffsetDelegate(NULL); if (OuterViewportScrollLayer()) OuterViewportScrollLayer()->SetScrollOffsetDelegate(NULL); - inner_viewport_scroll_delegate_proxy_.reset(); - outer_viewport_scroll_delegate_proxy_.reset(); + inner_viewport_scroll_delegate_proxy_ = nullptr; + outer_viewport_scroll_delegate_proxy_ = nullptr; } root_layer_scroll_offset_delegate_ = root_layer_scroll_offset_delegate; diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc index a0dd11a..7fc1645 100644 --- a/cc/trees/layer_tree_impl_unittest.cc +++ b/cc/trees/layer_tree_impl_unittest.cc @@ -25,8 +25,7 @@ class LayerTreeImplTest : public LayerTreeHostCommonTest { settings.layer_transforms_should_scale_layer_contents = true; host_impl_.reset( new FakeLayerTreeHostImpl(settings, &proxy_, &shared_bitmap_manager_)); - EXPECT_TRUE(host_impl_->InitializeRenderer( - FakeOutputSurface::Create3d().PassAs<OutputSurface>())); + EXPECT_TRUE(host_impl_->InitializeRenderer(FakeOutputSurface::Create3d())); } FakeLayerTreeHostImpl& host_impl() { return *host_impl_; } @@ -124,7 +123,7 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleLayerAndHud) { hud->SetDrawsContent(true); host_impl().active_tree()->set_hud_layer(hud.get()); - root->AddChild(hud.PassAs<LayerImpl>()); + root->AddChild(hud.Pass()); host_impl().SetViewportSize(hud_bounds); host_impl().active_tree()->SetRootLayer(root.Pass()); diff --git a/cc/trees/occlusion_tracker_perftest.cc b/cc/trees/occlusion_tracker_perftest.cc index 14a9ffd..37cd8a6 100644 --- a/cc/trees/occlusion_tracker_perftest.cc +++ b/cc/trees/occlusion_tracker_perftest.cc @@ -38,8 +38,7 @@ class OcclusionTrackerPerfTest : public testing::Test { shared_bitmap_manager_.reset(new TestSharedBitmapManager()); host_impl_ = LayerTreeHostImpl::Create( settings, &client_, &proxy_, &stats_, shared_bitmap_manager_.get(), 1); - host_impl_->InitializeRenderer( - FakeOutputSurface::Create3d().PassAs<OutputSurface>()); + host_impl_->InitializeRenderer(FakeOutputSurface::Create3d()); scoped_ptr<LayerImpl> root_layer = LayerImpl::Create(active_tree(), 1); active_tree()->SetRootLayer(root_layer.Pass()); @@ -86,7 +85,7 @@ TEST_F(OcclusionTrackerPerfTest, UnoccludedContentRect_FullyOccluded) { opaque_layer->SetDrawsContent(true); opaque_layer->SetBounds(viewport_rect.size()); opaque_layer->SetContentBounds(viewport_rect.size()); - active_tree()->root_layer()->AddChild(opaque_layer.PassAs<LayerImpl>()); + active_tree()->root_layer()->AddChild(opaque_layer.Pass()); active_tree()->UpdateDrawProperties(); const LayerImplList& rsll = active_tree()->RenderSurfaceLayerList(); @@ -156,7 +155,7 @@ TEST_F(OcclusionTrackerPerfTest, UnoccludedContentRect_10OpaqueLayers) { opaque_layer->SetContentBounds( gfx::Size(viewport_rect.width() / 2, viewport_rect.height() / 2)); opaque_layer->SetPosition(gfx::Point(i, i)); - active_tree()->root_layer()->AddChild(opaque_layer.PassAs<LayerImpl>()); + active_tree()->root_layer()->AddChild(opaque_layer.Pass()); } active_tree()->UpdateDrawProperties(); diff --git a/cc/trees/occlusion_tracker_unittest.cc b/cc/trees/occlusion_tracker_unittest.cc index b35e437..3c6c440 100644 --- a/cc/trees/occlusion_tracker_unittest.cc +++ b/cc/trees/occlusion_tracker_unittest.cc @@ -121,13 +121,8 @@ struct OcclusionTrackerTestMainThreadTypes { return make_scoped_refptr(new ContentLayerType()); } - static LayerPtrType PassLayerPtr(ContentLayerPtrType* layer) { - LayerPtrType ref(*layer); - *layer = NULL; - return ref; - } - - static LayerPtrType PassLayerPtr(LayerPtrType* layer) { + template <typename T> + static LayerPtrType PassLayerPtr(T* layer) { LayerPtrType ref(*layer); *layer = NULL; return ref; @@ -156,14 +151,11 @@ struct OcclusionTrackerTestImplThreadTypes { } static int next_layer_impl_id; - static LayerPtrType PassLayerPtr(LayerPtrType* layer) { + template <typename T> + static LayerPtrType PassLayerPtr(T* layer) { return layer->Pass(); } - static LayerPtrType PassLayerPtr(ContentLayerPtrType* layer) { - return layer->PassAs<LayerType>(); - } - static void DestroyLayer(LayerPtrType* layer) { layer->reset(); } static void RecursiveUpdateNumChildren(LayerType* layer) { @@ -286,7 +278,7 @@ template <typename Types> class OcclusionTrackerTest : public testing::Test { void DestroyLayers() { Types::DestroyLayer(&root_); - render_surface_layer_list_.reset(); + render_surface_layer_list_ = nullptr; render_surface_layer_list_impl_.clear(); replica_layers_.clear(); mask_layers_.clear(); diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc index 97b06bc..b3712b6 100644 --- a/cc/trees/single_thread_proxy.cc +++ b/cc/trees/single_thread_proxy.cc @@ -26,8 +26,7 @@ scoped_ptr<Proxy> SingleThreadProxy::Create( LayerTreeHostSingleThreadClient* client, scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) { return make_scoped_ptr( - new SingleThreadProxy(layer_tree_host, client, main_task_runner)) - .PassAs<Proxy>(); + new SingleThreadProxy(layer_tree_host, client, main_task_runner)); } SingleThreadProxy::SingleThreadProxy( @@ -314,8 +313,8 @@ void SingleThreadProxy::Stop() { blocking_main_thread_task_runner()); layer_tree_host_->DeleteContentsTexturesOnImplThread( layer_tree_host_impl_->resource_provider()); - scheduler_on_impl_thread_.reset(); - layer_tree_host_impl_.reset(); + scheduler_on_impl_thread_ = nullptr; + layer_tree_host_impl_ = nullptr; } layer_tree_host_ = NULL; } diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc index dddf112..151cb3c 100644 --- a/cc/trees/thread_proxy.cc +++ b/cc/trees/thread_proxy.cc @@ -49,9 +49,8 @@ scoped_ptr<Proxy> ThreadProxy::Create( LayerTreeHost* layer_tree_host, scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { - return make_scoped_ptr(new ThreadProxy(layer_tree_host, - main_task_runner, - impl_task_runner)).PassAs<Proxy>(); + return make_scoped_ptr( + new ThreadProxy(layer_tree_host, main_task_runner, impl_task_runner)); } ThreadProxy::ThreadProxy( @@ -963,7 +962,7 @@ void ThreadProxy::ScheduledActionCommit() { // Complete all remaining texture updates. impl().current_resource_update_controller->Finalize(); - impl().current_resource_update_controller.reset(); + impl().current_resource_update_controller = nullptr; if (impl().animations_frozen_until_next_draw) { impl().animation_time = std::max( @@ -1249,10 +1248,10 @@ void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { DCHECK(IsMainThreadBlocked()); layer_tree_host()->DeleteContentsTexturesOnImplThread( impl().layer_tree_host_impl->resource_provider()); - impl().current_resource_update_controller.reset(); + impl().current_resource_update_controller = nullptr; impl().layer_tree_host_impl->SetNeedsBeginFrame(false); - impl().scheduler.reset(); - impl().layer_tree_host_impl.reset(); + impl().scheduler = nullptr; + impl().layer_tree_host_impl = nullptr; impl().weak_factory.InvalidateWeakPtrs(); // We need to explicitly cancel the notifier, since it isn't using weak ptrs. // TODO(vmpstr): We should see if we can make it use weak ptrs and still keep diff --git a/cc/trees/tree_synchronizer.cc b/cc/trees/tree_synchronizer.cc index 1faf0e0..d17f017 100644 --- a/cc/trees/tree_synchronizer.cc +++ b/cc/trees/tree_synchronizer.cc @@ -105,7 +105,7 @@ scoped_ptr<LayerImpl> SynchronizeTreesRecursiveInternal( LayerType* layer, LayerTreeImpl* tree_impl) { if (!layer) - return scoped_ptr<LayerImpl>(); + return nullptr; scoped_ptr<LayerImpl> layer_impl = ReuseOrCreateLayerImpl(new_layers, old_layers, layer, tree_impl); diff --git a/cc/trees/tree_synchronizer_unittest.cc b/cc/trees/tree_synchronizer_unittest.cc index b0e2114..007c857 100644 --- a/cc/trees/tree_synchronizer_unittest.cc +++ b/cc/trees/tree_synchronizer_unittest.cc @@ -56,7 +56,7 @@ class MockLayer : public Layer { virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) OVERRIDE { - return MockLayerImpl::Create(tree_impl, layer_id_).PassAs<LayerImpl>(); + return MockLayerImpl::Create(tree_impl, layer_id_); } virtual void PushPropertiesTo(LayerImpl* layer_impl) OVERRIDE { |