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

Side by Side Diff: ui/compositor/test/test_context_factory.cc

Issue 45963003: Move test-only ContextFactory implementations out of production targets (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/compositor/test/test_context_factory.h"
6
7 #include "cc/debug/test_context_provider.h"
8 #include "cc/output/output_surface.h"
9 #include "ui/compositor/reflector.h"
10
11 namespace ui {
12
13 TestContextFactory::TestContextFactory() {}
14
15 TestContextFactory::~TestContextFactory() {}
16
17 scoped_ptr<cc::OutputSurface> TestContextFactory::CreateOutputSurface(
18 Compositor* compositor) {
19 return make_scoped_ptr(
20 new cc::OutputSurface(cc::TestContextProvider::Create()));
21 }
22
23 scoped_refptr<Reflector> TestContextFactory::CreateReflector(
24 Compositor* mirrored_compositor,
25 Layer* mirroring_layer) {
26 return new Reflector();
27 }
28
29 void TestContextFactory::RemoveReflector(scoped_refptr<Reflector> reflector) {
30 }
31
32 scoped_refptr<cc::ContextProvider>
33 TestContextFactory::OffscreenCompositorContextProvider() {
34 if (!offscreen_compositor_contexts_.get() ||
35 offscreen_compositor_contexts_->DestroyedOnMainThread())
36 offscreen_compositor_contexts_ = cc::TestContextProvider::Create();
37 return offscreen_compositor_contexts_;
38 }
39
40 scoped_refptr<cc::ContextProvider>
41 TestContextFactory::SharedMainThreadContextProvider() {
42 if (shared_main_thread_contexts_ &&
43 !shared_main_thread_contexts_->DestroyedOnMainThread())
44 return shared_main_thread_contexts_;
45
46 if (ui::Compositor::WasInitializedWithThread()) {
47 shared_main_thread_contexts_ = cc::TestContextProvider::Create();
48 } else {
49 shared_main_thread_contexts_ =
50 static_cast<cc::TestContextProvider*>(
51 OffscreenCompositorContextProvider().get());
52 }
53 if (shared_main_thread_contexts_ &&
54 !shared_main_thread_contexts_->BindToCurrentThread())
55 shared_main_thread_contexts_ = NULL;
56
57 return shared_main_thread_contexts_;
58 }
59
60 void TestContextFactory::RemoveCompositor(Compositor* compositor) {
61 }
62
63 bool TestContextFactory::DoesCreateTestContexts() { return true; }
64
65 } // namespace ui
OLDNEW
« ui/compositor/compositor.cc ('K') | « ui/compositor/test/test_context_factory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698