Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: cc/layer_tree_host_unittest.cc

Issue 11571068: Use WeakPtr for posting cc tasks to main thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use WeakPtr for tasks posted to main thread in ThreadedTests Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layer_tree_host.h" 5 #include "cc/layer_tree_host.h"
6 6
7 #include "base/synchronization/lock.h" 7 #include "base/synchronization/lock.h"
8 #include "cc/content_layer.h" 8 #include "cc/content_layer.h"
9 #include "cc/content_layer_client.h" 9 #include "cc/content_layer_client.h"
10 #include "cc/layer_impl.h" 10 #include "cc/layer_impl.h"
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 } 790 }
791 791
792 virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE 792 virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE
793 { 793 {
794 impl->rootLayer()->setScrollable(true); 794 impl->rootLayer()->setScrollable(true);
795 impl->rootLayer()->setScrollOffset(gfx::Vector2d()); 795 impl->rootLayer()->setScrollOffset(gfx::Vector2d());
796 impl->setPageScaleFactorAndLimits(impl->pageScaleFactor(), 0.5, 2); 796 impl->setPageScaleFactorAndLimits(impl->pageScaleFactor(), 0.5, 2);
797 797
798 // We request animation only once. 798 // We request animation only once.
799 if (!m_animationRequested) { 799 if (!m_animationRequested) {
800 m_mainThreadProxy->postTask(FROM_HERE, base::Bind(&LayerTreeHostTest StartPageScaleAnimation::requestStartPageScaleAnimation, base::Unretained(this)) ); 800 impl->proxy()->mainThread()->postTask(base::Bind(&LayerTreeHostTestS tartPageScaleAnimation::requestStartPageScaleAnimation, base::Unretained(this))) ;
801 m_animationRequested = true; 801 m_animationRequested = true;
802 } 802 }
803 } 803 }
804 804
805 virtual void applyScrollAndScale(gfx::Vector2d scrollDelta, float scale) OVE RRIDE 805 virtual void applyScrollAndScale(gfx::Vector2d scrollDelta, float scale) OVE RRIDE
806 { 806 {
807 gfx::Vector2d offset = m_layerTreeHost->rootLayer()->scrollOffset(); 807 gfx::Vector2d offset = m_layerTreeHost->rootLayer()->scrollOffset();
808 m_layerTreeHost->rootLayer()->setScrollOffset(offset + scrollDelta); 808 m_layerTreeHost->rootLayer()->setScrollOffset(offset + scrollDelta);
809 m_layerTreeHost->setPageScaleFactorAndLimits(scale, 0.5, 2); 809 m_layerTreeHost->setPageScaleFactorAndLimits(scale, 0.5, 2);
810 } 810 }
(...skipping 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after
3099 LayerTreeSettings settings; 3099 LayerTreeSettings settings;
3100 settings.maxPartialTextureUpdates = 4; 3100 settings.maxPartialTextureUpdates = 4;
3101 3101
3102 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc oped_ptr<Thread>()); 3102 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc oped_ptr<Thread>());
3103 EXPECT_TRUE(host->initializeRendererIfNeeded()); 3103 EXPECT_TRUE(host->initializeRendererIfNeeded());
3104 EXPECT_EQ(0u, host->settings().maxPartialTextureUpdates); 3104 EXPECT_EQ(0u, host->settings().maxPartialTextureUpdates);
3105 } 3105 }
3106 3106
3107 } // namespace 3107 } // namespace
3108 } // namespace cc 3108 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698