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

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: rebased Created 7 years, 11 months 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
« no previous file with comments | « cc/cc.gyp ('k') | cc/layer_tree_host_unittest_animation.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 } 679 }
680 680
681 virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE 681 virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE
682 { 682 {
683 impl->rootLayer()->setScrollable(true); 683 impl->rootLayer()->setScrollable(true);
684 impl->rootLayer()->setScrollOffset(gfx::Vector2d()); 684 impl->rootLayer()->setScrollOffset(gfx::Vector2d());
685 impl->setPageScaleFactorAndLimits(impl->pageScaleFactor(), 0.5, 2); 685 impl->setPageScaleFactorAndLimits(impl->pageScaleFactor(), 0.5, 2);
686 686
687 // We request animation only once. 687 // We request animation only once.
688 if (!m_animationRequested) { 688 if (!m_animationRequested) {
689 m_mainThreadProxy->postTask(FROM_HERE, base::Bind(&LayerTreeHostTest StartPageScaleAnimation::requestStartPageScaleAnimation, base::Unretained(this)) ); 689 impl->proxy()->mainThread()->postTask(base::Bind(&LayerTreeHostTestS tartPageScaleAnimation::requestStartPageScaleAnimation, base::Unretained(this))) ;
690 m_animationRequested = true; 690 m_animationRequested = true;
691 } 691 }
692 } 692 }
693 693
694 virtual void applyScrollAndScale(gfx::Vector2d scrollDelta, float scale) OVE RRIDE 694 virtual void applyScrollAndScale(gfx::Vector2d scrollDelta, float scale) OVE RRIDE
695 { 695 {
696 gfx::Vector2d offset = m_layerTreeHost->rootLayer()->scrollOffset(); 696 gfx::Vector2d offset = m_layerTreeHost->rootLayer()->scrollOffset();
697 m_layerTreeHost->rootLayer()->setScrollOffset(offset + scrollDelta); 697 m_layerTreeHost->rootLayer()->setScrollOffset(offset + scrollDelta);
698 m_layerTreeHost->setPageScaleFactorAndLimits(scale, 0.5, 2); 698 m_layerTreeHost->setPageScaleFactorAndLimits(scale, 0.5, 2);
699 } 699 }
(...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after
2245 LayerTreeSettings settings; 2245 LayerTreeSettings settings;
2246 settings.maxPartialTextureUpdates = 4; 2246 settings.maxPartialTextureUpdates = 4;
2247 2247
2248 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc oped_ptr<Thread>()); 2248 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc oped_ptr<Thread>());
2249 EXPECT_TRUE(host->initializeRendererIfNeeded()); 2249 EXPECT_TRUE(host->initializeRendererIfNeeded());
2250 EXPECT_EQ(0u, host->settings().maxPartialTextureUpdates); 2250 EXPECT_EQ(0u, host->settings().maxPartialTextureUpdates);
2251 } 2251 }
2252 2252
2253 } // namespace 2253 } // namespace
2254 } // namespace cc 2254 } // namespace cc
OLDNEW
« no previous file with comments | « cc/cc.gyp ('k') | cc/layer_tree_host_unittest_animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698