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

Unified 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: revert bad ui/base changes Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« ui/compositor/reflector.h ('K') | « ui/compositor/test/test_context_factory.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/test/test_context_factory.cc
diff --git a/ui/compositor/test/test_context_factory.cc b/ui/compositor/test/test_context_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..cc082ac902b5137f3c8199b7e8972c94ada33242
--- /dev/null
+++ b/ui/compositor/test/test_context_factory.cc
@@ -0,0 +1,65 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/compositor/test/test_context_factory.h"
+
+#include "cc/debug/test_context_provider.h"
+#include "cc/output/output_surface.h"
+#include "ui/compositor/reflector.h"
+
+namespace ui {
+
+TestContextFactory::TestContextFactory() {}
+
+TestContextFactory::~TestContextFactory() {}
+
+scoped_ptr<cc::OutputSurface> TestContextFactory::CreateOutputSurface(
+ Compositor* compositor) {
+ return make_scoped_ptr(
+ new cc::OutputSurface(cc::TestContextProvider::Create()));
+}
+
+scoped_refptr<Reflector> TestContextFactory::CreateReflector(
+ Compositor* mirrored_compositor,
+ Layer* mirroring_layer) {
+ return new Reflector();
+}
+
+void TestContextFactory::RemoveReflector(scoped_refptr<Reflector> reflector) {
+}
+
+scoped_refptr<cc::ContextProvider>
+TestContextFactory::OffscreenCompositorContextProvider() {
+ if (!offscreen_compositor_contexts_.get() ||
+ offscreen_compositor_contexts_->DestroyedOnMainThread())
+ offscreen_compositor_contexts_ = cc::TestContextProvider::Create();
+ return offscreen_compositor_contexts_;
+}
+
+scoped_refptr<cc::ContextProvider>
+TestContextFactory::SharedMainThreadContextProvider() {
+ if (shared_main_thread_contexts_ &&
+ !shared_main_thread_contexts_->DestroyedOnMainThread())
+ return shared_main_thread_contexts_;
+
+ if (ui::Compositor::WasInitializedWithThread()) {
+ shared_main_thread_contexts_ = cc::TestContextProvider::Create();
+ } else {
+ shared_main_thread_contexts_ =
+ static_cast<cc::TestContextProvider*>(
+ OffscreenCompositorContextProvider().get());
+ }
+ if (shared_main_thread_contexts_ &&
+ !shared_main_thread_contexts_->BindToCurrentThread())
+ shared_main_thread_contexts_ = NULL;
+
+ return shared_main_thread_contexts_;
+}
+
+void TestContextFactory::RemoveCompositor(Compositor* compositor) {
+}
+
+bool TestContextFactory::DoesCreateTestContexts() { return true; }
+
+} // namespace ui
« ui/compositor/reflector.h ('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