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

Side by Side Diff: cc/trees/layer_tree_host_unittest_context.cc

Issue 17114008: cc: Remove cc::Thread and cc::ThreadImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rm-thread: NULLrefptrs Created 7 years, 6 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/trees/layer_tree_host_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_scroll.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "cc/base/thread_impl.h"
9 #include "cc/layers/content_layer.h" 8 #include "cc/layers/content_layer.h"
10 #include "cc/layers/heads_up_display_layer.h" 9 #include "cc/layers/heads_up_display_layer.h"
11 #include "cc/layers/io_surface_layer.h" 10 #include "cc/layers/io_surface_layer.h"
12 #include "cc/layers/layer_impl.h" 11 #include "cc/layers/layer_impl.h"
13 #include "cc/layers/picture_layer.h" 12 #include "cc/layers/picture_layer.h"
14 #include "cc/layers/scrollbar_layer.h" 13 #include "cc/layers/scrollbar_layer.h"
15 #include "cc/layers/texture_layer.h" 14 #include "cc/layers/texture_layer.h"
16 #include "cc/layers/texture_layer_impl.h" 15 #include "cc/layers/texture_layer_impl.h"
17 #include "cc/layers/video_layer.h" 16 #include "cc/layers/video_layer.h"
18 #include "cc/layers/video_layer_impl.h" 17 #include "cc/layers/video_layer_impl.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 scoped_ptr<TestWebGraphicsContext3D> offscreen_context3d = 127 scoped_ptr<TestWebGraphicsContext3D> offscreen_context3d =
129 TestWebGraphicsContext3D::Create().Pass(); 128 TestWebGraphicsContext3D::Create().Pass();
130 DCHECK(offscreen_context3d); 129 DCHECK(offscreen_context3d);
131 context3d_->add_share_group_context(offscreen_context3d.get()); 130 context3d_->add_share_group_context(offscreen_context3d.get());
132 131
133 return offscreen_context3d.Pass(); 132 return offscreen_context3d.Pass();
134 } 133 }
135 134
136 virtual scoped_refptr<cc::ContextProvider> 135 virtual scoped_refptr<cc::ContextProvider>
137 OffscreenContextProviderForMainThread() OVERRIDE { 136 OffscreenContextProviderForMainThread() OVERRIDE {
138 DCHECK(!ImplThread()); 137 DCHECK(!HasImplThread());
139 138
140 if (!offscreen_contexts_main_thread_.get() || 139 if (!offscreen_contexts_main_thread_.get() ||
141 offscreen_contexts_main_thread_->DestroyedOnMainThread()) { 140 offscreen_contexts_main_thread_->DestroyedOnMainThread()) {
142 offscreen_contexts_main_thread_ = FakeContextProvider::Create( 141 offscreen_contexts_main_thread_ = FakeContextProvider::Create(
143 base::Bind(&LayerTreeHostContextTest::CreateOffscreenContext3d, 142 base::Bind(&LayerTreeHostContextTest::CreateOffscreenContext3d,
144 base::Unretained(this))); 143 base::Unretained(this)));
145 if (offscreen_contexts_main_thread_.get() && 144 if (offscreen_contexts_main_thread_.get() &&
146 !offscreen_contexts_main_thread_->BindToCurrentThread()) 145 !offscreen_contexts_main_thread_->BindToCurrentThread())
147 offscreen_contexts_main_thread_ = NULL; 146 offscreen_contexts_main_thread_ = NULL;
148 } 147 }
149 return offscreen_contexts_main_thread_; 148 return offscreen_contexts_main_thread_;
150 } 149 }
151 150
152 virtual scoped_refptr<cc::ContextProvider> 151 virtual scoped_refptr<cc::ContextProvider>
153 OffscreenContextProviderForCompositorThread() OVERRIDE { 152 OffscreenContextProviderForCompositorThread() OVERRIDE {
154 DCHECK(ImplThread()); 153 DCHECK(HasImplThread());
155 154
156 if (!offscreen_contexts_compositor_thread_.get() || 155 if (!offscreen_contexts_compositor_thread_.get() ||
157 offscreen_contexts_compositor_thread_->DestroyedOnMainThread()) { 156 offscreen_contexts_compositor_thread_->DestroyedOnMainThread()) {
158 offscreen_contexts_compositor_thread_ = FakeContextProvider::Create( 157 offscreen_contexts_compositor_thread_ = FakeContextProvider::Create(
159 base::Bind(&LayerTreeHostContextTest::CreateOffscreenContext3d, 158 base::Bind(&LayerTreeHostContextTest::CreateOffscreenContext3d,
160 base::Unretained(this))); 159 base::Unretained(this)));
161 } 160 }
162 return offscreen_contexts_compositor_thread_; 161 return offscreen_contexts_compositor_thread_;
163 } 162 }
164 163
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 layer_->SetBounds(gfx::Size(10, 20)); 821 layer_->SetBounds(gfx::Size(10, 20));
823 layer_tree_host()->SetRootLayer(layer_); 822 layer_tree_host()->SetRootLayer(layer_);
824 LayerTreeHostContextTest::SetupTree(); 823 LayerTreeHostContextTest::SetupTree();
825 } 824 }
826 825
827 virtual void BeginTest() OVERRIDE { 826 virtual void BeginTest() OVERRIDE {
828 PostSetNeedsCommitToMainThread(); 827 PostSetNeedsCommitToMainThread();
829 } 828 }
830 829
831 void PostEvictTextures() { 830 void PostEvictTextures() {
832 if (ImplThread()) { 831 if (HasImplThread()) {
833 ImplThread()->PostTask( 832 ImplThreadTaskRunner()->PostTask(
833 FROM_HERE,
834 base::Bind( 834 base::Bind(
835 &LayerTreeHostContextTestLostContextAndEvictTextures:: 835 &LayerTreeHostContextTestLostContextAndEvictTextures::
836 EvictTexturesOnImplThread, 836 EvictTexturesOnImplThread,
837 base::Unretained(this))); 837 base::Unretained(this)));
838 } else { 838 } else {
839 DebugScopedSetImplThread impl(proxy()); 839 DebugScopedSetImplThread impl(proxy());
840 EvictTexturesOnImplThread(); 840 EvictTexturesOnImplThread();
841 } 841 }
842 } 842 }
843 843
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 1569
1570 // FakeLayerTreeHostClient implementation. 1570 // FakeLayerTreeHostClient implementation.
1571 virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE { 1571 virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE {
1572 return scoped_ptr<OutputSurface>(); 1572 return scoped_ptr<OutputSurface>();
1573 } 1573 }
1574 1574
1575 void RunTest(bool threaded, 1575 void RunTest(bool threaded,
1576 bool delegating_renderer, 1576 bool delegating_renderer,
1577 bool impl_side_painting) { 1577 bool impl_side_painting) {
1578 scoped_ptr<base::Thread> impl_thread; 1578 scoped_ptr<base::Thread> impl_thread;
1579 scoped_ptr<cc::Thread> impl_ccthread;
1580 if (threaded) { 1579 if (threaded) {
1581 impl_thread.reset(new base::Thread("LayerTreeTest")); 1580 impl_thread.reset(new base::Thread("LayerTreeTest"));
1582 impl_ccthread = cc::ThreadImpl::CreateForDifferentThread( 1581 ASSERT_TRUE(impl_thread->Start());
1583 impl_thread->message_loop_proxy()); 1582 ASSERT_TRUE(impl_thread->message_loop_proxy());
1584 ASSERT_TRUE(impl_ccthread);
1585 } 1583 }
1586 1584
1587 LayerTreeSettings settings; 1585 LayerTreeSettings settings;
1588 settings.impl_side_painting = impl_side_painting; 1586 settings.impl_side_painting = impl_side_painting;
1589 scoped_ptr<LayerTreeHost> layer_tree_host = 1587 scoped_ptr<LayerTreeHost> layer_tree_host = LayerTreeHost::Create(
1590 LayerTreeHost::Create(this, settings, impl_ccthread.Pass()); 1588 this,
1589 settings,
1590 impl_thread ? impl_thread->message_loop_proxy() : NULL);
1591 EXPECT_FALSE(layer_tree_host); 1591 EXPECT_FALSE(layer_tree_host);
1592 } 1592 }
1593 }; 1593 };
1594 1594
1595 SINGLE_AND_MULTI_THREAD_TEST_F( 1595 SINGLE_AND_MULTI_THREAD_TEST_F(
1596 LayerTreeHostTestCannotCreateIfCannotCreateOutputSurface); 1596 LayerTreeHostTestCannotCreateIfCannotCreateOutputSurface);
1597 1597
1598 } // namespace 1598 } // namespace
1599 } // namespace cc 1599 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_scroll.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698