summaryrefslogtreecommitdiffstats
path: root/cc/trees
diff options
context:
space:
mode:
authordcheng <dcheng@chromium.org>2014-09-27 00:33:06 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-27 07:33:30 +0000
commit78d5331bcd375f8c8f0285d648dc30cc4f206367 (patch)
treeafc3c9100269d4dab67803ed9650f4a4d6baba23 /cc/trees
parent67f01ddf1bc44927cbe10bcc000bf8eec462c1fc (diff)
downloadchromium_src-78d5331bcd375f8c8f0285d648dc30cc4f206367.zip
chromium_src-78d5331bcd375f8c8f0285d648dc30cc4f206367.tar.gz
chromium_src-78d5331bcd375f8c8f0285d648dc30cc4f206367.tar.bz2
Revert of cc: Remove use of PassAs() and constructor-casting with scoped_ptr. (patchset #6 id:120001 of https://codereview.chromium.org/609663003/)
Reason for revert: scoped_ptr nullptr support needs to be reverted Original issue's description: > 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} TBR=enne@chromium.org,jamesr@chromium.org,vmpstr@chromium.org,danakj@chromium.org NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/608503005 Cr-Commit-Position: refs/heads/master@{#297106}
Diffstat (limited to 'cc/trees')
-rw-r--r--cc/trees/layer_tree_host.cc4
-rw-r--r--cc/trees/layer_tree_host_common_unittest.cc6
-rw-r--r--cc/trees/layer_tree_host_impl.cc38
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc118
-rw-r--r--cc/trees/layer_tree_host_unittest.cc26
-rw-r--r--cc/trees/layer_tree_host_unittest_animation.cc4
-rw-r--r--cc/trees/layer_tree_host_unittest_context.cc24
-rw-r--r--cc/trees/layer_tree_host_unittest_copyrequest.cc2
-rw-r--r--cc/trees/layer_tree_host_unittest_no_message_loop.cc4
-rw-r--r--cc/trees/layer_tree_host_unittest_scroll.cc2
-rw-r--r--cc/trees/layer_tree_impl.cc24
-rw-r--r--cc/trees/layer_tree_impl_unittest.cc5
-rw-r--r--cc/trees/occlusion_tracker_perftest.cc7
-rw-r--r--cc/trees/occlusion_tracker_unittest.cc18
-rw-r--r--cc/trees/single_thread_proxy.cc7
-rw-r--r--cc/trees/thread_proxy.cc13
-rw-r--r--cc/trees/tree_synchronizer.cc2
-rw-r--r--cc/trees/tree_synchronizer_unittest.cc2
18 files changed, 170 insertions, 136 deletions
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index 6b86eb6..78373c7 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_ = nullptr;
+ overhang_ui_resource_.reset();
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_ = nullptr;
+ pending_page_scale_animation_.reset();
}
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 82e34fa..1efc110 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.Pass());
- parent->AddChild(child.Pass());
- grand_parent->AddChild(parent.Pass());
+ child->AddChild(grand_child.PassAs<LayerImpl>());
+ parent->AddChild(child.PassAs<LayerImpl>());
+ grand_parent->AddChild(parent.PassAs<LayerImpl>());
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 5771bbb..29e29c3 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_ = nullptr;
- pending_tree_ = nullptr;
- active_tree_ = nullptr;
+ recycle_tree_.reset();
+ pending_tree_.reset();
+ active_tree_.reset();
DestroyTileManager();
}
@@ -446,7 +446,7 @@ void LayerTreeHostImpl::StartPageScaleAnimation(
// Easing constants experimentally determined.
scoped_ptr<TimingFunction> timing_function =
- CubicBezierTimingFunction::Create(.8, 0, .3, .9);
+ CubicBezierTimingFunction::Create(.8, 0, .3, .9).PassAs<TimingFunction>();
page_scale_animation_ =
PageScaleAnimation::Create(scroll_total,
@@ -506,7 +506,7 @@ bool LayerTreeHostImpl::HaveTouchEventHandlersAt(
scoped_ptr<SwapPromiseMonitor>
LayerTreeHostImpl::CreateLatencyInfoSwapPromiseMonitor(
ui::LatencyInfo* latency) {
- return make_scoped_ptr(
+ return scoped_ptr<SwapPromiseMonitor>(
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_ = nullptr;
+ pending_tree_.reset();
if (recycle_tree_)
recycle_tree_->DetachLayerTree();
- recycle_tree_ = nullptr;
+ recycle_tree_.reset();
}
void LayerTreeHostImpl::ResetRecycleTreeForTesting() {
if (recycle_tree_)
recycle_tree_->DetachLayerTree();
- recycle_tree_ = nullptr;
+ recycle_tree_.reset();
}
void LayerTreeHostImpl::EnforceManagedMemoryPolicy(
@@ -2041,10 +2041,10 @@ void LayerTreeHostImpl::CreateAndSetTileManager() {
}
void LayerTreeHostImpl::DestroyTileManager() {
- tile_manager_ = nullptr;
- resource_pool_ = nullptr;
- staging_resource_pool_ = nullptr;
- raster_worker_pool_ = nullptr;
+ tile_manager_.reset();
+ resource_pool_.reset();
+ staging_resource_pool_.reset();
+ raster_worker_pool_.reset();
}
bool LayerTreeHostImpl::UsePendingTreeForSync() const {
@@ -2077,10 +2077,10 @@ bool LayerTreeHostImpl::InitializeRenderer(
ReleaseTreeResources();
// Note: order is important here.
- renderer_ = nullptr;
+ renderer_.reset();
DestroyTileManager();
- resource_provider_ = nullptr;
- output_surface_ = nullptr;
+ resource_provider_.reset();
+ output_surface_.reset();
if (!output_surface->BindToClient(this))
return false;
@@ -2142,7 +2142,7 @@ void LayerTreeHostImpl::DeferredInitialize() {
DCHECK(output_surface_->context_provider());
ReleaseTreeResources();
- renderer_ = nullptr;
+ renderer_.reset();
DestroyTileManager();
resource_provider_->InitializeGL();
@@ -2160,7 +2160,7 @@ void LayerTreeHostImpl::ReleaseGL() {
DCHECK(output_surface_->context_provider());
ReleaseTreeResources();
- renderer_ = nullptr;
+ renderer_.reset();
DestroyTileManager();
resource_provider_->InitializeSoftware();
@@ -2428,7 +2428,7 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
curve->SetInitialValue(current_offset);
scoped_ptr<Animation> animation =
- Animation::Create(curve.Pass(),
+ Animation::Create(curve.PassAs<AnimationCurve>(),
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_ = nullptr;
+ page_scale_animation_.reset();
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 2607431..85e6a91 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();
+ return FakeOutputSurface::Create3d().PassAs<OutputSurface>();
}
void DrawOneFrame() {
@@ -415,8 +415,9 @@ TEST_F(LayerTreeHostImplTest, NotifyIfCanDrawChanged) {
}
TEST_F(LayerTreeHostImplTest, CanDrawIncompleteFrames) {
- CreateHostImpl(DefaultSettings(),
- FakeOutputSurface::CreateAlwaysDrawAndSwap3d());
+ scoped_ptr<FakeOutputSurface> output_surface(
+ FakeOutputSurface::CreateAlwaysDrawAndSwap3d());
+ CreateHostImpl(DefaultSettings(), output_surface.PassAs<OutputSurface>());
bool always_draw = true;
CheckNotifyCalledIfCanDrawChanged(always_draw);
@@ -526,9 +527,12 @@ 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(), FakeOutputSurface::Create3d(context_owned.Pass())));
+ EXPECT_FALSE(CreateHostImpl(DefaultSettings(),
+ output_surface.PassAs<OutputSurface>()));
SetupScrollAndContentsLayers(gfx::Size(100, 100));
@@ -1325,7 +1329,7 @@ class LayerTreeHostImplOverridePhysicalTime : public LayerTreeHostImpl {
scroll->AddChild(contents.Pass()); \
root->AddChild(scroll.Pass()); \
scrollbar->SetScrollLayerAndClipLayerByIds(2, 1); \
- root->AddChild(scrollbar.Pass()); \
+ root->AddChild(scrollbar.PassAs<LayerImpl>()); \
\
host_impl_->active_tree()->SetRootLayer(root.Pass()); \
host_impl_->active_tree()->SetViewportLayersFromIds( \
@@ -1493,7 +1497,7 @@ void LayerTreeHostImplTest::SetupMouseMoveAtWithDeviceScale(
scroll->AddChild(contents.Pass());
root->AddChild(scroll.Pass());
scrollbar->SetScrollLayerAndClipLayerByIds(2, 1);
- root->AddChild(scrollbar.Pass());
+ root->AddChild(scrollbar.PassAs<LayerImpl>());
host_impl_->active_tree()->SetRootLayer(root.Pass());
host_impl_->active_tree()->SetViewportLayersFromIds(1, 2, Layer::INVALID_ID);
@@ -1607,7 +1611,7 @@ TEST_F(LayerTreeHostImplTest, CompositorFrameMetadata) {
class DidDrawCheckLayer : public LayerImpl {
public:
static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) {
- return make_scoped_ptr(new DidDrawCheckLayer(tree_impl, id));
+ return scoped_ptr<LayerImpl>(new DidDrawCheckLayer(tree_impl, id));
}
virtual bool WillDraw(DrawMode draw_mode, ResourceProvider* provider)
@@ -1833,12 +1837,13 @@ class MissingTextureAnimatingLayer : public DidDrawCheckLayer {
bool had_incomplete_tile,
bool animating,
ResourceProvider* resource_provider) {
- return make_scoped_ptr(new MissingTextureAnimatingLayer(tree_impl,
- id,
- tile_missing,
- had_incomplete_tile,
- animating,
- resource_provider));
+ return scoped_ptr<LayerImpl>(
+ new MissingTextureAnimatingLayer(tree_impl,
+ id,
+ tile_missing,
+ had_incomplete_tile,
+ animating,
+ resource_provider));
}
virtual void AppendQuads(RenderPass* render_pass,
@@ -3635,8 +3640,9 @@ class BlendStateCheckLayer : public LayerImpl {
static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl,
int id,
ResourceProvider* resource_provider) {
- return make_scoped_ptr(
- new BlendStateCheckLayer(tree_impl, id, resource_provider));
+ return scoped_ptr<LayerImpl>(new BlendStateCheckLayer(tree_impl,
+ id,
+ resource_provider));
}
virtual void AppendQuads(RenderPass* render_pass,
@@ -3948,9 +3954,10 @@ class LayerTreeHostImplViewportCoveredTest : public LayerTreeHostImplTest {
scoped_ptr<OutputSurface> CreateFakeOutputSurface(bool always_draw) {
if (always_draw) {
- return FakeOutputSurface::CreateAlwaysDrawAndSwap3d();
+ return FakeOutputSurface::CreateAlwaysDrawAndSwap3d()
+ .PassAs<OutputSurface>();
}
- return FakeOutputSurface::Create3d();
+ return FakeOutputSurface::Create3d().PassAs<OutputSurface>();
}
void SetupActiveTreeLayers() {
@@ -4230,7 +4237,7 @@ TEST_F(LayerTreeHostImplViewportCoveredTest, ActiveTreeShrinkViewportInvalid) {
class FakeDrawableLayerImpl: public LayerImpl {
public:
static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) {
- return make_scoped_ptr(new FakeDrawableLayerImpl(tree_impl, id));
+ return scoped_ptr<LayerImpl>(new FakeDrawableLayerImpl(tree_impl, id));
}
protected:
FakeDrawableLayerImpl(LayerTreeImpl* tree_impl, int id)
@@ -4400,7 +4407,7 @@ TEST_F(LayerTreeHostImplTest, RootLayerDoesntCreateExtraSurface) {
class FakeLayerWithQuads : public LayerImpl {
public:
static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) {
- return make_scoped_ptr(new FakeLayerWithQuads(tree_impl, id));
+ return scoped_ptr<LayerImpl>(new FakeLayerWithQuads(tree_impl, id));
}
virtual void AppendQuads(RenderPass* render_pass,
@@ -4514,13 +4521,15 @@ 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,
- FakeOutputSurface::Create3d(mock_context_owned.Pass()));
+ CreateHostImpl(settings, output_surface.Pass());
SetupRootLayerImpl(FakeLayerWithQuads::Create(host_impl_->active_tree(), 1));
// Without partial swap, and no clipping, no scissor is set.
@@ -4551,11 +4560,13 @@ 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, FakeOutputSurface::Create3d(context_owned.Pass()));
+ CreateHostImpl(settings, output_surface.Pass());
SetupRootLayerImpl(FakeLayerWithQuads::Create(host_impl_->active_tree(), 1));
// The first frame is not a partially-swapped one.
@@ -4738,7 +4749,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.Pass());
+ root_layer->AddChild(video_layer.PassAs<LayerImpl>());
scoped_ptr<IOSurfaceLayerImpl> io_surface_layer =
IOSurfaceLayerImpl::Create(host_impl_->active_tree(), 5);
@@ -4746,7 +4757,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.Pass());
+ root_layer->AddChild(io_surface_layer.PassAs<LayerImpl>());
host_impl_->active_tree()->SetRootLayer(root_layer.Pass());
@@ -4781,11 +4792,13 @@ 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,
- FakeOutputSurface::Create3d(mock_context_owned.Pass()));
+ CreateHostImpl(settings, output_surface.Pass());
SetupRootLayerImpl(LayerImpl::Create(host_impl_->active_tree(), 1));
host_impl_->active_tree()->set_background_color(SK_ColorWHITE);
@@ -4854,7 +4867,7 @@ class LayerTreeHostImplTestWithDelegatingRenderer
: public LayerTreeHostImplTest {
protected:
virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE {
- return FakeOutputSurface::CreateDelegating3d();
+ return FakeOutputSurface::CreateDelegating3d().PassAs<OutputSurface>();
}
void DrawFrameAndTestDamage(const gfx::RectF& expected_damage) {
@@ -4909,9 +4922,9 @@ TEST_F(LayerTreeHostImplTestWithDelegatingRenderer, FrameIncludesDamageRect) {
child->SetBounds(gfx::Size(1, 1));
child->SetContentBounds(gfx::Size(1, 1));
child->SetDrawsContent(true);
- root->AddChild(child.Pass());
+ root->AddChild(child.PassAs<LayerImpl>());
- host_impl_->active_tree()->SetRootLayer(root.Pass());
+ host_impl_->active_tree()->SetRootLayer(root.PassAs<LayerImpl>());
// Draw a frame. In the first frame, the entire viewport should be damaged.
gfx::Rect full_frame_damage(host_impl_->DrawViewportSize());
@@ -4981,7 +4994,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.Pass());
+ content_layer->SetMaskLayer(scoped_mask_layer.PassAs<LayerImpl>());
gfx::Size root_size(100, 100);
root->SetBounds(root_size);
@@ -5110,7 +5123,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.Pass());
+ content_layer->SetMaskLayer(scoped_mask_layer.PassAs<LayerImpl>());
gfx::Size root_size(100, 100);
root->SetBounds(root_size);
@@ -5261,7 +5274,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.Pass());
+ replica_layer->SetMaskLayer(scoped_mask_layer.PassAs<LayerImpl>());
gfx::Size root_size(100, 100);
root->SetBounds(root_size);
@@ -5413,7 +5426,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.Pass());
+ replica_layer->SetMaskLayer(scoped_mask_layer.PassAs<LayerImpl>());
gfx::Size root_size(100, 100);
root->SetBounds(root_size);
@@ -5533,7 +5546,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.Pass());
+ content_layer->SetMaskLayer(scoped_mask_layer.PassAs<LayerImpl>());
gfx::Size root_size(100, 100);
root->SetBounds(root_size);
@@ -5634,7 +5647,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.Pass());
+ scrolling_layer->AddChild(scoped_content_layer.PassAs<LayerImpl>());
content_layer->SetBounds(content_layer_bounds);
content_layer->SetDrawsContent(true);
@@ -5782,8 +5795,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.Pass());
- SetupRootLayerImpl(root_layer.Pass());
+ root_layer->AddChild(video_layer.PassAs<LayerImpl>());
+ SetupRootLayerImpl(root_layer.PassAs<LayerImpl>());
LayerTreeHostImpl::FrameData frame;
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
@@ -5808,11 +5821,12 @@ class LayerTreeHostImplTestDeferredInitialize : public LayerTreeHostImplTest {
delegated_rendering));
output_surface_ = output_surface.get();
- EXPECT_TRUE(CreateHostImpl(DefaultSettings(), output_surface.Pass()));
+ EXPECT_TRUE(CreateHostImpl(DefaultSettings(),
+ output_surface.PassAs<OutputSurface>()));
scoped_ptr<SolidColorLayerImpl> root_layer =
SolidColorLayerImpl::Create(host_impl_->active_tree(), 1);
- SetupRootLayerImpl(root_layer.Pass());
+ SetupRootLayerImpl(root_layer.PassAs<LayerImpl>());
onscreen_context_provider_ = TestContextProvider::Create();
}
@@ -6010,7 +6024,7 @@ TEST_F(LayerTreeHostImplTest, UIResourceManagement) {
TestWebGraphicsContext3D::Create();
TestWebGraphicsContext3D* context3d = context.get();
scoped_ptr<FakeOutputSurface> output_surface = FakeOutputSurface::Create3d();
- CreateHostImpl(DefaultSettings(), output_surface.Pass());
+ CreateHostImpl(DefaultSettings(), output_surface.PassAs<OutputSurface>());
EXPECT_EQ(0u, context3d->NumTextures());
@@ -6054,7 +6068,8 @@ TEST_F(LayerTreeHostImplTest, CreateETC1UIResource) {
scoped_ptr<TestWebGraphicsContext3D> context =
TestWebGraphicsContext3D::Create();
TestWebGraphicsContext3D* context3d = context.get();
- CreateHostImpl(DefaultSettings(), FakeOutputSurface::Create3d());
+ scoped_ptr<FakeOutputSurface> output_surface = FakeOutputSurface::Create3d();
+ CreateHostImpl(DefaultSettings(), output_surface.PassAs<OutputSurface>());
EXPECT_EQ(0u, context3d->NumTextures());
@@ -6083,8 +6098,9 @@ TEST_F(LayerTreeHostImplTest, ShutdownReleasesContext) {
scoped_refptr<TestContextProvider> context_provider =
TestContextProvider::Create();
- CreateHostImpl(DefaultSettings(),
- FakeOutputSurface::Create3d(context_provider));
+ CreateHostImpl(
+ DefaultSettings(),
+ FakeOutputSurface::Create3d(context_provider).PassAs<OutputSurface>());
SetupRootLayerImpl(LayerImpl::Create(host_impl_->active_tree(), 1));
@@ -6104,7 +6120,7 @@ TEST_F(LayerTreeHostImplTest, ShutdownReleasesContext) {
EXPECT_FALSE(context_provider->HasOneRef());
EXPECT_EQ(1u, context_provider->TestContext3d()->NumTextures());
- host_impl_ = nullptr;
+ host_impl_.reset();
// The CopyOutputResult's callback was cancelled, the CopyOutputResult
// released, and the texture deleted.
@@ -6436,7 +6452,7 @@ TEST_F(LayerTreeHostImplTest, LatencyInfoPassedToCompositorFrameMetadata) {
root->SetContentBounds(gfx::Size(10, 10));
root->SetDrawsContent(true);
- host_impl_->active_tree()->SetRootLayer(root.Pass());
+ host_impl_->active_tree()->SetRootLayer(root.PassAs<LayerImpl>());
FakeOutputSurface* fake_output_surface =
static_cast<FakeOutputSurface*>(host_impl_->output_surface());
@@ -6476,7 +6492,7 @@ TEST_F(LayerTreeHostImplTest, SelectionBoundsPassedToCompositorFrameMetadata) {
root->SetContentBounds(gfx::Size(10, 10));
root->SetDrawsContent(true);
- host_impl_->active_tree()->SetRootLayer(root.Pass());
+ host_impl_->active_tree()->SetRootLayer(root.PassAs<LayerImpl>());
// Ensure the default frame selection bounds are empty.
FakeOutputSurface* fake_output_surface =
@@ -7110,7 +7126,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.Pass());
+ pending_tree->SetRootLayer(pending_layer.PassAs<LayerImpl>());
ASSERT_EQ(raw_pending_layer, pending_tree->root_layer());
EXPECT_EQ(0u, raw_pending_layer->did_become_active_call_count());
@@ -7121,7 +7137,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.Pass());
+ raw_pending_layer->SetMaskLayer(mask_layer.PassAs<LayerImpl>());
ASSERT_EQ(raw_mask_layer, raw_pending_layer->mask_layer());
EXPECT_EQ(1u, raw_pending_layer->did_become_active_call_count());
@@ -7136,8 +7152,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.Pass());
- raw_pending_layer->SetReplicaLayer(replica_layer.Pass());
+ replica_layer->SetMaskLayer(replica_mask_layer.PassAs<LayerImpl>());
+ raw_pending_layer->SetReplicaLayer(replica_layer.PassAs<LayerImpl>());
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 7f9eb3b..876d8ae 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -1664,7 +1664,8 @@ bool EvictionTestLayer::Update(ResourceUpdateQueue* queue,
scoped_ptr<LayerImpl> EvictionTestLayer::CreateLayerImpl(
LayerTreeImpl* tree_impl) {
- return EvictionTestLayerImpl::Create(tree_impl, layer_id_);
+ return EvictionTestLayerImpl::Create(tree_impl, layer_id_)
+ .PassAs<LayerImpl>();
}
void EvictionTestLayer::PushPropertiesTo(LayerImpl* layer_impl) {
@@ -1902,7 +1903,7 @@ class LayerTreeHostWithProxy : public LayerTreeHost {
: LayerTreeHost(client, NULL, settings) {
proxy->SetLayerTreeHost(this);
client->SetLayerTreeHost(this);
- InitializeForTesting(proxy.Pass());
+ InitializeForTesting(proxy.PassAs<Proxy>());
}
};
@@ -2475,10 +2476,13 @@ class LayerTreeHostTestIOSurfaceDrawing : public LayerTreeHostTest {
new MockIOSurfaceWebGraphicsContext3D);
mock_context_ = mock_context_owned.get();
- if (delegating_renderer())
- return FakeOutputSurface::CreateDelegating3d(mock_context_owned.Pass());
- else
- return FakeOutputSurface::Create3d(mock_context_owned.Pass());
+ if (delegating_renderer()) {
+ return FakeOutputSurface::CreateDelegating3d(
+ mock_context_owned.PassAs<TestWebGraphicsContext3D>());
+ } else {
+ return FakeOutputSurface::Create3d(
+ mock_context_owned.PassAs<TestWebGraphicsContext3D>());
+ }
}
virtual void SetupTree() OVERRIDE {
@@ -2864,7 +2868,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] = nullptr;
+ ui_resources_[i].reset();
}
void CreateResource() {
@@ -2897,7 +2901,8 @@ class PushPropertiesCountingLayerImpl : public LayerImpl {
virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
OVERRIDE {
- return PushPropertiesCountingLayerImpl::Create(tree_impl, id());
+ return PushPropertiesCountingLayerImpl::Create(tree_impl, id()).
+ PassAs<LayerImpl>();
}
size_t push_properties_count() const { return push_properties_count_; }
@@ -2928,7 +2933,8 @@ class PushPropertiesCountingLayer : public Layer {
virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
OVERRIDE {
- return PushPropertiesCountingLayerImpl::Create(tree_impl, id());
+ return PushPropertiesCountingLayerImpl::Create(tree_impl, id()).
+ PassAs<LayerImpl>();
}
void SetDrawsContent(bool draws_content) { SetIsDrawable(draws_content); }
@@ -4728,7 +4734,7 @@ class LayerTreeHostTestHighResRequiredAfterEvictingUIResources
PostSetNeedsCommitToMainThread();
break;
case 2:
- ui_resource_ = nullptr;
+ ui_resource_.reset();
EndTest();
break;
}
diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc
index d7668c1..37e19ad 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.Pass(), 1, 0, Animation::ScrollOffset));
+ scoped_ptr<Animation> animation(Animation::Create(
+ curve.PassAs<AnimationCurve>(), 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 07e12a2..75c2842 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 nullptr;
+ return scoped_ptr<FakeOutputSurface>();
}
scoped_ptr<TestWebGraphicsContext3D> context3d = CreateContext3d();
@@ -363,7 +363,7 @@ class LayerTreeHostClientNotReadyDoesNotCreateOutputSurface
virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback)
OVERRIDE {
EXPECT_TRUE(false);
- return nullptr;
+ return scoped_ptr<OutputSurface>();
}
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.Pass());
- frame_data->render_pass_list.push_back(pass.Pass());
+ frame_data->render_pass_list.push_back(pass_for_quad.PassAs<RenderPass>());
+ frame_data->render_pass_list.push_back(pass.PassAs<RenderPass>());
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_ = nullptr;
+ ui_resource_.reset();
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_ = nullptr;
+ ui_resource_.reset();
// 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_ = nullptr;
+ ui_resource_.reset();
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_ = nullptr). But here we need
+ // destructor (so usually ui_resource_.reset()). 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_ = nullptr;
+ ui_resource_.reset();
EndTest();
break;
case 6:
@@ -1409,12 +1409,12 @@ class UIResourceLostBeforeActivateTree : public UIResourceLostTest {
break;
case 3:
test_id_ = ui_resource_->id();
- ui_resource_ = nullptr;
+ ui_resource_.reset();
PostSetNeedsCommitToMainThread();
break;
case 5:
// Release resource before ending the test.
- ui_resource_ = nullptr;
+ ui_resource_.reset();
EndTest();
break;
case 6:
@@ -1505,7 +1505,7 @@ class UIResourceLostEviction : public UIResourceLostTestSimple {
break;
case 3:
// Release resource before ending the test.
- ui_resource_ = nullptr;
+ ui_resource_.reset();
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 6af1756..89a267a 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_ = nullptr;
+ result_.reset();
// 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 9e38f1c..862f34bb 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_ = nullptr;
- root_layer_ = nullptr;
+ layer_tree_host_.reset();
+ root_layer_ = NULL;
}
// 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 9f2786c..d2db83a 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 = nullptr;
+ layer_tree_host.reset();
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 ea9c1d01..6e44bfc 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -108,9 +108,7 @@ LayerTreeImpl::~LayerTreeImpl() {
DCHECK(layers_with_copy_output_request_.empty());
}
-void LayerTreeImpl::Shutdown() {
- root_layer_ = nullptr;
-}
+void LayerTreeImpl::Shutdown() { root_layer_.reset(); }
void LayerTreeImpl::ReleaseResources() {
if (root_layer_)
@@ -122,8 +120,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_ = nullptr;
- outer_viewport_scroll_delegate_proxy_ = nullptr;
+ inner_viewport_scroll_delegate_proxy_.reset();
+ outer_viewport_scroll_delegate_proxy_.reset();
root_layer_ = layer.Pass();
currently_scrolling_layer_ = NULL;
@@ -183,8 +181,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_ = nullptr;
- outer_viewport_scroll_delegate_proxy_ = nullptr;
+ inner_viewport_scroll_delegate_proxy_.reset();
+ outer_viewport_scroll_delegate_proxy_.reset();
inner_viewport_scroll_layer_ = NULL;
outer_viewport_scroll_layer_ = NULL;
page_scale_layer_ = NULL;
@@ -785,17 +783,19 @@ LayerTreeImpl::CreateScrollbarAnimationController(LayerImpl* scrolling_layer) {
switch (settings().scrollbar_animator) {
case LayerTreeSettings::LinearFade: {
return ScrollbarAnimationControllerLinearFade::Create(
- scrolling_layer, layer_tree_host_impl_, delay, duration);
+ scrolling_layer, layer_tree_host_impl_, delay, duration)
+ .PassAs<ScrollbarAnimationController>();
}
case LayerTreeSettings::Thinning: {
return ScrollbarAnimationControllerThinning::Create(
- scrolling_layer, layer_tree_host_impl_, delay, duration);
+ scrolling_layer, layer_tree_host_impl_, delay, duration)
+ .PassAs<ScrollbarAnimationController>();
}
case LayerTreeSettings::NoAnimator:
NOTREACHED();
break;
}
- return nullptr;
+ return scoped_ptr<ScrollbarAnimationController>();
}
void LayerTreeImpl::DidAnimateScrollOffset() {
@@ -881,8 +881,8 @@ void LayerTreeImpl::SetRootLayerScrollOffsetDelegate(
InnerViewportScrollLayer()->SetScrollOffsetDelegate(NULL);
if (OuterViewportScrollLayer())
OuterViewportScrollLayer()->SetScrollOffsetDelegate(NULL);
- inner_viewport_scroll_delegate_proxy_ = nullptr;
- outer_viewport_scroll_delegate_proxy_ = nullptr;
+ inner_viewport_scroll_delegate_proxy_.reset();
+ outer_viewport_scroll_delegate_proxy_.reset();
}
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 7fc1645..a0dd11a 100644
--- a/cc/trees/layer_tree_impl_unittest.cc
+++ b/cc/trees/layer_tree_impl_unittest.cc
@@ -25,7 +25,8 @@ 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()));
+ EXPECT_TRUE(host_impl_->InitializeRenderer(
+ FakeOutputSurface::Create3d().PassAs<OutputSurface>()));
}
FakeLayerTreeHostImpl& host_impl() { return *host_impl_; }
@@ -123,7 +124,7 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleLayerAndHud) {
hud->SetDrawsContent(true);
host_impl().active_tree()->set_hud_layer(hud.get());
- root->AddChild(hud.Pass());
+ root->AddChild(hud.PassAs<LayerImpl>());
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 37cd8a6..14a9ffd 100644
--- a/cc/trees/occlusion_tracker_perftest.cc
+++ b/cc/trees/occlusion_tracker_perftest.cc
@@ -38,7 +38,8 @@ 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());
+ host_impl_->InitializeRenderer(
+ FakeOutputSurface::Create3d().PassAs<OutputSurface>());
scoped_ptr<LayerImpl> root_layer = LayerImpl::Create(active_tree(), 1);
active_tree()->SetRootLayer(root_layer.Pass());
@@ -85,7 +86,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.Pass());
+ active_tree()->root_layer()->AddChild(opaque_layer.PassAs<LayerImpl>());
active_tree()->UpdateDrawProperties();
const LayerImplList& rsll = active_tree()->RenderSurfaceLayerList();
@@ -155,7 +156,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.Pass());
+ active_tree()->root_layer()->AddChild(opaque_layer.PassAs<LayerImpl>());
}
active_tree()->UpdateDrawProperties();
diff --git a/cc/trees/occlusion_tracker_unittest.cc b/cc/trees/occlusion_tracker_unittest.cc
index 3c6c440..b35e437 100644
--- a/cc/trees/occlusion_tracker_unittest.cc
+++ b/cc/trees/occlusion_tracker_unittest.cc
@@ -121,8 +121,13 @@ struct OcclusionTrackerTestMainThreadTypes {
return make_scoped_refptr(new ContentLayerType());
}
- template <typename T>
- static LayerPtrType PassLayerPtr(T* layer) {
+ static LayerPtrType PassLayerPtr(ContentLayerPtrType* layer) {
+ LayerPtrType ref(*layer);
+ *layer = NULL;
+ return ref;
+ }
+
+ static LayerPtrType PassLayerPtr(LayerPtrType* layer) {
LayerPtrType ref(*layer);
*layer = NULL;
return ref;
@@ -151,11 +156,14 @@ struct OcclusionTrackerTestImplThreadTypes {
}
static int next_layer_impl_id;
- template <typename T>
- static LayerPtrType PassLayerPtr(T* layer) {
+ static LayerPtrType PassLayerPtr(LayerPtrType* 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) {
@@ -278,7 +286,7 @@ template <typename Types> class OcclusionTrackerTest : public testing::Test {
void DestroyLayers() {
Types::DestroyLayer(&root_);
- render_surface_layer_list_ = nullptr;
+ render_surface_layer_list_.reset();
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 b3712b6..97b06bc 100644
--- a/cc/trees/single_thread_proxy.cc
+++ b/cc/trees/single_thread_proxy.cc
@@ -26,7 +26,8 @@ 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));
+ new SingleThreadProxy(layer_tree_host, client, main_task_runner))
+ .PassAs<Proxy>();
}
SingleThreadProxy::SingleThreadProxy(
@@ -313,8 +314,8 @@ void SingleThreadProxy::Stop() {
blocking_main_thread_task_runner());
layer_tree_host_->DeleteContentsTexturesOnImplThread(
layer_tree_host_impl_->resource_provider());
- scheduler_on_impl_thread_ = nullptr;
- layer_tree_host_impl_ = nullptr;
+ scheduler_on_impl_thread_.reset();
+ layer_tree_host_impl_.reset();
}
layer_tree_host_ = NULL;
}
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index 151cb3c..dddf112 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -49,8 +49,9 @@ 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));
+ return make_scoped_ptr(new ThreadProxy(layer_tree_host,
+ main_task_runner,
+ impl_task_runner)).PassAs<Proxy>();
}
ThreadProxy::ThreadProxy(
@@ -962,7 +963,7 @@ void ThreadProxy::ScheduledActionCommit() {
// Complete all remaining texture updates.
impl().current_resource_update_controller->Finalize();
- impl().current_resource_update_controller = nullptr;
+ impl().current_resource_update_controller.reset();
if (impl().animations_frozen_until_next_draw) {
impl().animation_time = std::max(
@@ -1248,10 +1249,10 @@ void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) {
DCHECK(IsMainThreadBlocked());
layer_tree_host()->DeleteContentsTexturesOnImplThread(
impl().layer_tree_host_impl->resource_provider());
- impl().current_resource_update_controller = nullptr;
+ impl().current_resource_update_controller.reset();
impl().layer_tree_host_impl->SetNeedsBeginFrame(false);
- impl().scheduler = nullptr;
- impl().layer_tree_host_impl = nullptr;
+ impl().scheduler.reset();
+ impl().layer_tree_host_impl.reset();
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 d17f017..1faf0e0 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 nullptr;
+ return scoped_ptr<LayerImpl>();
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 007c857..b0e2114 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_);
+ return MockLayerImpl::Create(tree_impl, layer_id_).PassAs<LayerImpl>();
}
virtual void PushPropertiesTo(LayerImpl* layer_impl) OVERRIDE {