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

Side by Side Diff: cc/test/layer_tree_test.h

Issue 1417053005: cc: Split ThreadProxy into ProxyMain and ProxyImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
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 #ifndef CC_TEST_LAYER_TREE_TEST_H_ 5 #ifndef CC_TEST_LAYER_TREE_TEST_H_
6 #define CC_TEST_LAYER_TREE_TEST_H_ 6 #define CC_TEST_LAYER_TREE_TEST_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "cc/animation/animation_delegate.h" 10 #include "cc/animation/animation_delegate.h"
11 #include "cc/trees/layer_tree_host.h" 11 #include "cc/trees/layer_tree_host.h"
12 #include "cc/trees/layer_tree_host_impl.h" 12 #include "cc/trees/layer_tree_host_impl.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 namespace cc { 15 namespace cc {
16 class AnimationPlayer; 16 class AnimationPlayer;
17 class FakeExternalBeginFrameSource; 17 class FakeExternalBeginFrameSource;
18 class FakeLayerTreeHostClient; 18 class FakeLayerTreeHostClient;
19 class FakeOutputSurface; 19 class FakeOutputSurface;
20 class LayerImpl; 20 class LayerImpl;
21 class LayerTreeHost; 21 class LayerTreeHost;
22 class LayerTreeHostClient; 22 class LayerTreeHostClient;
23 class LayerTreeHostImpl; 23 class LayerTreeHostImpl;
24 class ProxyMain;
25 class ProxyImpl;
24 class TestContextProvider; 26 class TestContextProvider;
25 class TestGpuMemoryBufferManager; 27 class TestGpuMemoryBufferManager;
26 class TestWebGraphicsContext3D; 28 class TestWebGraphicsContext3D;
27 29
28 // Creates the virtual viewport layer hierarchy under the given root_layer. 30 // Creates the virtual viewport layer hierarchy under the given root_layer.
29 // Convenient overload of the method below that creates a scrolling layer as 31 // Convenient overload of the method below that creates a scrolling layer as
30 // the outer viewport scroll layer. 32 // the outer viewport scroll layer.
31 void CreateVirtualViewportLayers(Layer* root_layer, 33 void CreateVirtualViewportLayers(Layer* root_layer,
32 const gfx::Size& inner_bounds, 34 const gfx::Size& inner_bounds,
33 const gfx::Size& outer_bounds, 35 const gfx::Size& outer_bounds,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 virtual void SetInputThrottledUntilCommitOnImpl(bool is_throttled) {} 134 virtual void SetInputThrottledUntilCommitOnImpl(bool is_throttled) {}
133 virtual void SetDeferCommitsOnImpl(bool defer_commits) {} 135 virtual void SetDeferCommitsOnImpl(bool defer_commits) {}
134 virtual void BeginMainFrameAbortedOnImpl(CommitEarlyOutReason reason) {} 136 virtual void BeginMainFrameAbortedOnImpl(CommitEarlyOutReason reason) {}
135 virtual void SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect) {} 137 virtual void SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect) {}
136 virtual void SetNeedsCommitOnImpl() {} 138 virtual void SetNeedsCommitOnImpl() {}
137 virtual void FinishAllRenderingOnImpl() {} 139 virtual void FinishAllRenderingOnImpl() {}
138 virtual void SetVisibleOnImpl(bool visible) {} 140 virtual void SetVisibleOnImpl(bool visible) {}
139 virtual void ReleaseOutputSurfaceOnImpl() {} 141 virtual void ReleaseOutputSurfaceOnImpl() {}
140 virtual void FinishGLOnImpl() {} 142 virtual void FinishGLOnImpl() {}
141 virtual void StartCommitOnImpl() {} 143 virtual void StartCommitOnImpl() {}
142 virtual void InitializeImplOnImpl() {}
143 virtual void WillCloseLayerTreeHostOnImpl() {} 144 virtual void WillCloseLayerTreeHostOnImpl() {}
144 145
145 // Hooks for ProxyMain 146 // Hooks for ProxyMain
146 virtual void ReceivedDidCompleteSwapBuffers() {} 147 virtual void ReceivedDidCompleteSwapBuffers() {}
147 virtual void ReceivedSetRendererCapabilitiesMainCopy( 148 virtual void ReceivedSetRendererCapabilitiesMainCopy(
148 const RendererCapabilities& capabilities) {} 149 const RendererCapabilities& capabilities) {}
149 virtual void ReceivedBeginMainFrameNotExpectedSoon() {} 150 virtual void ReceivedBeginMainFrameNotExpectedSoon() {}
150 virtual void ReceivedDidCommitAndDrawFrame() {} 151 virtual void ReceivedDidCommitAndDrawFrame() {}
151 virtual void ReceivedSetAnimationEvents() {} 152 virtual void ReceivedSetAnimationEvents() {}
152 virtual void ReceivedDidLoseOutputSurface() {} 153 virtual void ReceivedDidLoseOutputSurface() {}
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 void DispatchDidAddAnimation(); 245 void DispatchDidAddAnimation();
245 void DispatchCompositeImmediately(); 246 void DispatchCompositeImmediately();
246 247
247 virtual void AfterTest() = 0; 248 virtual void AfterTest() = 0;
248 virtual void WillBeginTest(); 249 virtual void WillBeginTest();
249 virtual void BeginTest() = 0; 250 virtual void BeginTest() = 0;
250 virtual void SetupTree(); 251 virtual void SetupTree();
251 252
252 virtual void RunTest(bool threaded, bool delegating_renderer); 253 virtual void RunTest(bool threaded, bool delegating_renderer);
253 254
254 bool HasImplThread() { return !!impl_thread_; } 255 bool HasImplThread() const { return !!impl_thread_; }
255 base::SingleThreadTaskRunner* ImplThreadTaskRunner() { 256 base::SingleThreadTaskRunner* ImplThreadTaskRunner() {
256 DCHECK(proxy()); 257 DCHECK(proxy());
257 return proxy()->ImplThreadTaskRunner() ? proxy()->ImplThreadTaskRunner() 258 return proxy()->ImplThreadTaskRunner() ? proxy()->ImplThreadTaskRunner()
258 : main_task_runner_.get(); 259 : main_task_runner_.get();
259 } 260 }
260 base::SingleThreadTaskRunner* MainThreadTaskRunner() { 261 base::SingleThreadTaskRunner* MainThreadTaskRunner() {
261 return main_task_runner_.get(); 262 return main_task_runner_.get();
262 } 263 }
263 Proxy* proxy() const { 264 Proxy* proxy() const {
264 return layer_tree_host_ ? layer_tree_host_->proxy() : NULL; 265 return layer_tree_host_ ? layer_tree_host_->proxy() : NULL;
265 } 266 }
266 TaskGraphRunner* task_graph_runner() const { 267 TaskGraphRunner* task_graph_runner() const {
267 return task_graph_runner_.get(); 268 return task_graph_runner_.get();
268 } 269 }
269 270
270 bool TestEnded() const { return ended_; } 271 bool TestEnded() const { return ended_; }
271 272
272 LayerTreeHost* layer_tree_host(); 273 LayerTreeHost* layer_tree_host();
273 bool delegating_renderer() const { return delegating_renderer_; } 274 bool delegating_renderer() const { return delegating_renderer_; }
274 FakeOutputSurface* output_surface() { return output_surface_; } 275 FakeOutputSurface* output_surface() { return output_surface_; }
275 int LastCommittedSourceFrameNumber(LayerTreeHostImpl* impl) const; 276 int LastCommittedSourceFrameNumber(LayerTreeHostImpl* impl) const;
276 277
278 // Used these only for ProxyMain tests in threaded mode.
Wez 2015/11/10 01:41:50 nit: Used -> Use? If these are only for tests the
Khushal 2015/11/11 04:17:47 I don't think that's necessary. The file itself is
Wez 2015/11/12 22:30:18 OK, acknowledged.
279 ProxyMain* GetProxyMain() const;
280 ProxyImpl* GetProxyImpl() const;
281
277 void DestroyLayerTreeHost(); 282 void DestroyLayerTreeHost();
278 283
279 // By default, output surface recreation is synchronous. 284 // By default, output surface recreation is synchronous.
280 void RequestNewOutputSurface() override; 285 void RequestNewOutputSurface() override;
281 // Override this for pixel tests, where you need a real output surface. 286 // Override this for pixel tests, where you need a real output surface.
282 virtual scoped_ptr<OutputSurface> CreateOutputSurface(); 287 virtual scoped_ptr<OutputSurface> CreateOutputSurface();
283 // Override this for unit tests, which should not produce pixel output. 288 // Override this for unit tests, which should not produce pixel output.
284 virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface(); 289 virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface();
285 290
286 TestWebGraphicsContext3D* TestContext(); 291 TestWebGraphicsContext3D* TestContext();
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ 370 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \
366 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ 371 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \
367 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) 372 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME)
368 373
369 // Some tests want to control when notify ready for activation occurs, 374 // Some tests want to control when notify ready for activation occurs,
370 // but this is not supported in the single-threaded case. 375 // but this is not supported in the single-threaded case.
371 #define MULTI_THREAD_BLOCKNOTIFY_TEST_F(TEST_FIXTURE_NAME) \ 376 #define MULTI_THREAD_BLOCKNOTIFY_TEST_F(TEST_FIXTURE_NAME) \
372 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) 377 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME)
373 378
374 #endif // CC_TEST_LAYER_TREE_TEST_H_ 379 #endif // CC_TEST_LAYER_TREE_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698