diff options
45 files changed, 259 insertions, 361 deletions
diff --git a/cc/animation/layer_animation_controller_unittest.cc b/cc/animation/layer_animation_controller_unittest.cc index f8104c55..082d852 100644 --- a/cc/animation/layer_animation_controller_unittest.cc +++ b/cc/animation/layer_animation_controller_unittest.cc @@ -38,7 +38,7 @@ TEST(LayerAnimationControllerTest, SyncNewAnimation) { EXPECT_FALSE(controller_impl->GetAnimation(Animation::Opacity)); - AddOpacityTransitionToController(controller, 1, 0, 1, false); + AddOpacityTransitionToController(controller.get(), 1, 0, 1, false); int group_id = controller->GetAnimation(Animation::Opacity)->group(); controller->PushAnimationUpdatesTo(controller_impl.get()); @@ -63,7 +63,7 @@ TEST(LayerAnimationControllerTest, DoNotClobberStartTimes) { EXPECT_FALSE(controller_impl->GetAnimation(Animation::Opacity)); - AddOpacityTransitionToController(controller, 1, 0, 1, false); + AddOpacityTransitionToController(controller.get(), 1, 0, 1, false); int group_id = controller->GetAnimation(Animation::Opacity)->group(); controller->PushAnimationUpdatesTo(controller_impl.get()); @@ -106,7 +106,7 @@ TEST(LayerAnimationControllerTest, SyncPauseAndResume) { EXPECT_FALSE(controller_impl->GetAnimation(Animation::Opacity)); - AddOpacityTransitionToController(controller, 1, 0, 1, false); + AddOpacityTransitionToController(controller.get(), 1, 0, 1, false); int group_id = controller->GetAnimation(Animation::Opacity)->group(); controller->PushAnimationUpdatesTo(controller_impl.get()); @@ -167,7 +167,7 @@ TEST(LayerAnimationControllerTest, DoNotSyncFinishedAnimation) { EXPECT_FALSE(controller_impl->GetAnimation(Animation::Opacity)); int animation_id = - AddOpacityTransitionToController(controller, 1, 0, 1, false); + AddOpacityTransitionToController(controller.get(), 1, 0, 1, false); int group_id = controller->GetAnimation(Animation::Opacity)->group(); controller->PushAnimationUpdatesTo(controller_impl.get()); @@ -208,7 +208,7 @@ TEST(LayerAnimationControllerTest, AnimationsAreDeleted) { controller->AddValueObserver(&dummy); controller_impl->AddValueObserver(&dummy_impl); - AddOpacityTransitionToController(controller, 1.0, 0.0f, 1.0f, false); + AddOpacityTransitionToController(controller.get(), 1.0, 0.0f, 1.0f, false); controller->Animate(0.0); controller->UpdateState(true, NULL); controller->PushAnimationUpdatesTo(controller_impl.get()); @@ -256,11 +256,11 @@ TEST(LayerAnimationControllerTest, TransferAnimationsTo) { LayerAnimationController::Create(1)); controller->AddValueObserver(&dummy); - int opacity_animation_id = - AddOpacityTransitionToController(controller, 1.0, 0.0f, 1.0f, false); + int opacity_animation_id = AddOpacityTransitionToController( + controller.get(), 1.0, 0.0f, 1.0f, false); int transform_animation_id = - AddAnimatedTransformToController(controller, 1.0, 10, 10); + AddAnimatedTransformToController(controller.get(), 1.0, 10, 10); controller->Animate(1.0); @@ -270,7 +270,7 @@ TEST(LayerAnimationControllerTest, TransferAnimationsTo) { EXPECT_EQ(Animation::Starting, controller->GetAnimation(Animation::Transform)->run_state()); - controller->TransferAnimationsTo(other_controller); + controller->TransferAnimationsTo(other_controller.get()); // Ensure both animations have been transfered. EXPECT_FALSE(controller->has_any_animation()); diff --git a/cc/base/worker_pool.cc b/cc/base/worker_pool.cc index bbf51c2..ab7d869 100644 --- a/cc/base/worker_pool.cc +++ b/cc/base/worker_pool.cc @@ -78,7 +78,7 @@ bool WorkerPoolTask::IsReadyToRun() const { // TODO(reveman): Use counter to improve performance. for (TaskVector::const_reverse_iterator it = dependencies_.rbegin(); it != dependencies_.rend(); ++it) { - WorkerPoolTask* dependency = *it; + WorkerPoolTask* dependency = it->get(); if (!dependency->HasFinishedRunning()) return false; } @@ -296,7 +296,7 @@ void WorkerPool::Inner::ScheduleTasks(internal::WorkerPoolTask* root) { // First remove all completed tasks from |new_pending_tasks|. for (TaskDeque::iterator it = completed_tasks_.begin(); it != completed_tasks_.end(); ++it) { - internal::WorkerPoolTask* task = *it; + internal::WorkerPoolTask* task = it->get(); new_pending_tasks.take_and_erase(task); } @@ -430,9 +430,9 @@ void WorkerPool::Inner::Run() { ready_to_run_tasks_.erase(ready_to_run_tasks_.begin()); // Move task from |pending_tasks_| to |running_tasks_|. - DCHECK(pending_tasks_.contains(task)); - DCHECK(!running_tasks_.contains(task)); - running_tasks_.set(task, pending_tasks_.take_and_erase(task)); + DCHECK(pending_tasks_.contains(task.get())); + DCHECK(!running_tasks_.contains(task.get())); + running_tasks_.set(task.get(), pending_tasks_.take_and_erase(task.get())); // There may be more work available, so wake up another worker thread. has_ready_to_run_tasks_cv_.Signal(); @@ -450,13 +450,13 @@ void WorkerPool::Inner::Run() { task->DidRun(); // Now iterate over all dependents to check if they are ready to run. - scoped_ptr<ScheduledTask> scheduled_task = running_tasks_.take_and_erase( - task); + scoped_ptr<ScheduledTask> scheduled_task = + running_tasks_.take_and_erase(task.get()); if (scheduled_task) { typedef internal::WorkerPoolTask::TaskVector TaskVector; for (TaskVector::iterator it = scheduled_task->dependents().begin(); it != scheduled_task->dependents().end(); ++it) { - internal::WorkerPoolTask* dependent = *it; + internal::WorkerPoolTask* dependent = it->get(); if (!dependent->IsReadyToRun()) continue; @@ -516,7 +516,7 @@ unsigned WorkerPool::Inner::BuildScheduledTaskMapRecursive( typedef internal::WorkerPoolTask::TaskVector TaskVector; for (TaskVector::iterator it = task->dependencies().begin(); it != task->dependencies().end(); ++it) { - internal::WorkerPoolTask* dependency = *it; + internal::WorkerPoolTask* dependency = it->get(); priority = BuildScheduledTaskMapRecursive( dependency, task, priority, scheduled_tasks); } diff --git a/cc/base/worker_pool_perftest.cc b/cc/base/worker_pool_perftest.cc index c03bcc8..c203526 100644 --- a/cc/base/worker_pool_perftest.cc +++ b/cc/base/worker_pool_perftest.cc @@ -113,7 +113,7 @@ class WorkerPoolPerfTest : public testing::Test, max_depth, num_children_per_node); } - } else if (leaf_task_) { + } else if (leaf_task_.get()) { children.push_back(leaf_task_); } dependencies->push_back(make_scoped_refptr(new PerfTaskImpl(&children))); @@ -161,7 +161,7 @@ class WorkerPoolPerfTest : public testing::Test, scoped_refptr<PerfTaskImpl> root_task( make_scoped_refptr(new PerfTaskImpl(&children))); - worker_pool_->ScheduleTasks(root_task); + worker_pool_->ScheduleTasks(root_task.get()); leaf_task_->WaitForTaskToStartRunning(); worker_pool_->ScheduleTasks(NULL); worker_pool_->CheckForCompletedTasks(); @@ -182,7 +182,7 @@ class WorkerPoolPerfTest : public testing::Test, scoped_refptr<PerfControlTaskImpl> root_task( make_scoped_refptr(new PerfControlTaskImpl(&children))); - worker_pool_->ScheduleTasks(root_task); + worker_pool_->ScheduleTasks(root_task.get()); root_task->WaitForTaskToStartRunning(); root_task->AllowTaskToFinish(); worker_pool_->CheckForCompletedTasks(); diff --git a/cc/base/worker_pool_unittest.cc b/cc/base/worker_pool_unittest.cc index de904b1..9dfe565 100644 --- a/cc/base/worker_pool_unittest.cc +++ b/cc/base/worker_pool_unittest.cc @@ -72,7 +72,7 @@ class FakeWorkerPool : public WorkerPool { &tasks)); scheduled_tasks_completion_.reset(new CompletionEvent); - WorkerPool::ScheduleTasks(completion_task); + WorkerPool::ScheduleTasks(completion_task.get()); } void WaitForTasksToComplete() { diff --git a/cc/layers/content_layer.cc b/cc/layers/content_layer.cc index 9bdbc53..e8db60b 100644 --- a/cc/layers/content_layer.cc +++ b/cc/layers/content_layer.cc @@ -91,7 +91,7 @@ LayerUpdater* ContentLayer::Updater() const { } void ContentLayer::CreateUpdaterIfNeeded() { - if (updater_) + if (updater_.get()) return; scoped_ptr<LayerPainter> painter = ContentLayerPainter::Create(client_).PassAs<LayerPainter>(); @@ -115,7 +115,7 @@ void ContentLayer::CreateUpdaterIfNeeded() { void ContentLayer::SetContentsOpaque(bool opaque) { Layer::SetContentsOpaque(opaque); - if (updater_) + if (updater_.get()) updater_->SetOpaque(opaque); } diff --git a/cc/layers/contents_scaling_layer_unittest.cc b/cc/layers/contents_scaling_layer_unittest.cc index 42c4403..08d9eb1 100644 --- a/cc/layers/contents_scaling_layer_unittest.cc +++ b/cc/layers/contents_scaling_layer_unittest.cc @@ -58,22 +58,22 @@ TEST(ContentsScalingLayerTest, CheckContentsBounds) { root->AddChild(test_layer); test_layer->SetBounds(gfx::Size(320, 240)); - CalcDrawProps(root, 1.f); + CalcDrawProps(root.get(), 1.f); EXPECT_FLOAT_EQ(1.f, test_layer->contents_scale_x()); EXPECT_FLOAT_EQ(1.f, test_layer->contents_scale_y()); EXPECT_EQ(320, test_layer->content_bounds().width()); EXPECT_EQ(240, test_layer->content_bounds().height()); - CalcDrawProps(root, 2.f); + CalcDrawProps(root.get(), 2.f); EXPECT_EQ(640, test_layer->content_bounds().width()); EXPECT_EQ(480, test_layer->content_bounds().height()); test_layer->SetBounds(gfx::Size(10, 20)); - CalcDrawProps(root, 2.f); + CalcDrawProps(root.get(), 2.f); EXPECT_EQ(20, test_layer->content_bounds().width()); EXPECT_EQ(40, test_layer->content_bounds().height()); - CalcDrawProps(root, 1.33f); + CalcDrawProps(root.get(), 1.33f); EXPECT_EQ(14, test_layer->content_bounds().width()); EXPECT_EQ(27, test_layer->content_bounds().height()); } diff --git a/cc/layers/image_layer.cc b/cc/layers/image_layer.cc index 4dde8c1..c4f948c 100644 --- a/cc/layers/image_layer.cc +++ b/cc/layers/image_layer.cc @@ -54,7 +54,7 @@ void ImageLayer::Update(ResourceUpdateQueue* queue, } void ImageLayer::CreateUpdaterIfNeeded() { - if (updater_) + if (updater_.get()) return; updater_ = ImageLayerUpdater::Create(); diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc index 79ea631..8826b66 100644 --- a/cc/layers/layer.cc +++ b/cc/layers/layer.cc @@ -73,11 +73,11 @@ Layer::~Layer() { // Remove the parent reference from all children and dependents. RemoveAllChildren(); - if (mask_layer_) { + if (mask_layer_.get()) { DCHECK_EQ(this, mask_layer_->parent()); mask_layer_->RemoveFromParent(); } - if (replica_layer_) { + if (replica_layer_.get()) { DCHECK_EQ(this, replica_layer_->parent()); replica_layer_->RemoveFromParent(); } @@ -92,9 +92,9 @@ void Layer::SetLayerTreeHost(LayerTreeHost* host) { for (size_t i = 0; i < children_.size(); ++i) children_[i]->SetLayerTreeHost(host); - if (mask_layer_) + if (mask_layer_.get()) mask_layer_->SetLayerTreeHost(host); - if (replica_layer_) + if (replica_layer_.get()) replica_layer_->SetLayerTreeHost(host); if (host) { @@ -177,9 +177,9 @@ void Layer::SetParent(Layer* layer) { return; reset_raster_scale_to_unknown(); - if (mask_layer_) + if (mask_layer_.get()) mask_layer_->reset_raster_scale_to_unknown(); - if (replica_layer_ && replica_layer_->mask_layer_) + if (replica_layer_.get() && replica_layer_->mask_layer_.get()) replica_layer_->mask_layer_->reset_raster_scale_to_unknown(); } @@ -213,13 +213,13 @@ void Layer::RemoveFromParent() { } void Layer::RemoveChildOrDependent(Layer* child) { - if (mask_layer_ == child) { + if (mask_layer_.get() == child) { mask_layer_->SetParent(NULL); mask_layer_ = NULL; SetNeedsFullTreeSync(); return; } - if (replica_layer_ == child) { + if (replica_layer_.get() == child) { replica_layer_->SetParent(NULL); replica_layer_ = NULL; SetNeedsFullTreeSync(); @@ -229,7 +229,7 @@ void Layer::RemoveChildOrDependent(Layer* child) { for (LayerList::iterator iter = children_.begin(); iter != children_.end(); ++iter) { - if (*iter != child) + if (iter->get() != child) continue; child->SetParent(NULL); @@ -244,7 +244,7 @@ void Layer::ReplaceChild(Layer* reference, scoped_refptr<Layer> new_layer) { DCHECK_EQ(reference->parent(), this); DCHECK(IsPropertyChangeAllowed()); - if (reference == new_layer) + if (reference == new_layer.get()) return; int reference_index = IndexOfChild(reference); @@ -255,7 +255,7 @@ void Layer::ReplaceChild(Layer* reference, scoped_refptr<Layer> new_layer) { reference->RemoveFromParent(); - if (new_layer) { + if (new_layer.get()) { new_layer->RemoveFromParent(); InsertChild(new_layer, reference_index); } @@ -263,7 +263,7 @@ void Layer::ReplaceChild(Layer* reference, scoped_refptr<Layer> new_layer) { int Layer::IndexOfChild(const Layer* reference) { for (size_t i = 0; i < children_.size(); ++i) { - if (children_[i] == reference) + if (children_[i].get() == reference) return i; } return -1; @@ -366,14 +366,14 @@ void Layer::SetMasksToBounds(bool masks_to_bounds) { void Layer::SetMaskLayer(Layer* mask_layer) { DCHECK(IsPropertyChangeAllowed()); - if (mask_layer_ == mask_layer) + if (mask_layer_.get() == mask_layer) return; - if (mask_layer_) { + if (mask_layer_.get()) { DCHECK_EQ(this, mask_layer_->parent()); mask_layer_->RemoveFromParent(); } mask_layer_ = mask_layer; - if (mask_layer_) { + if (mask_layer_.get()) { DCHECK(!mask_layer_->parent()); mask_layer_->RemoveFromParent(); mask_layer_->SetParent(this); @@ -384,14 +384,14 @@ void Layer::SetMaskLayer(Layer* mask_layer) { void Layer::SetReplicaLayer(Layer* layer) { DCHECK(IsPropertyChangeAllowed()); - if (replica_layer_ == layer) + if (replica_layer_.get() == layer) return; - if (replica_layer_) { + if (replica_layer_.get()) { DCHECK_EQ(this, replica_layer_->parent()); replica_layer_->RemoveFromParent(); } replica_layer_ = layer; - if (replica_layer_) { + if (replica_layer_.get()) { DCHECK(!replica_layer_->parent()); replica_layer_->RemoveFromParent(); replica_layer_->SetParent(this); diff --git a/cc/layers/layer.h b/cc/layers/layer.h index 23ca525..b7d56cd 100644 --- a/cc/layers/layer.h +++ b/cc/layers/layer.h @@ -268,10 +268,11 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>, Layer* replica_layer() { return replica_layer_.get(); } const Layer* replica_layer() const { return replica_layer_.get(); } - bool has_mask() const { return !!mask_layer_; } - bool has_replica() const { return !!replica_layer_; } + bool has_mask() const { return !!mask_layer_.get(); } + bool has_replica() const { return !!replica_layer_.get(); } bool replica_has_mask() const { - return replica_layer_ && (mask_layer_ || replica_layer_->mask_layer_); + return replica_layer_.get() && + (mask_layer_.get() || replica_layer_->mask_layer_.get()); } // These methods typically need to be overwritten by derived classes. diff --git a/cc/layers/layer_unittest.cc b/cc/layers/layer_unittest.cc index f087081..006846a 100644 --- a/cc/layers/layer_unittest.cc +++ b/cc/layers/layer_unittest.cc @@ -144,7 +144,7 @@ class LayerTest : public testing::Test { TEST_F(LayerTest, BasicCreateAndDestroy) { scoped_refptr<Layer> test_layer = Layer::Create(); - ASSERT_TRUE(test_layer); + ASSERT_TRUE(test_layer.get()); EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(0); test_layer->SetLayerTreeHost(layer_tree_host_.get()); diff --git a/cc/layers/nine_patch_layer.cc b/cc/layers/nine_patch_layer.cc index 45c69eb..7327795 100644 --- a/cc/layers/nine_patch_layer.cc +++ b/cc/layers/nine_patch_layer.cc @@ -75,7 +75,7 @@ void NinePatchLayer::Update(ResourceUpdateQueue* queue, } void NinePatchLayer::CreateUpdaterIfNeeded() { - if (updater_) + if (updater_.get()) return; updater_ = ImageLayerUpdater::Create(); diff --git a/cc/layers/nine_patch_layer_unittest.cc b/cc/layers/nine_patch_layer_unittest.cc index cf3b5a37..089e058 100644 --- a/cc/layers/nine_patch_layer_unittest.cc +++ b/cc/layers/nine_patch_layer_unittest.cc @@ -57,7 +57,7 @@ class NinePatchLayerTest : public testing::Test { TEST_F(NinePatchLayerTest, TriggerFullUploadOnceWhenChangingBitmap) { scoped_refptr<NinePatchLayer> test_layer = NinePatchLayer::Create(); - ASSERT_TRUE(test_layer); + ASSERT_TRUE(test_layer.get()); test_layer->SetIsDrawable(true); test_layer->SetBounds(gfx::Size(100, 100)); diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc index e01656a..e7747de 100644 --- a/cc/layers/picture_layer.cc +++ b/cc/layers/picture_layer.cc @@ -46,8 +46,8 @@ void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) { // See PictureLayerImpl::PushPropertiesTo for more details. layer_impl->invalidation_.Clear(); layer_impl->invalidation_.Swap(&pile_invalidation_); - layer_impl->pile_ = - PicturePileImpl::CreateFromOther(pile_, layer_impl->is_using_lcd_text_); + layer_impl->pile_ = PicturePileImpl::CreateFromOther( + pile_.get(), layer_impl->is_using_lcd_text_); layer_impl->SyncFromActiveLayer(); } diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc index 6dc7e63..2396fa7 100644 --- a/cc/layers/picture_layer_impl.cc +++ b/cc/layers/picture_layer_impl.cc @@ -977,8 +977,8 @@ void PictureLayerImpl::UpdateLCDTextStatus() { // Further tiles created due to new tilings should be considered invalidated. pending_layer->invalidation_.Union(gfx::Rect(bounds())); pending_layer->is_using_lcd_text_ = is_using_lcd_text_; - pending_layer->pile_ = PicturePileImpl::CreateFromOther(pending_layer->pile_, - is_using_lcd_text_); + pending_layer->pile_ = PicturePileImpl::CreateFromOther( + pending_layer->pile_.get(), is_using_lcd_text_); pending_layer->tilings_->DestroyAndRecreateTilesWithText(); } diff --git a/cc/layers/scrollbar_layer.cc b/cc/layers/scrollbar_layer.cc index 1939772..30e2a93 100644 --- a/cc/layers/scrollbar_layer.cc +++ b/cc/layers/scrollbar_layer.cc @@ -180,10 +180,11 @@ void ScrollbarLayer::CreateUpdaterIfNeeded() { texture_format_ = layer_tree_host()->GetRendererCapabilities().best_texture_format; - if (!track_updater_) { + if (!track_updater_.get()) { track_updater_ = CachingBitmapContentLayerUpdater::Create( scoped_ptr<LayerPainter>( - new ScrollbarPartPainter(scrollbar_.get(), TRACK)).Pass(), + new ScrollbarPartPainter(scrollbar_.get(), TRACK)) + .Pass(), rendering_stats_instrumentation(), id()); } @@ -192,10 +193,11 @@ void ScrollbarLayer::CreateUpdaterIfNeeded() { layer_tree_host()->contents_texture_manager()); } - if (!thumb_updater_) { + if (!thumb_updater_.get()) { thumb_updater_ = CachingBitmapContentLayerUpdater::Create( scoped_ptr<LayerPainter>( - new ScrollbarPartPainter(scrollbar_.get(), THUMB)).Pass(), + new ScrollbarPartPainter(scrollbar_.get(), THUMB)) + .Pass(), rendering_stats_instrumentation(), id()); } diff --git a/cc/layers/scrollbar_layer_unittest.cc b/cc/layers/scrollbar_layer_unittest.cc index ae87b30..f80e4ca 100644 --- a/cc/layers/scrollbar_layer_unittest.cc +++ b/cc/layers/scrollbar_layer_unittest.cc @@ -457,7 +457,7 @@ class ScrollbarLayerTestResourceCreation : public testing::Test { scrollbar_layer->draw_properties().visible_content_rect = gfx::Rect(0, 0, 100, 200); scrollbar_layer->CreateRenderSurface(); - scrollbar_layer->draw_properties().render_target = scrollbar_layer; + scrollbar_layer->draw_properties().render_target = scrollbar_layer.get(); testing::Mock::VerifyAndClearExpectations(layer_tree_host_.get()); EXPECT_EQ(scrollbar_layer->layer_tree_host(), layer_tree_host_.get()); @@ -536,7 +536,7 @@ class ScaledScrollbarLayerTestResourceCreation : public testing::Test { scaled_size.width(), scaled_size.height()); scrollbar_layer->CreateRenderSurface(); - scrollbar_layer->draw_properties().render_target = scrollbar_layer; + scrollbar_layer->draw_properties().render_target = scrollbar_layer.get(); testing::Mock::VerifyAndClearExpectations(layer_tree_host_.get()); EXPECT_EQ(scrollbar_layer->layer_tree_host(), layer_tree_host_.get()); diff --git a/cc/layers/solid_color_layer_impl_unittest.cc b/cc/layers/solid_color_layer_impl_unittest.cc index b1101c3..dcb4123 100644 --- a/cc/layers/solid_color_layer_impl_unittest.cc +++ b/cc/layers/solid_color_layer_impl_unittest.cc @@ -110,7 +110,7 @@ TEST(SolidColorLayerImplTest, VerifyOpaqueRect) { root->AddChild(layer); LayerList render_surface_layer_list; - LayerTreeHostCommon::CalculateDrawProperties(root, + LayerTreeHostCommon::CalculateDrawProperties(root.get(), gfx::Size(500, 500), 1.f, 1.f, diff --git a/cc/layers/texture_layer_unittest.cc b/cc/layers/texture_layer_unittest.cc index ff204d6..3171cc6 100644 --- a/cc/layers/texture_layer_unittest.cc +++ b/cc/layers/texture_layer_unittest.cc @@ -69,7 +69,7 @@ class TextureLayerTest : public testing::Test { TEST_F(TextureLayerTest, SyncImplWhenChangingTextureId) { scoped_refptr<TextureLayer> test_layer = TextureLayer::Create(NULL); - ASSERT_TRUE(test_layer); + ASSERT_TRUE(test_layer.get()); EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(AnyNumber()); EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); @@ -97,7 +97,7 @@ TEST_F(TextureLayerTest, SyncImplWhenDrawing) { gfx::RectF dirty_rect(0.f, 0.f, 1.f, 1.f); scoped_refptr<TextureLayer> test_layer = TextureLayer::Create(NULL); - ASSERT_TRUE(test_layer); + ASSERT_TRUE(test_layer.get()); scoped_ptr<TextureLayerImpl> impl_layer; impl_layer = TextureLayerImpl::Create(host_impl_.active_tree(), 1, false); ASSERT_TRUE(impl_layer); @@ -147,12 +147,12 @@ TEST_F(TextureLayerTest, SyncImplWhenDrawing) { TEST_F(TextureLayerTest, SyncImplWhenRemovingFromTree) { scoped_refptr<Layer> root_layer = Layer::Create(); - ASSERT_TRUE(root_layer); + ASSERT_TRUE(root_layer.get()); scoped_refptr<Layer> child_layer = Layer::Create(); - ASSERT_TRUE(child_layer); + ASSERT_TRUE(child_layer.get()); root_layer->AddChild(child_layer); scoped_refptr<TextureLayer> test_layer = TextureLayer::Create(NULL); - ASSERT_TRUE(test_layer); + ASSERT_TRUE(test_layer.get()); test_layer->SetTextureId(0); child_layer->AddChild(test_layer); @@ -254,7 +254,7 @@ class TextureLayerWithMailboxTest : public TextureLayerTest { TEST_F(TextureLayerWithMailboxTest, ReplaceMailboxOnMainThreadBeforeCommit) { scoped_refptr<TextureLayer> test_layer = TextureLayer::CreateForMailbox(NULL); - ASSERT_TRUE(test_layer); + ASSERT_TRUE(test_layer.get()); EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(0); EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); diff --git a/cc/layers/tiled_layer_unittest.cc b/cc/layers/tiled_layer_unittest.cc index 8274c8b..fe2ed5a 100644 --- a/cc/layers/tiled_layer_unittest.cc +++ b/cc/layers/tiled_layer_unittest.cc @@ -124,9 +124,9 @@ class TiledLayerTest : public testing::Test { void CalcDrawProps(const scoped_refptr<FakeTiledLayer>& layer1, const scoped_refptr<FakeTiledLayer>& layer2) { - if (layer1 && !layer1->parent()) + if (layer1.get() && !layer1->parent()) layer_tree_host_->root_layer()->AddChild(layer1); - if (layer2 && !layer2->parent()) + if (layer2.get() && !layer2->parent()) layer_tree_host_->root_layer()->AddChild(layer2); if (occlusion_) occlusion_->SetRenderTarget(layer_tree_host_->root_layer()); @@ -157,35 +157,35 @@ class TiledLayerTest : public testing::Test { const scoped_ptr<FakeTiledLayerImpl>& layer_impl2) { // Get textures resource_manager_->ClearPriorities(); - if (layer1) + if (layer1.get()) layer1->SetTexturePriorities(priority_calculator_); - if (layer2) + if (layer2.get()) layer2->SetTexturePriorities(priority_calculator_); resource_manager_->PrioritizeTextures(); // Save paint properties - if (layer1) + if (layer1.get()) layer1->SavePaintProperties(); - if (layer2) + if (layer2.get()) layer2->SavePaintProperties(); // Update content - if (layer1) + if (layer1.get()) layer1->Update(queue_.get(), occlusion_, NULL); - if (layer2) + if (layer2.get()) layer2->Update(queue_.get(), occlusion_, NULL); bool needs_update = false; - if (layer1) + if (layer1.get()) needs_update |= layer1->NeedsIdlePaint(); - if (layer2) + if (layer2.get()) needs_update |= layer2->NeedsIdlePaint(); // Update textures and push. UpdateTextures(); - if (layer1) + if (layer1.get()) LayerPushPropertiesTo(layer1.get(), layer_impl1.get()); - if (layer2) + if (layer2.get()) LayerPushPropertiesTo(layer2.get(), layer_impl2.get()); return needs_update; diff --git a/cc/layers/video_layer_impl.cc b/cc/layers/video_layer_impl.cc index 3849452..d62a002 100644 --- a/cc/layers/video_layer_impl.cc +++ b/cc/layers/video_layer_impl.cc @@ -81,7 +81,7 @@ void VideoLayerImpl::WillDraw(ResourceProvider* resource_provider) { // lock should not cause a deadlock. frame_ = provider_client_impl_->AcquireLockAndCurrentFrame(); - if (!frame_) { + if (!frame_.get()) { // Drop any resources used by the updater if there is no frame to display. updater_.reset(); @@ -124,7 +124,7 @@ void VideoLayerImpl::WillDraw(ResourceProvider* resource_provider) { void VideoLayerImpl::AppendQuads(QuadSink* quad_sink, AppendQuadsData* append_quads_data) { - if (!frame_) + if (!frame_.get()) return; SharedQuadState* shared_quad_state = @@ -280,7 +280,7 @@ void VideoLayerImpl::AppendQuads(QuadSink* quad_sink, void VideoLayerImpl::DidDraw(ResourceProvider* resource_provider) { LayerImpl::DidDraw(resource_provider); - if (!frame_) + if (!frame_.get()) return; if (frame_resource_type_ == diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index 436a9008..4da3aab 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc @@ -1987,7 +1987,7 @@ void GLRenderer::SwapBuffers(const ui::LatencyInfo& latency_info) { // We don't have real fences, so we mark read fences as passed // assuming a double-buffered GPU pipeline. A texture can be // written to after one full frame has past since it was last read. - if (last_swap_fence_) + if (last_swap_fence_.get()) static_cast<SimpleSwapFence*>(last_swap_fence_.get())->SetHasPassed(); last_swap_fence_ = resource_provider_->GetReadLockFence(); resource_provider_->SetReadLockFence(new SimpleSwapFence()); diff --git a/cc/resources/picture.cc b/cc/resources/picture.cc index b0f3fa3..47c0818 100644 --- a/cc/resources/picture.cc +++ b/cc/resources/picture.cc @@ -225,8 +225,11 @@ void Picture::CloneForDrawing(int num_threads) { pixel_refs_)); clones_.push_back(clone); - TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"), - "cc::Picture", clone.get(), TracedPicture::AsTraceablePicture(clone)); + TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( + TRACE_DISABLED_BY_DEFAULT("cc.debug"), + "cc::Picture", + clone.get(), + TracedPicture::AsTraceablePicture(clone.get())); } } diff --git a/cc/resources/picture_layer_tiling.cc b/cc/resources/picture_layer_tiling.cc index 1fb0f33..4394e79 100644 --- a/cc/resources/picture_layer_tiling.cc +++ b/cc/resources/picture_layer_tiling.cc @@ -100,7 +100,7 @@ void PictureLayerTiling::CreateTile(int i, // Create a new tile because our twin didn't have a valid one. scoped_refptr<Tile> tile = client_->CreateTile(this, tile_rect); - if (tile) + if (tile.get()) tiles_[key] = tile; } @@ -114,7 +114,7 @@ Region PictureLayerTiling::OpaqueRegionInContentRect( void PictureLayerTiling::DestroyAndRecreateTilesWithText() { std::vector<TileMapKey> new_tiles; for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { - if (client_->TileHasText(it->second)) + if (client_->TileHasText(it->second.get())) new_tiles.push_back(it->first); } @@ -480,7 +480,7 @@ void PictureLayerTiling::DidBecomeActive() { // will cause PicturePileImpls and their clones to get deleted once the // corresponding PictureLayerImpl and any in flight raster jobs go out of // scope. - client_->UpdatePile(it->second); + client_->UpdatePile(it->second.get()); } } @@ -496,7 +496,7 @@ scoped_ptr<base::Value> PictureLayerTiling::AsValue() const { size_t PictureLayerTiling::GPUMemoryUsageInBytes() const { size_t amount = 0; for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { - const Tile* tile = it->second; + const Tile* tile = it->second.get(); amount += tile->tile_version().GPUMemoryUsageInBytes(); } return amount; diff --git a/cc/resources/picture_layer_tiling.h b/cc/resources/picture_layer_tiling.h index d2f8299..4fa772c 100644 --- a/cc/resources/picture_layer_tiling.h +++ b/cc/resources/picture_layer_tiling.h @@ -72,7 +72,7 @@ class CC_EXPORT PictureLayerTiling { std::vector<Tile*> all_tiles; for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) - all_tiles.push_back(it->second); + all_tiles.push_back(it->second.get()); return all_tiles; } diff --git a/cc/resources/picture_pile.cc b/cc/resources/picture_pile.cc index 3035209..7c16063 100644 --- a/cc/resources/picture_pile.cc +++ b/cc/resources/picture_pile.cc @@ -146,7 +146,7 @@ void PicturePile::InvalidateRect( picture_rect.Union((*overlaps[j])->LayerRect()); } - Picture* base_picture = picture_list.front(); + Picture* base_picture = picture_list.front().get(); int max_pixels = kResetThreshold * base_picture->LayerRect().size().GetArea(); if (picture_rect.size().GetArea() > max_pixels) { // This picture list will be entirely recreated, so clear it. diff --git a/cc/resources/picture_pile_impl.cc b/cc/resources/picture_pile_impl.cc index c91e531..d992af1 100644 --- a/cc/resources/picture_pile_impl.cc +++ b/cc/resources/picture_pile_impl.cc @@ -71,7 +71,7 @@ PicturePileImpl::~PicturePileImpl() { PicturePileImpl* PicturePileImpl::GetCloneForDrawingOnThread( unsigned thread_index) const { CHECK_GT(clones_for_drawing_.clones_.size(), thread_index); - return clones_for_drawing_.clones_[thread_index]; + return clones_for_drawing_.clones_[thread_index].get(); } void PicturePileImpl::RasterDirect( @@ -367,9 +367,8 @@ void PicturePileImpl::PixelRefIterator::AdvanceToPictureWithPixelRefs() { for (; picture_list_iterator_ != picture_list_->end(); ++picture_list_iterator_) { - pixel_ref_iterator_ = Picture::PixelRefIterator( - layer_rect_, - *picture_list_iterator_); + pixel_ref_iterator_ = + Picture::PixelRefIterator(layer_rect_, picture_list_iterator_->get()); if (pixel_ref_iterator_) return; } diff --git a/cc/resources/picture_pile_impl_unittest.cc b/cc/resources/picture_pile_impl_unittest.cc index 5fe7b2f..d0e78b9 100644 --- a/cc/resources/picture_pile_impl_unittest.cc +++ b/cc/resources/picture_pile_impl_unittest.cc @@ -157,67 +157,49 @@ TEST(PicturePileImplTest, PixelRefIteratorEmpty) { // Tile sized iterators. { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 128, 128), - 1.0, - pile); + gfx::Rect(0, 0, 128, 128), 1.0, pile.get()); EXPECT_FALSE(iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 256, 256), - 2.0, - pile); + gfx::Rect(0, 0, 256, 256), 2.0, pile.get()); EXPECT_FALSE(iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 64, 64), - 0.5, - pile); + gfx::Rect(0, 0, 64, 64), 0.5, pile.get()); EXPECT_FALSE(iterator); } // Shifted tile sized iterators. { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(140, 140, 128, 128), - 1.0, - pile); + gfx::Rect(140, 140, 128, 128), 1.0, pile.get()); EXPECT_FALSE(iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(280, 280, 256, 256), - 2.0, - pile); + gfx::Rect(280, 280, 256, 256), 2.0, pile.get()); EXPECT_FALSE(iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(70, 70, 64, 64), - 0.5, - pile); + gfx::Rect(70, 70, 64, 64), 0.5, pile.get()); EXPECT_FALSE(iterator); } // Layer sized iterators. { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 256, 256), - 1.0, - pile); + gfx::Rect(0, 0, 256, 256), 1.0, pile.get()); EXPECT_FALSE(iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 512, 512), - 2.0, - pile); + gfx::Rect(0, 0, 512, 512), 2.0, pile.get()); EXPECT_FALSE(iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 128, 128), - 0.5, - pile); + gfx::Rect(0, 0, 128, 128), 0.5, pile.get()); EXPECT_FALSE(iterator); } } @@ -248,67 +230,49 @@ TEST(PicturePileImplTest, PixelRefIteratorNoLazyRefs) { // Tile sized iterators. { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 128, 128), - 1.0, - pile); + gfx::Rect(0, 0, 128, 128), 1.0, pile.get()); EXPECT_FALSE(iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 256, 256), - 2.0, - pile); + gfx::Rect(0, 0, 256, 256), 2.0, pile.get()); EXPECT_FALSE(iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 64, 64), - 0.5, - pile); + gfx::Rect(0, 0, 64, 64), 0.5, pile.get()); EXPECT_FALSE(iterator); } // Shifted tile sized iterators. { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(140, 140, 128, 128), - 1.0, - pile); + gfx::Rect(140, 140, 128, 128), 1.0, pile.get()); EXPECT_FALSE(iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(280, 280, 256, 256), - 2.0, - pile); + gfx::Rect(280, 280, 256, 256), 2.0, pile.get()); EXPECT_FALSE(iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(70, 70, 64, 64), - 0.5, - pile); + gfx::Rect(70, 70, 64, 64), 0.5, pile.get()); EXPECT_FALSE(iterator); } // Layer sized iterators. { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 256, 256), - 1.0, - pile); + gfx::Rect(0, 0, 256, 256), 1.0, pile.get()); EXPECT_FALSE(iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 512, 512), - 2.0, - pile); + gfx::Rect(0, 0, 512, 512), 2.0, pile.get()); EXPECT_FALSE(iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 128, 128), - 0.5, - pile); + gfx::Rect(0, 0, 128, 128), 0.5, pile.get()); EXPECT_FALSE(iterator); } } @@ -340,27 +304,21 @@ TEST(PicturePileImplTest, PixelRefIteratorLazyRefs) { // Tile sized iterators. These should find only one pixel ref. { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 128, 128), - 1.0, - pile); + gfx::Rect(0, 0, 128, 128), 1.0, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[0][0].pixelRef()); EXPECT_FALSE(++iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 256, 256), - 2.0, - pile); + gfx::Rect(0, 0, 256, 256), 2.0, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[0][0].pixelRef()); EXPECT_FALSE(++iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 64, 64), - 0.5, - pile); + gfx::Rect(0, 0, 64, 64), 0.5, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[0][0].pixelRef()); EXPECT_FALSE(++iterator); @@ -368,27 +326,21 @@ TEST(PicturePileImplTest, PixelRefIteratorLazyRefs) { // Shifted tile sized iterators. These should find only one pixel ref. { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(140, 140, 128, 128), - 1.0, - pile); + gfx::Rect(140, 140, 128, 128), 1.0, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[1][1].pixelRef()); EXPECT_FALSE(++iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(280, 280, 256, 256), - 2.0, - pile); + gfx::Rect(280, 280, 256, 256), 2.0, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[1][1].pixelRef()); EXPECT_FALSE(++iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(70, 70, 64, 64), - 0.5, - pile); + gfx::Rect(70, 70, 64, 64), 0.5, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[1][1].pixelRef()); EXPECT_FALSE(++iterator); @@ -396,17 +348,13 @@ TEST(PicturePileImplTest, PixelRefIteratorLazyRefs) { // Ensure there's no lazy pixel refs in the empty cell { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(140, 0, 128, 128), - 1.0, - pile); + gfx::Rect(140, 0, 128, 128), 1.0, pile.get()); EXPECT_FALSE(iterator); } // Layer sized iterators. These should find all 3 pixel refs. { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 256, 256), - 1.0, - pile); + gfx::Rect(0, 0, 256, 256), 1.0, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[0][0].pixelRef()); EXPECT_TRUE(++iterator); @@ -417,9 +365,7 @@ TEST(PicturePileImplTest, PixelRefIteratorLazyRefs) { } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 512, 512), - 2.0, - pile); + gfx::Rect(0, 0, 512, 512), 2.0, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[0][0].pixelRef()); EXPECT_TRUE(++iterator); @@ -430,9 +376,7 @@ TEST(PicturePileImplTest, PixelRefIteratorLazyRefs) { } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 128, 128), - 0.5, - pile); + gfx::Rect(0, 0, 128, 128), 0.5, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[0][0].pixelRef()); EXPECT_TRUE(++iterator); @@ -470,27 +414,21 @@ TEST(PicturePileImplTest, PixelRefIteratorLazyRefsOneTile) { // Tile sized iterators. These should find only one pixel ref. { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 256, 256), - 1.0, - pile); + gfx::Rect(0, 0, 256, 256), 1.0, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[0][0].pixelRef()); EXPECT_FALSE(++iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 512, 512), - 2.0, - pile); + gfx::Rect(0, 0, 512, 512), 2.0, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[0][0].pixelRef()); EXPECT_FALSE(++iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 128, 128), - 0.5, - pile); + gfx::Rect(0, 0, 128, 128), 0.5, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[0][0].pixelRef()); EXPECT_FALSE(++iterator); @@ -498,27 +436,21 @@ TEST(PicturePileImplTest, PixelRefIteratorLazyRefsOneTile) { // Shifted tile sized iterators. These should find only one pixel ref. { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(260, 260, 256, 256), - 1.0, - pile); + gfx::Rect(260, 260, 256, 256), 1.0, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[1][1].pixelRef()); EXPECT_FALSE(++iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(520, 520, 512, 512), - 2.0, - pile); + gfx::Rect(520, 520, 512, 512), 2.0, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[1][1].pixelRef()); EXPECT_FALSE(++iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(130, 130, 128, 128), - 0.5, - pile); + gfx::Rect(130, 130, 128, 128), 0.5, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[1][1].pixelRef()); EXPECT_FALSE(++iterator); @@ -526,17 +458,13 @@ TEST(PicturePileImplTest, PixelRefIteratorLazyRefsOneTile) { // Ensure there's no lazy pixel refs in the empty cell { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 256, 256, 256), - 1.0, - pile); + gfx::Rect(0, 256, 256, 256), 1.0, pile.get()); EXPECT_FALSE(iterator); } // Layer sized iterators. These should find three pixel ref. { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 512, 512), - 1.0, - pile); + gfx::Rect(0, 0, 512, 512), 1.0, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[0][0].pixelRef()); EXPECT_TRUE(++iterator); @@ -547,9 +475,7 @@ TEST(PicturePileImplTest, PixelRefIteratorLazyRefsOneTile) { } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 1024, 1024), - 2.0, - pile); + gfx::Rect(0, 0, 1024, 1024), 2.0, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[0][0].pixelRef()); EXPECT_TRUE(++iterator); @@ -560,9 +486,7 @@ TEST(PicturePileImplTest, PixelRefIteratorLazyRefsOneTile) { } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 256, 256), - 0.5, - pile); + gfx::Rect(0, 0, 256, 256), 0.5, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[0][0].pixelRef()); EXPECT_TRUE(++iterator); @@ -574,9 +498,7 @@ TEST(PicturePileImplTest, PixelRefIteratorLazyRefsOneTile) { // Copy test. PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 512, 512), - 1.0, - pile); + gfx::Rect(0, 0, 512, 512), 1.0, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[0][0].pixelRef()); EXPECT_TRUE(++iterator); @@ -628,27 +550,21 @@ TEST(PicturePileImplTest, PixelRefIteratorLazyRefsBaseNonLazy) { // Tile sized iterators. These should find only one pixel ref. { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 256, 256), - 1.0, - pile); + gfx::Rect(0, 0, 256, 256), 1.0, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[0][0].pixelRef()); EXPECT_FALSE(++iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 512, 512), - 2.0, - pile); + gfx::Rect(0, 0, 512, 512), 2.0, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[0][0].pixelRef()); EXPECT_FALSE(++iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 128, 128), - 0.5, - pile); + gfx::Rect(0, 0, 128, 128), 0.5, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[0][0].pixelRef()); EXPECT_FALSE(++iterator); @@ -656,27 +572,21 @@ TEST(PicturePileImplTest, PixelRefIteratorLazyRefsBaseNonLazy) { // Shifted tile sized iterators. These should find only one pixel ref. { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(260, 260, 256, 256), - 1.0, - pile); + gfx::Rect(260, 260, 256, 256), 1.0, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[1][1].pixelRef()); EXPECT_FALSE(++iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(520, 520, 512, 512), - 2.0, - pile); + gfx::Rect(520, 520, 512, 512), 2.0, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[1][1].pixelRef()); EXPECT_FALSE(++iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(130, 130, 128, 128), - 0.5, - pile); + gfx::Rect(130, 130, 128, 128), 0.5, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[1][1].pixelRef()); EXPECT_FALSE(++iterator); @@ -684,17 +594,13 @@ TEST(PicturePileImplTest, PixelRefIteratorLazyRefsBaseNonLazy) { // Ensure there's no lazy pixel refs in the empty cell { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 256, 256, 256), - 1.0, - pile); + gfx::Rect(0, 256, 256, 256), 1.0, pile.get()); EXPECT_FALSE(iterator); } // Layer sized iterators. These should find three pixel ref. { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 512, 512), - 1.0, - pile); + gfx::Rect(0, 0, 512, 512), 1.0, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[0][0].pixelRef()); EXPECT_TRUE(++iterator); @@ -705,9 +611,7 @@ TEST(PicturePileImplTest, PixelRefIteratorLazyRefsBaseNonLazy) { } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 1024, 1024), - 2.0, - pile); + gfx::Rect(0, 0, 1024, 1024), 2.0, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[0][0].pixelRef()); EXPECT_TRUE(++iterator); @@ -718,9 +622,7 @@ TEST(PicturePileImplTest, PixelRefIteratorLazyRefsBaseNonLazy) { } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 256, 256), - 0.5, - pile); + gfx::Rect(0, 0, 256, 256), 0.5, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[0][0].pixelRef()); EXPECT_TRUE(++iterator); @@ -783,27 +685,21 @@ TEST(PicturePileImplTest, PixelRefIteratorMultiplePictures) { // These should find only one pixel ref. { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 0, 128, 128), - 1.0, - pile); + gfx::Rect(0, 0, 128, 128), 1.0, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[0][0].pixelRef()); EXPECT_FALSE(++iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(128, 0, 128, 128), - 1.0, - pile); + gfx::Rect(128, 0, 128, 128), 1.0, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[0][1].pixelRef()); EXPECT_FALSE(++iterator); } { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(128, 128, 128, 128), - 1.0, - pile); + gfx::Rect(128, 128, 128, 128), 1.0, pile.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[1][1].pixelRef()); EXPECT_FALSE(++iterator); @@ -811,9 +707,7 @@ TEST(PicturePileImplTest, PixelRefIteratorMultiplePictures) { // This one should not find any refs { PicturePileImpl::PixelRefIterator iterator( - gfx::Rect(0, 128, 128, 128), - 1.0, - pile); + gfx::Rect(0, 128, 128, 128), 1.0, pile.get()); EXPECT_FALSE(iterator); } } diff --git a/cc/resources/picture_unittest.cc b/cc/resources/picture_unittest.cc index e63da16..e231778 100644 --- a/cc/resources/picture_unittest.cc +++ b/cc/resources/picture_unittest.cc @@ -44,7 +44,7 @@ TEST(PictureTest, AsBase64String) { tmp.reset(new base::StringValue("abc!@#$%")); scoped_refptr<Picture> invalid_picture = Picture::CreateFromValue(tmp.get()); - EXPECT_TRUE(!invalid_picture); + EXPECT_TRUE(!invalid_picture.get()); // Single full-size rect picture. content_layer_client.add_draw_rect(layer_rect, red_paint); @@ -56,7 +56,7 @@ TEST(PictureTest, AsBase64String) { // Reconstruct the picture. scoped_refptr<Picture> one_rect_picture_check = Picture::CreateFromValue(serialized_one_rect.get()); - EXPECT_TRUE(!!one_rect_picture_check); + EXPECT_TRUE(!!one_rect_picture_check.get()); // Check for equivalence. unsigned char one_rect_buffer[4 * 100 * 100] = {0}; @@ -82,7 +82,7 @@ TEST(PictureTest, AsBase64String) { // Reconstruct the picture. scoped_refptr<Picture> two_rect_picture_check = Picture::CreateFromValue(serialized_two_rect.get()); - EXPECT_TRUE(!!two_rect_picture_check); + EXPECT_TRUE(!!two_rect_picture_check.get()); // Check for equivalence. unsigned char two_rect_buffer[4 * 100 * 100] = {0}; @@ -141,9 +141,8 @@ TEST(PictureTest, PixelRefIterator) { } for (int y = 0; y < 4; ++y) { for (int x = 0; x < 4; ++x) { - Picture::PixelRefIterator iterator( - gfx::Rect(x * 512, y * 512, 500, 500), - picture); + Picture::PixelRefIterator iterator(gfx::Rect(x * 512, y * 512, 500, 500), + picture.get()); if ((x + y) & 1) { EXPECT_TRUE(iterator) << x << " " << y; EXPECT_TRUE(*iterator == lazy_bitmap[y][x].pixelRef()) << x << " " << y; @@ -155,9 +154,8 @@ TEST(PictureTest, PixelRefIterator) { } // Capture 4 pixel refs. { - Picture::PixelRefIterator iterator( - gfx::Rect(512, 512, 2048, 2048), - picture); + Picture::PixelRefIterator iterator(gfx::Rect(512, 512, 2048, 2048), + picture.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[1][2].pixelRef()); EXPECT_TRUE(++iterator); @@ -170,9 +168,8 @@ TEST(PictureTest, PixelRefIterator) { } // Copy test. - Picture::PixelRefIterator iterator( - gfx::Rect(512, 512, 2048, 2048), - picture); + Picture::PixelRefIterator iterator(gfx::Rect(512, 512, 2048, 2048), + picture.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[1][2].pixelRef()); EXPECT_TRUE(++iterator); @@ -240,8 +237,7 @@ TEST(PictureTest, PixelRefIteratorNonZeroLayer) { for (int y = 0; y < 4; ++y) { for (int x = 0; x < 4; ++x) { Picture::PixelRefIterator iterator( - gfx::Rect(1024 + x * 512, y * 512, 500, 500), - picture); + gfx::Rect(1024 + x * 512, y * 512, 500, 500), picture.get()); if ((x + y) & 1) { EXPECT_TRUE(iterator) << x << " " << y; EXPECT_TRUE(*iterator == lazy_bitmap[y][x].pixelRef()); @@ -253,9 +249,8 @@ TEST(PictureTest, PixelRefIteratorNonZeroLayer) { } // Capture 4 pixel refs. { - Picture::PixelRefIterator iterator( - gfx::Rect(1024 + 512, 512, 2048, 2048), - picture); + Picture::PixelRefIterator iterator(gfx::Rect(1024 + 512, 512, 2048, 2048), + picture.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[1][2].pixelRef()); EXPECT_TRUE(++iterator); @@ -269,9 +264,8 @@ TEST(PictureTest, PixelRefIteratorNonZeroLayer) { // Copy test. { - Picture::PixelRefIterator iterator( - gfx::Rect(1024 + 512, 512, 2048, 2048), - picture); + Picture::PixelRefIterator iterator(gfx::Rect(1024 + 512, 512, 2048, 2048), + picture.get()); EXPECT_TRUE(iterator); EXPECT_TRUE(*iterator == lazy_bitmap[1][2].pixelRef()); EXPECT_TRUE(++iterator); @@ -297,27 +291,23 @@ TEST(PictureTest, PixelRefIteratorNonZeroLayer) { // Non intersecting rects { - Picture::PixelRefIterator iterator( - gfx::Rect(0, 0, 1000, 1000), - picture); + Picture::PixelRefIterator iterator(gfx::Rect(0, 0, 1000, 1000), + picture.get()); EXPECT_FALSE(iterator); } { - Picture::PixelRefIterator iterator( - gfx::Rect(3500, 0, 1000, 1000), - picture); + Picture::PixelRefIterator iterator(gfx::Rect(3500, 0, 1000, 1000), + picture.get()); EXPECT_FALSE(iterator); } { - Picture::PixelRefIterator iterator( - gfx::Rect(0, 1100, 1000, 1000), - picture); + Picture::PixelRefIterator iterator(gfx::Rect(0, 1100, 1000, 1000), + picture.get()); EXPECT_FALSE(iterator); } { - Picture::PixelRefIterator iterator( - gfx::Rect(3500, 1100, 1000, 1000), - picture); + Picture::PixelRefIterator iterator(gfx::Rect(3500, 1100, 1000, 1000), + picture.get()); EXPECT_FALSE(iterator); } } @@ -361,8 +351,7 @@ TEST(PictureTest, PixelRefIteratorOnePixelQuery) { for (int y = 0; y < 4; ++y) { for (int x = 0; x < 4; ++x) { Picture::PixelRefIterator iterator( - gfx::Rect(x * 512, y * 512 + 256, 1, 1), - picture); + gfx::Rect(x * 512, y * 512 + 256, 1, 1), picture.get()); if ((x + y) & 1) { EXPECT_TRUE(iterator) << x << " " << y; EXPECT_TRUE(*iterator == lazy_bitmap[y][x].pixelRef()); diff --git a/cc/resources/raster_worker_pool.cc b/cc/resources/raster_worker_pool.cc index a078fb0..dcfb6471 100644 --- a/cc/resources/raster_worker_pool.cc +++ b/cc/resources/raster_worker_pool.cc @@ -59,7 +59,7 @@ class RasterWorkerPoolPictureTaskImpl : public internal::WorkerPoolTask { picture_pile_(picture_pile), callback_(callback), reply_(reply) { - DCHECK(picture_pile_); + DCHECK(picture_pile_.get()); } // Overridden from internal::WorkerPoolTask: diff --git a/cc/resources/raster_worker_pool.h b/cc/resources/raster_worker_pool.h index 98032dd..1a20c5c 100644 --- a/cc/resources/raster_worker_pool.h +++ b/cc/resources/raster_worker_pool.h @@ -40,7 +40,7 @@ class CC_EXPORT RasterWorkerPool : public WorkerPool { ~Task(); // Returns true if Task is null (doesn't refer to anything). - bool is_null() const { return !internal_; } + bool is_null() const { return !internal_.get(); } // Returns the Task into an uninitialized state. void Reset(); diff --git a/cc/resources/resource_provider.h b/cc/resources/resource_provider.h index b4c8c92..124f977 100644 --- a/cc/resources/resource_provider.h +++ b/cc/resources/resource_provider.h @@ -318,7 +318,7 @@ class CC_EXPORT ResourceProvider { void SetReadLockFence(scoped_refptr<Fence> fence) { current_read_lock_fence_ = fence; } - Fence* GetReadLockFence() { return current_read_lock_fence_; } + Fence* GetReadLockFence() { return current_read_lock_fence_.get(); } // Enable read lock fences for a specific resource. void EnableReadLockFences(ResourceProvider::ResourceId id, bool enable); @@ -377,8 +377,8 @@ class CC_EXPORT ResourceProvider { typedef base::hash_map<int, Child> ChildMap; bool ReadLockFenceHasPassed(Resource* resource) { - return !resource->read_lock_fence || - resource->read_lock_fence->HasPassed(); + return !resource->read_lock_fence.get() || + resource->read_lock_fence->HasPassed(); } explicit ResourceProvider(OutputSurface* output_surface); diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc index 3579e37..0a1f2e0 100644 --- a/cc/resources/tile_manager.cc +++ b/cc/resources/tile_manager.cc @@ -322,7 +322,7 @@ void TileManager::ManageTiles() { void TileManager::CheckForCompletedTileUploads() { while (!tiles_with_pending_upload_.empty()) { - Tile* tile = tiles_with_pending_upload_.front(); + Tile* tile = tiles_with_pending_upload_.front().get(); DCHECK(tile->tile_version().resource_); // Set pixel tasks complete in the order they are posted. @@ -351,7 +351,7 @@ void TileManager::CheckForCompletedTileUploads() { void TileManager::AbortPendingTileUploads() { while (!tiles_with_pending_upload_.empty()) { - Tile* tile = tiles_with_pending_upload_.front(); + Tile* tile = tiles_with_pending_upload_.front().get(); DCHECK(tile->tile_version().resource_); resource_pool_->resource_provider()->AbortSetPixels( @@ -838,7 +838,7 @@ void TileManager::OnRasterTaskCompleted( tile->tile_version().set_solid_color(analysis->solid_color); resource_pool_->resource_provider()->ReleasePixelBuffer(resource->id()); resource_pool_->ReleaseResource(resource.Pass()); - DidFinishTileInitialization(tile); + DidFinishTileInitialization(tile.get()); return; } @@ -852,7 +852,7 @@ void TileManager::OnRasterTaskCompleted( if (tile->required_for_activation() && client_->ShouldForceTileUploadsRequiredForActivationToComplete()) - ForceTileUploadToComplete(tile); + ForceTileUploadToComplete(tile.get()); } void TileManager::DidFinishTileInitialization(Tile* tile) { diff --git a/cc/resources/video_resource_updater.cc b/cc/resources/video_resource_updater.cc index 5622b86..45f86b0 100644 --- a/cc/resources/video_resource_updater.cc +++ b/cc/resources/video_resource_updater.cc @@ -217,7 +217,7 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes( { ResourceProvider::ScopedWriteLockSoftware lock( resource_provider_, plane_resources[0].resource_id); - video_renderer_->Paint(video_frame, + video_renderer_->Paint(video_frame.get(), lock.sk_canvas(), video_frame->visible_rect(), 0xff); diff --git a/cc/test/fake_layer_tree_host_client.cc b/cc/test/fake_layer_tree_host_client.cc index d5e1a8d..26ae8ab 100644 --- a/cc/test/fake_layer_tree_host_client.cc +++ b/cc/test/fake_layer_tree_host_client.cc @@ -44,7 +44,7 @@ scoped_ptr<OutputSurface> FakeLayerTreeHostClient::CreateOutputSurface() { scoped_refptr<cc::ContextProvider> FakeLayerTreeHostClient:: OffscreenContextProviderForMainThread() { - if (!main_thread_contexts_ || + if (!main_thread_contexts_.get() || main_thread_contexts_->DestroyedOnMainThread()) { main_thread_contexts_ = FakeContextProvider::Create(); if (!main_thread_contexts_->BindToCurrentThread()) @@ -55,7 +55,7 @@ scoped_refptr<cc::ContextProvider> FakeLayerTreeHostClient:: scoped_refptr<cc::ContextProvider> FakeLayerTreeHostClient:: OffscreenContextProviderForCompositorThread() { - if (!compositor_thread_contexts_ || + if (!compositor_thread_contexts_.get() || compositor_thread_contexts_->DestroyedOnMainThread()) compositor_thread_contexts_ = FakeContextProvider::Create(); return compositor_thread_contexts_; diff --git a/cc/test/layer_tree_pixel_test.cc b/cc/test/layer_tree_pixel_test.cc index 384eaec..3c67e54 100644 --- a/cc/test/layer_tree_pixel_test.cc +++ b/cc/test/layer_tree_pixel_test.cc @@ -44,7 +44,7 @@ scoped_refptr<cc::ContextProvider> LayerTreePixelTest::OffscreenContextProviderForCompositorThread() { scoped_refptr<webkit::gpu::ContextProviderInProcess> provider = webkit::gpu::ContextProviderInProcess::Create(); - CHECK(provider); + CHECK(provider.get()); return provider; } diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc index ef007df..4ae5248 100644 --- a/cc/test/layer_tree_test.cc +++ b/cc/test/layer_tree_test.cc @@ -588,7 +588,7 @@ scoped_ptr<OutputSurface> LayerTreeTest::CreateOutputSurface() { scoped_refptr<cc::ContextProvider> LayerTreeTest:: OffscreenContextProviderForMainThread() { - if (!main_thread_contexts_ || + if (!main_thread_contexts_.get() || main_thread_contexts_->DestroyedOnMainThread()) { main_thread_contexts_ = FakeContextProvider::Create(); if (!main_thread_contexts_->BindToCurrentThread()) @@ -599,7 +599,7 @@ scoped_refptr<cc::ContextProvider> LayerTreeTest:: scoped_refptr<cc::ContextProvider> LayerTreeTest:: OffscreenContextProviderForCompositorThread() { - if (!compositor_thread_contexts_ || + if (!compositor_thread_contexts_.get() || compositor_thread_contexts_->DestroyedOnMainThread()) compositor_thread_contexts_ = FakeContextProvider::Create(); return compositor_thread_contexts_; diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index 966ff9d..bb4f0c1 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc @@ -132,7 +132,7 @@ bool LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) { LayerTreeHost::~LayerTreeHost() { TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); - if (root_layer_) + if (root_layer_.get()) root_layer_->SetLayerTreeHost(NULL); if (proxy_) { @@ -145,7 +145,7 @@ LayerTreeHost::~LayerTreeHost() { if (it != rate_limiters_.end()) it->second->Stop(); - if (root_layer_) { + if (root_layer_.get()) { // The layer tree must be destroyed before the layer tree host. We've // made a contract with our animation controllers that the registrar // will outlive them, and we must make good. @@ -297,7 +297,7 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) { sync_tree->set_needs_full_tree_sync(needs_full_tree_sync_); needs_full_tree_sync_ = false; - if (root_layer_ && hud_layer_) { + if (root_layer_.get() && hud_layer_.get()) { LayerImpl* hud_impl = LayerTreeHostCommon::FindLayerInSubtree( sync_tree->root_layer(), hud_layer_->id()); sync_tree->set_hud_layer(static_cast<HeadsUpDisplayLayerImpl*>(hud_impl)); @@ -368,12 +368,12 @@ void LayerTreeHost::WillCommit() { void LayerTreeHost::UpdateHudLayer() { if (debug_state_.ShowHudInfo()) { - if (!hud_layer_) + if (!hud_layer_.get()) hud_layer_ = HeadsUpDisplayLayer::Create(); - if (root_layer_ && !hud_layer_->parent()) + if (root_layer_.get() && !hud_layer_->parent()) root_layer_->AddChild(hud_layer_); - } else if (hud_layer_) { + } else if (hud_layer_.get()) { hud_layer_->RemoveFromParent(); hud_layer_ = NULL; } @@ -526,16 +526,16 @@ void LayerTreeHost::SetAnimationEvents(scoped_ptr<AnimationEventsVector> events, } void LayerTreeHost::SetRootLayer(scoped_refptr<Layer> root_layer) { - if (root_layer_ == root_layer) + if (root_layer_.get() == root_layer.get()) return; - if (root_layer_) + if (root_layer_.get()) root_layer_->SetLayerTreeHost(NULL); root_layer_ = root_layer; - if (root_layer_) + if (root_layer_.get()) root_layer_->SetLayerTreeHost(this); - if (hud_layer_) + if (hud_layer_.get()) hud_layer_->RemoveFromParent(); SetNeedsFullTreeSync(); @@ -955,7 +955,7 @@ bool LayerTreeHost::PaintLayerContents( } void LayerTreeHost::ApplyScrollAndScale(const ScrollAndScaleSet& info) { - if (!root_layer_) + if (!root_layer_.get()) return; Layer* root_scroll_layer = FindFirstScrollableLayer(root_layer_.get()); @@ -1040,7 +1040,7 @@ void LayerTreeHost::UpdateTopControlsState(TopControlsState constraints, } bool LayerTreeHost::BlocksPendingCommit() const { - if (!root_layer_) + if (!root_layer_.get()) return false; return root_layer_->BlocksPendingCommitRecursive(); } diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc index 71d28a9..aa9c7f0 100644 --- a/cc/trees/layer_tree_host_common_unittest.cc +++ b/cc/trees/layer_tree_host_common_unittest.cc @@ -7598,21 +7598,21 @@ class LCDTextTest : public testing::TestWithParam<LCDTextTestParam> { root_->AddChild(child_.get()); gfx::Transform identity_matrix; - SetLayerPropertiesForTesting(root_, + SetLayerPropertiesForTesting(root_.get(), identity_matrix, identity_matrix, gfx::PointF(), gfx::PointF(), gfx::Size(1, 1), false); - SetLayerPropertiesForTesting(child_, + SetLayerPropertiesForTesting(child_.get(), identity_matrix, identity_matrix, gfx::PointF(), gfx::PointF(), gfx::Size(1, 1), false); - SetLayerPropertiesForTesting(grand_child_, + SetLayerPropertiesForTesting(grand_child_.get(), identity_matrix, identity_matrix, gfx::PointF(), @@ -7632,7 +7632,8 @@ class LCDTextTest : public testing::TestWithParam<LCDTextTestParam> { TEST_P(LCDTextTest, CanUseLCDText) { // Case 1: Identity transform. gfx::Transform identity_matrix; - ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_); + ExecuteCalculateDrawProperties( + root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_); EXPECT_EQ(can_use_lcd_text_, root_->can_use_lcd_text()); EXPECT_EQ(can_use_lcd_text_, child_->can_use_lcd_text()); EXPECT_EQ(can_use_lcd_text_, grand_child_->can_use_lcd_text()); @@ -7641,7 +7642,8 @@ TEST_P(LCDTextTest, CanUseLCDText) { gfx::Transform integral_translation; integral_translation.Translate(1.0, 2.0); child_->SetTransform(integral_translation); - ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_); + ExecuteCalculateDrawProperties( + root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_); EXPECT_EQ(can_use_lcd_text_, root_->can_use_lcd_text()); EXPECT_EQ(can_use_lcd_text_, child_->can_use_lcd_text()); EXPECT_EQ(can_use_lcd_text_, grand_child_->can_use_lcd_text()); @@ -7650,7 +7652,8 @@ TEST_P(LCDTextTest, CanUseLCDText) { gfx::Transform non_integral_translation; non_integral_translation.Translate(1.5, 2.5); child_->SetTransform(non_integral_translation); - ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_); + ExecuteCalculateDrawProperties( + root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_); EXPECT_EQ(can_use_lcd_text_, root_->can_use_lcd_text()); EXPECT_FALSE(child_->can_use_lcd_text()); EXPECT_FALSE(grand_child_->can_use_lcd_text()); @@ -7659,7 +7662,8 @@ TEST_P(LCDTextTest, CanUseLCDText) { gfx::Transform rotation; rotation.Rotate(10.0); child_->SetTransform(rotation); - ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_); + ExecuteCalculateDrawProperties( + root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_); EXPECT_EQ(can_use_lcd_text_, root_->can_use_lcd_text()); EXPECT_FALSE(child_->can_use_lcd_text()); EXPECT_FALSE(grand_child_->can_use_lcd_text()); @@ -7668,7 +7672,8 @@ TEST_P(LCDTextTest, CanUseLCDText) { gfx::Transform scale; scale.Scale(2.0, 2.0); child_->SetTransform(scale); - ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_); + ExecuteCalculateDrawProperties( + root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_); EXPECT_EQ(can_use_lcd_text_, root_->can_use_lcd_text()); EXPECT_FALSE(child_->can_use_lcd_text()); EXPECT_FALSE(grand_child_->can_use_lcd_text()); @@ -7677,7 +7682,8 @@ TEST_P(LCDTextTest, CanUseLCDText) { gfx::Transform skew; skew.SkewX(10.0); child_->SetTransform(skew); - ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_); + ExecuteCalculateDrawProperties( + root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_); EXPECT_EQ(can_use_lcd_text_, root_->can_use_lcd_text()); EXPECT_FALSE(child_->can_use_lcd_text()); EXPECT_FALSE(grand_child_->can_use_lcd_text()); @@ -7685,7 +7691,8 @@ TEST_P(LCDTextTest, CanUseLCDText) { // Case 7: Translucent. child_->SetTransform(identity_matrix); child_->SetOpacity(0.5f); - ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_); + ExecuteCalculateDrawProperties( + root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_); EXPECT_EQ(can_use_lcd_text_, root_->can_use_lcd_text()); EXPECT_FALSE(child_->can_use_lcd_text()); EXPECT_FALSE(grand_child_->can_use_lcd_text()); @@ -7693,7 +7700,8 @@ TEST_P(LCDTextTest, CanUseLCDText) { // Case 8: Sanity check: restore transform and opacity. child_->SetTransform(identity_matrix); child_->SetOpacity(1.f); - ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_); + ExecuteCalculateDrawProperties( + root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_); EXPECT_EQ(can_use_lcd_text_, root_->can_use_lcd_text()); EXPECT_EQ(can_use_lcd_text_, child_->can_use_lcd_text()); EXPECT_EQ(can_use_lcd_text_, grand_child_->can_use_lcd_text()); @@ -7701,7 +7709,8 @@ TEST_P(LCDTextTest, CanUseLCDText) { TEST_P(LCDTextTest, verifycan_use_lcd_textWithAnimation) { // Sanity check: Make sure can_use_lcd_text_ is set on each node. - ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_); + ExecuteCalculateDrawProperties( + root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_); EXPECT_EQ(can_use_lcd_text_, root_->can_use_lcd_text()); EXPECT_EQ(can_use_lcd_text_, child_->can_use_lcd_text()); EXPECT_EQ(can_use_lcd_text_, grand_child_->can_use_lcd_text()); @@ -7711,7 +7720,8 @@ TEST_P(LCDTextTest, verifycan_use_lcd_textWithAnimation) { AddOpacityTransitionToController( child_->layer_animation_controller(), 10.0, 0.9f, 0.1f, false); - ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_); + ExecuteCalculateDrawProperties( + root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_); // Text AA should not be adjusted while animation is active. // Make sure LCD text AA setting remains unchanged. EXPECT_EQ(can_use_lcd_text_, root_->can_use_lcd_text()); diff --git a/cc/trees/layer_tree_host_perftest.cc b/cc/trees/layer_tree_host_perftest.cc index ca24016..73c0540 100644 --- a/cc/trees/layer_tree_host_perftest.cc +++ b/cc/trees/layer_tree_host_perftest.cc @@ -152,7 +152,7 @@ class ScrollingLayerTreePerfTest : public LayerTreeHostPerfTestJsonReader { virtual void BuildTree() OVERRIDE { LayerTreeHostPerfTestJsonReader::BuildTree(); scrollable_ = layer_tree_host()->root_layer()->children()[1]; - ASSERT_TRUE(scrollable_); + ASSERT_TRUE(scrollable_.get()); } virtual void Layout() OVERRIDE { diff --git a/cc/trees/layer_tree_host_pixeltest_masks.cc b/cc/trees/layer_tree_host_pixeltest_masks.cc index 16cbd8d..ff3555d 100644 --- a/cc/trees/layer_tree_host_pixeltest_masks.cc +++ b/cc/trees/layer_tree_host_pixeltest_masks.cc @@ -55,7 +55,7 @@ TEST_F(LayerTreeHostMasksPixelTest, MaskOfLayer) { mask->SetBounds(gfx::Size(100, 100)); mask->SetIsDrawable(true); mask->SetIsMask(true); - green->SetMaskLayer(mask); + green->SetMaskLayer(mask.get()); RunPixelTest(background, base::FilePath(FILE_PATH_LITERAL( @@ -84,7 +84,7 @@ TEST_F(LayerTreeHostMasksPixelTest, ImageMaskOfLayer) { scoped_refptr<SolidColorLayer> green = CreateSolidColorLayerWithBorder( gfx::Rect(50, 50, 100, 100), kCSSGreen, 1, SK_ColorBLACK); - green->SetMaskLayer(mask); + green->SetMaskLayer(mask.get()); background->AddChild(green); RunPixelTest(background, @@ -113,7 +113,7 @@ TEST_F(LayerTreeHostMasksPixelTest, MaskOfClippedLayer) { mask->SetBounds(gfx::Size(100, 100)); mask->SetIsDrawable(true); mask->SetIsMask(true); - green->SetMaskLayer(mask); + green->SetMaskLayer(mask.get()); RunPixelTest(background, base::FilePath(FILE_PATH_LITERAL( @@ -133,7 +133,7 @@ TEST_F(LayerTreeHostMasksPixelTest, MaskWithReplica) { scoped_refptr<SolidColorLayer> green = CreateSolidColorLayerWithBorder( gfx::Rect(0, 0, 100, 100), kCSSGreen, 1, SK_ColorBLACK); background->AddChild(green); - green->SetMaskLayer(mask); + green->SetMaskLayer(mask.get()); gfx::Transform replica_transform; replica_transform.Rotate(-90.0); @@ -142,7 +142,7 @@ TEST_F(LayerTreeHostMasksPixelTest, MaskWithReplica) { replica->SetAnchorPoint(gfx::PointF(0.5f, 0.5f)); replica->SetPosition(gfx::Point(100, 100)); replica->SetTransform(replica_transform); - green->SetReplicaLayer(replica); + green->SetReplicaLayer(replica.get()); RunPixelTest(background, base::FilePath(FILE_PATH_LITERAL( @@ -171,7 +171,7 @@ TEST_F(LayerTreeHostMasksPixelTest, MaskWithReplicaOfClippedLayer) { scoped_refptr<SolidColorLayer> green = CreateSolidColorLayerWithBorder( gfx::Rect(0, -50, 100, 100), kCSSGreen, 1, SK_ColorBLACK); clip->AddChild(green); - green->SetMaskLayer(mask); + green->SetMaskLayer(mask.get()); gfx::Transform replica_transform; replica_transform.Rotate(-90.0); @@ -180,7 +180,7 @@ TEST_F(LayerTreeHostMasksPixelTest, MaskWithReplicaOfClippedLayer) { replica->SetAnchorPoint(gfx::PointF(0.5f, 0.5f)); replica->SetPosition(gfx::Point(100, 100)); replica->SetTransform(replica_transform); - green->SetReplicaLayer(replica); + green->SetReplicaLayer(replica.get()); RunPixelTest(background, base::FilePath(FILE_PATH_LITERAL( @@ -213,8 +213,8 @@ TEST_F(LayerTreeHostMasksPixelTest, MaskOfReplica) { replica->SetAnchorPoint(gfx::PointF(1.f, 1.f)); replica->SetPosition(gfx::Point()); replica->SetTransform(replica_transform); - replica->SetMaskLayer(mask); - green->SetReplicaLayer(replica); + replica->SetMaskLayer(mask.get()); + green->SetReplicaLayer(replica.get()); RunPixelTest(background, base::FilePath(FILE_PATH_LITERAL( @@ -255,8 +255,8 @@ TEST_F(LayerTreeHostMasksPixelTest, MaskOfReplicaOfClippedLayer) { replica->SetAnchorPoint(gfx::PointF(1.f, 1.f)); replica->SetPosition(gfx::Point()); replica->SetTransform(replica_transform); - replica->SetMaskLayer(mask); - green->SetReplicaLayer(replica); + replica->SetMaskLayer(mask.get()); + green->SetReplicaLayer(replica.get()); RunPixelTest(background, base::FilePath(FILE_PATH_LITERAL( diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc index 43e0b2a..93ffb2e 100644 --- a/cc/trees/layer_tree_host_unittest_animation.cc +++ b/cc/trees/layer_tree_host_unittest_animation.cc @@ -305,7 +305,7 @@ class LayerTreeHostAnimationTestAddAnimationWithTimingFunction } virtual void BeginTest() OVERRIDE { - PostAddAnimationToMainThread(content_); + PostAddAnimationToMainThread(content_.get()); } virtual void AnimateLayers( @@ -369,7 +369,7 @@ class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes } virtual void BeginTest() OVERRIDE { - PostAddAnimationToMainThread(content_); + PostAddAnimationToMainThread(content_.get()); } virtual void notifyAnimationStarted(double time) OVERRIDE { @@ -640,7 +640,7 @@ class LayerTreeHostAnimationTestRunAnimationWhenNotCanDraw virtual void BeginTest() OVERRIDE { layer_tree_host()->SetViewportSize(gfx::Size()); - PostAddAnimationToMainThread(content_); + PostAddAnimationToMainThread(content_.get()); } virtual void notifyAnimationStarted(double wall_clock_time) OVERRIDE { @@ -681,7 +681,7 @@ class LayerTreeHostAnimationTestRunAnimationWhenNotVisible virtual void BeginTest() OVERRIDE { visible_ = true; - PostAddAnimationToMainThread(content_); + PostAddAnimationToMainThread(content_.get()); } virtual void DidCommit() OVERRIDE { @@ -762,12 +762,12 @@ class LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations switch (layer_tree_host()->commit_number()) { case 1: // The animation is longer than 1 BeginFrame interval. - AddOpacityTransitionToLayer(content_, 0.1, 0.2f, 0.8f, false); + AddOpacityTransitionToLayer(content_.get(), 0.1, 0.2f, 0.8f, false); added_animations_++; break; case 2: // This second animation will not be drawn so it should not start. - AddAnimatedTransformToLayer(content_, 0.1, 5, 5); + AddAnimatedTransformToLayer(content_.get(), 0.1, 5, 5); added_animations_++; break; } diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc index 3103e0d..3b489eb 100644 --- a/cc/trees/layer_tree_host_unittest_context.cc +++ b/cc/trees/layer_tree_host_unittest_context.cc @@ -137,12 +137,12 @@ class LayerTreeHostContextTest : public LayerTreeTest { OffscreenContextProviderForMainThread() OVERRIDE { DCHECK(!ImplThread()); - if (!offscreen_contexts_main_thread_ || + if (!offscreen_contexts_main_thread_.get() || offscreen_contexts_main_thread_->DestroyedOnMainThread()) { offscreen_contexts_main_thread_ = FakeContextProvider::Create( base::Bind(&LayerTreeHostContextTest::CreateOffscreenContext3d, base::Unretained(this))); - if (offscreen_contexts_main_thread_ && + if (offscreen_contexts_main_thread_.get() && !offscreen_contexts_main_thread_->BindToCurrentThread()) offscreen_contexts_main_thread_ = NULL; } @@ -153,7 +153,7 @@ class LayerTreeHostContextTest : public LayerTreeTest { OffscreenContextProviderForCompositorThread() OVERRIDE { DCHECK(ImplThread()); - if (!offscreen_contexts_compositor_thread_ || + if (!offscreen_contexts_compositor_thread_.get() || offscreen_contexts_compositor_thread_->DestroyedOnMainThread()) { offscreen_contexts_compositor_thread_ = FakeContextProvider::Create( base::Bind(&LayerTreeHostContextTest::CreateOffscreenContext3d, diff --git a/cc/trees/occlusion_tracker_unittest.cc b/cc/trees/occlusion_tracker_unittest.cc index 0c220c778..09c64ef 100644 --- a/cc/trees/occlusion_tracker_unittest.cc +++ b/cc/trees/occlusion_tracker_unittest.cc @@ -220,7 +220,7 @@ template <typename Types> class OcclusionTrackerTest : public testing::Test { typename Types::ContentLayerType* layer_ptr = layer.get(); SetProperties(layer_ptr, transform, position, bounds); - DCHECK(!root_); + DCHECK(!root_.get()); root_ = Types::PassLayerPtr(&layer); return layer_ptr; } diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc index 7fe1f56..707ace7 100644 --- a/cc/trees/single_thread_proxy.cc +++ b/cc/trees/single_thread_proxy.cc @@ -118,7 +118,7 @@ void SingleThreadProxy::CreateAndInitializeOutputSurface() { if (created_offscreen_context_provider_) { offscreen_context_provider = layer_tree_host_->client()->OffscreenContextProviderForMainThread(); - if (!offscreen_context_provider) { + if (!offscreen_context_provider.get()) { OnOutputSurfaceInitializeAttempted(false); return; } @@ -144,7 +144,7 @@ void SingleThreadProxy::CreateAndInitializeOutputSurface() { layer_tree_host_impl_->resource_provider()-> set_offscreen_context_provider(offscreen_context_provider); - } else if (offscreen_context_provider) { + } else if (offscreen_context_provider.get()) { offscreen_context_provider->VerifyContexts(); } } @@ -386,7 +386,7 @@ bool SingleThreadProxy::CommitAndComposite( layer_tree_host_->needs_offscreen_context()) { offscreen_context_provider = layer_tree_host_->client()->OffscreenContextProviderForMainThread(); - if (offscreen_context_provider) + if (offscreen_context_provider.get()) created_offscreen_context_provider_ = true; } diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc index 7d7a888e..a0feff2 100644 --- a/cc/trees/thread_proxy.cc +++ b/cc/trees/thread_proxy.cc @@ -216,7 +216,7 @@ void ThreadProxy::DoCreateAndInitializeOutputSurface() { if (created_offscreen_context_provider_) { offscreen_context_provider = layer_tree_host_->client()-> OffscreenContextProviderForCompositorThread(); - success = !!offscreen_context_provider; + success = !!offscreen_context_provider.get(); if (!success) { OnOutputSurfaceInitializeAttempted(false, capabilities); return; @@ -730,7 +730,7 @@ void ThreadProxy::BeginFrameOnMainThread( layer_tree_host_->needs_offscreen_context()) { offscreen_context_provider = layer_tree_host_->client()-> OffscreenContextProviderForCompositorThread(); - if (offscreen_context_provider) + if (offscreen_context_provider.get()) created_offscreen_context_provider_ = true; } @@ -782,7 +782,7 @@ void ThreadProxy::StartCommitOnImplThread( return; } - if (offscreen_context_provider) + if (offscreen_context_provider.get()) offscreen_context_provider->BindToCurrentThread(); if (layer_tree_host_impl_->resource_provider()) { layer_tree_host_impl_->resource_provider()-> @@ -1162,7 +1162,7 @@ void ThreadProxy::InitializeOutputSurfaceOnImplThread( *success = layer_tree_host_impl_->InitializeRenderer(output_surface.Pass()); - if (offscreen_context_provider) + if (offscreen_context_provider.get()) offscreen_context_provider->BindToCurrentThread(); if (*success) { @@ -1186,7 +1186,7 @@ void ThreadProxy::InitializeOutputSurfaceOnImplThread( set_offscreen_context_provider(offscreen_context_provider); scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface(); - } else if (offscreen_context_provider) { + } else if (offscreen_context_provider.get()) { offscreen_context_provider->VerifyContexts(); } |