Commit 0efb94f2 authored by dcheng's avatar dcheng Committed by Commit bot

Remove implicit conversions from scoped_refptr to T* in ui/

This patch was generated by running the rewrite_scoped_refptr clang tool
on a Linux build.

BUG=110610

Review URL: https://codereview.chromium.org/496313004

Cr-Commit-Position: refs/heads/master@{#291764}
parent 1629c184
......@@ -3394,7 +3394,7 @@ TEST_F(WindowTest, WindowDestroyCompletesAnimations) {
// Make sure destroying a Window completes the animation.
{
scoped_ptr<Window> window(CreateTestWindowWithId(1, root_window()));
window->layer()->SetAnimator(animator);
window->layer()->SetAnimator(animator.get());
gfx::Transform transform;
transform.Scale(0.5f, 0.5f);
......@@ -3403,7 +3403,7 @@ TEST_F(WindowTest, WindowDestroyCompletesAnimations) {
EXPECT_TRUE(animator->is_animating());
EXPECT_FALSE(observer.animation_completed());
}
EXPECT_TRUE(animator);
EXPECT_TRUE(animator.get());
EXPECT_FALSE(animator->is_animating());
EXPECT_TRUE(observer.animation_completed());
EXPECT_FALSE(observer.animation_aborted());
......@@ -3413,7 +3413,7 @@ TEST_F(WindowTest, WindowDestroyCompletesAnimations) {
animator = ui::LayerAnimator::CreateImplicitAnimator();
animator->AddObserver(&observer);
ui::Layer layer;
layer.SetAnimator(animator);
layer.SetAnimator(animator.get());
{
scoped_ptr<Window> window(CreateTestWindowWithId(1, root_window()));
window->layer()->Add(&layer);
......@@ -3426,7 +3426,7 @@ TEST_F(WindowTest, WindowDestroyCompletesAnimations) {
EXPECT_FALSE(observer.animation_completed());
}
EXPECT_TRUE(animator);
EXPECT_TRUE(animator.get());
EXPECT_FALSE(animator->is_animating());
EXPECT_TRUE(observer.animation_completed());
EXPECT_FALSE(observer.animation_aborted());
......
......@@ -139,7 +139,7 @@ Compositor::Compositor(gfx::AcceleratedWidget widget,
settings.single_thread_proxy_scheduler = false;
base::TimeTicks before_create = base::TimeTicks::Now();
if (compositor_thread_loop_) {
if (compositor_thread_loop_.get()) {
host_ = cc::LayerTreeHost::CreateThreaded(
this,
context_factory_->GetSharedBitmapManager(),
......@@ -177,7 +177,7 @@ Compositor::~Compositor() {
}
void Compositor::ScheduleDraw() {
if (compositor_thread_loop_) {
if (compositor_thread_loop_.get()) {
host_->SetNeedsCommit();
} else if (!defer_draw_scheduling_) {
defer_draw_scheduling_ = true;
......@@ -206,7 +206,7 @@ void Compositor::SetHostHasTransparentBackground(
}
void Compositor::Draw() {
DCHECK(!compositor_thread_loop_);
DCHECK(!compositor_thread_loop_.get());
defer_draw_scheduling_ = false;
if (waiting_on_compositing_end_) {
......@@ -357,7 +357,7 @@ void Compositor::DidCommitAndDrawFrame() {
}
void Compositor::DidCompleteSwapBuffers() {
if (compositor_thread_loop_) {
if (compositor_thread_loop_.get()) {
NotifyEnd();
} else {
DCHECK_EQ(swap_state_, SWAP_POSTED);
......@@ -376,13 +376,13 @@ void Compositor::ScheduleAnimation() {
}
void Compositor::DidPostSwapBuffers() {
DCHECK(!compositor_thread_loop_);
DCHECK(!compositor_thread_loop_.get());
DCHECK_EQ(swap_state_, SWAP_NONE);
swap_state_ = SWAP_POSTED;
}
void Compositor::DidAbortSwapBuffers() {
if (!compositor_thread_loop_) {
if (!compositor_thread_loop_.get()) {
if (swap_state_ == SWAP_POSTED) {
NotifyEnd();
swap_state_ = SWAP_COMPLETED;
......@@ -406,7 +406,7 @@ void Compositor::SetLayerTreeDebugState(
scoped_refptr<CompositorLock> Compositor::GetCompositorLock() {
if (!compositor_lock_) {
compositor_lock_ = new CompositorLock(this);
if (compositor_thread_loop_)
if (compositor_thread_loop_.get())
host_->SetDeferCommits(true);
FOR_EACH_OBSERVER(CompositorObserver,
observer_list_,
......@@ -418,7 +418,7 @@ scoped_refptr<CompositorLock> Compositor::GetCompositorLock() {
void Compositor::UnlockCompositor() {
DCHECK(compositor_lock_);
compositor_lock_ = NULL;
if (compositor_thread_loop_)
if (compositor_thread_loop_.get())
host_->SetDeferCommits(false);
FOR_EACH_OBSERVER(CompositorObserver,
observer_list_,
......
......@@ -174,7 +174,7 @@ void Layer::Add(Layer* child) {
void Layer::Remove(Layer* child) {
// Current bounds are used to calculate offsets when layers are reparented.
// Stop (and complete) an ongoing animation to update the bounds immediately.
LayerAnimator* child_animator = child->animator_;
LayerAnimator* child_animator = child->animator_.get();
if (child_animator)
child_animator->StopAnimatingProperty(ui::LayerAnimationElement::BOUNDS);
LayerAnimatorCollection* collection = GetLayerAnimatorCollection();
......@@ -530,7 +530,7 @@ void Layer::SetTextureMailbox(
DCHECK(!solid_color_layer_.get());
DCHECK(mailbox.IsValid());
DCHECK(release_callback);
if (!texture_layer_) {
if (!texture_layer_.get()) {
scoped_refptr<cc::TextureLayer> new_layer =
cc::TextureLayer::CreateForMailbox(this);
new_layer->SetFlipped(true);
......@@ -691,7 +691,7 @@ void Layer::OnDeviceScaleFactorChanged(float device_scale_factor) {
}
void Layer::OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) {
DCHECK(delegated_renderer_layer_ || surface_layer_);
DCHECK(delegated_renderer_layer_.get() || surface_layer_.get());
if (!delegate_)
return;
delegate_->OnDelegatedFrameDamage(damage_rect_in_dip);
......@@ -1038,7 +1038,7 @@ void Layer::RemoveAnimatorsInTreeFromCollection(
}
bool Layer::IsAnimating() const {
return animator_ && animator_->is_animating();
return animator_.get() && animator_->is_animating();
}
} // namespace ui
......@@ -653,7 +653,7 @@ TEST_F(LayerWithNullDelegateTest, EscapedDebugNames) {
layer->set_name(name);
scoped_refptr<base::debug::ConvertableToTraceFormat> debug_info =
layer->TakeDebugInfo();
EXPECT_TRUE(!!debug_info);
EXPECT_TRUE(!!debug_info.get());
std::string json;
debug_info->AppendAsTraceFormat(&json);
base::JSONReader json_reader;
......@@ -1375,7 +1375,7 @@ TEST_F(LayerWithDelegateTest, DelegatedLayer) {
// Content matches layer size.
frame_provider = new cc::DelegatedFrameProvider(
resource_collection.get(), MakeFrameData(gfx::Size(10, 10)));
child->SetShowDelegatedContent(frame_provider, gfx::Size(10, 10));
child->SetShowDelegatedContent(frame_provider.get(), gfx::Size(10, 10));
EXPECT_EQ(child->cc_layer()->bounds().ToString(),
gfx::Size(10, 10).ToString());
......@@ -1388,13 +1388,13 @@ TEST_F(LayerWithDelegateTest, DelegatedLayer) {
child->SetBounds(gfx::Rect(0, 0, 10, 10));
frame_provider = new cc::DelegatedFrameProvider(
resource_collection.get(), MakeFrameData(gfx::Size(5, 5)));
child->SetShowDelegatedContent(frame_provider, gfx::Size(5, 5));
child->SetShowDelegatedContent(frame_provider.get(), gfx::Size(5, 5));
EXPECT_EQ(child->cc_layer()->bounds().ToString(), gfx::Size(5, 5).ToString());
// Hi-DPI content on low-DPI layer.
frame_provider = new cc::DelegatedFrameProvider(
resource_collection.get(), MakeFrameData(gfx::Size(20, 20)));
child->SetShowDelegatedContent(frame_provider, gfx::Size(10, 10));
child->SetShowDelegatedContent(frame_provider.get(), gfx::Size(10, 10));
EXPECT_EQ(child->cc_layer()->bounds().ToString(),
gfx::Size(10, 10).ToString());
......@@ -1406,7 +1406,7 @@ TEST_F(LayerWithDelegateTest, DelegatedLayer) {
// Low-DPI content on hi-DPI layer.
frame_provider = new cc::DelegatedFrameProvider(
resource_collection.get(), MakeFrameData(gfx::Size(10, 10)));
child->SetShowDelegatedContent(frame_provider, gfx::Size(10, 10));
child->SetShowDelegatedContent(frame_provider.get(), gfx::Size(10, 10));
EXPECT_EQ(child->cc_layer()->bounds().ToString(),
gfx::Size(10, 10).ToString());
}
......@@ -1423,7 +1423,7 @@ TEST_F(LayerWithDelegateTest, ExternalContent) {
scoped_refptr<cc::Layer> before = child->cc_layer();
child->SetShowPaintedContent();
EXPECT_TRUE(child->cc_layer());
EXPECT_EQ(before, child->cc_layer());
EXPECT_EQ(before.get(), child->cc_layer());
scoped_refptr<cc::DelegatedFrameResourceCollection> resource_collection =
new cc::DelegatedFrameResourceCollection;
......@@ -1433,15 +1433,15 @@ TEST_F(LayerWithDelegateTest, ExternalContent) {
// Showing delegated content changes the underlying cc layer.
before = child->cc_layer();
child->SetShowDelegatedContent(frame_provider, gfx::Size(10, 10));
child->SetShowDelegatedContent(frame_provider.get(), gfx::Size(10, 10));
EXPECT_TRUE(child->cc_layer());
EXPECT_NE(before, child->cc_layer());
EXPECT_NE(before.get(), child->cc_layer());
// Changing to painted content should change the underlying cc layer.
before = child->cc_layer();
child->SetShowPaintedContent();
EXPECT_TRUE(child->cc_layer());
EXPECT_NE(before, child->cc_layer());
EXPECT_NE(before.get(), child->cc_layer());
}
// Tests Layer::AddThreadedAnimation and Layer::RemoveThreadedAnimation.
......@@ -1637,7 +1637,7 @@ TEST(LayerDelegateTest, DelegatedFrameDamage) {
scoped_refptr<cc::DelegatedFrameProvider> frame_provider(
new cc::DelegatedFrameProvider(resource_collection.get(),
MakeFrameData(gfx::Size(10, 10))));
layer->SetShowDelegatedContent(frame_provider, gfx::Size(10, 10));
layer->SetShowDelegatedContent(frame_provider.get(), gfx::Size(10, 10));
EXPECT_FALSE(delegate.delegated_frame_damage_called());
layer->OnDelegatedFrameDamage(damage_rect);
......
......@@ -73,7 +73,7 @@ void InProcessContextFactory::RemoveReflector(
scoped_refptr<cc::ContextProvider>
InProcessContextFactory::SharedMainThreadContextProvider() {
if (shared_main_thread_contexts_ &&
if (shared_main_thread_contexts_.get() &&
!shared_main_thread_contexts_->DestroyedOnMainThread())
return shared_main_thread_contexts_;
......@@ -81,7 +81,7 @@ InProcessContextFactory::SharedMainThreadContextProvider() {
shared_main_thread_contexts_ =
webkit::gpu::ContextProviderInProcess::CreateOffscreen(
lose_context_when_out_of_memory);
if (shared_main_thread_contexts_ &&
if (shared_main_thread_contexts_.get() &&
!shared_main_thread_contexts_->BindToCurrentThread())
shared_main_thread_contexts_ = NULL;
......@@ -99,7 +99,7 @@ cc::SharedBitmapManager* InProcessContextFactory::GetSharedBitmapManager() {
base::MessageLoopProxy* InProcessContextFactory::GetCompositorMessageLoop() {
if (!compositor_thread_)
return NULL;
return compositor_thread_->message_loop_proxy();
return compositor_thread_->message_loop_proxy().get();
}
} // namespace ui
......@@ -33,7 +33,7 @@ bool GLFenceARB::HasCompleted() {
void GLFenceARB::ClientWait() {
DCHECK_EQ(GL_TRUE, glIsSync(sync_));
if (!flush_event_ || flush_event_->IsSignaled()) {
if (!flush_event_.get() || flush_event_->IsSignaled()) {
glClientWaitSync(sync_, GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED);
} else {
LOG(ERROR) << "Trying to wait for uncommitted fence. Skipping...";
......@@ -42,7 +42,7 @@ void GLFenceARB::ClientWait() {
void GLFenceARB::ServerWait() {
DCHECK_EQ(GL_TRUE, glIsSync(sync_));
if (!flush_event_ || flush_event_->IsSignaled()) {
if (!flush_event_.get() || flush_event_->IsSignaled()) {
glWaitSync(sync_, 0, GL_TIMEOUT_IGNORED);
} else {
LOG(ERROR) << "Trying to wait for uncommitted fence. Skipping...";
......
......@@ -32,7 +32,7 @@ bool GLFenceEGL::HasCompleted() {
}
void GLFenceEGL::ClientWait() {
if (!flush_event_ || flush_event_->IsSignaled()) {
if (!flush_event_.get() || flush_event_->IsSignaled()) {
EGLint flags = 0;
EGLTimeKHR time = EGL_FOREVER_KHR;
eglClientWaitSyncKHR(display_, sync_, flags, time);
......@@ -42,7 +42,7 @@ void GLFenceEGL::ClientWait() {
}
void GLFenceEGL::ServerWait() {
if (!flush_event_ || flush_event_->IsSignaled()) {
if (!flush_event_.get() || flush_event_->IsSignaled()) {
EGLint flags = 0;
eglWaitSyncKHR(display_, sync_, flags);
} else {
......
......@@ -37,7 +37,7 @@ bool GLFenceNV::HasCompleted() {
void GLFenceNV::ClientWait() {
DCHECK(glIsFenceNV(fence_));
if (!flush_event_ || flush_event_->IsSignaled()) {
if (!flush_event_.get() || flush_event_->IsSignaled()) {
glFinishFenceNV(fence_);
} else {
LOG(ERROR) << "Trying to wait for uncommitted fence. Skipping...";
......
......@@ -15,7 +15,7 @@ GLImageRefCountedMemory::GLImageRefCountedMemory(const gfx::Size& size,
}
GLImageRefCountedMemory::~GLImageRefCountedMemory() {
DCHECK(!ref_counted_memory_);
DCHECK(!ref_counted_memory_.get());
}
bool GLImageRefCountedMemory::Initialize(
......@@ -23,7 +23,7 @@ bool GLImageRefCountedMemory::Initialize(
if (!HasValidFormat())
return false;
DCHECK(!ref_counted_memory_);
DCHECK(!ref_counted_memory_.get());
ref_counted_memory_ = ref_counted_memory;
GLImageMemory::Initialize(ref_counted_memory_->front());
return true;
......
......@@ -74,7 +74,7 @@ void SnapshotAsync::ScaleCopyOutputResult(
// be used here because it's not in content/public. Move the scaling code
// somewhere so that it can be reused here.
base::PostTaskAndReplyWithResult(
background_task_runner,
background_task_runner.get(),
FROM_HERE,
base::Bind(ScaleBitmap, *result->TakeBitmap(), target_size),
base::Bind(&OnFrameScalingFinished, callback));
......@@ -94,7 +94,7 @@ void SnapshotAsync::EncodeCopyOutputResult(
// be used here because it's not in content/public. Move the scaling code
// somewhere so that it can be reused here.
base::PostTaskAndReplyWithResult(
background_task_runner,
background_task_runner.get(),
FROM_HERE,
base::Bind(EncodeBitmap, *result->TakeBitmap()),
callback);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment