1 // Copyright (c) 2012 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.
5 #include "content/browser/aura/image_transport_factory.h"
7 #include "content/browser/aura/gpu_process_transport_factory.h"
8 #include "content/browser/aura/no_transport_image_transport_factory.h"
9 #include "ui/compositor/compositor.h"
14 ImageTransportFactory
* g_factory
= NULL
;
15 bool g_initialized_for_unit_tests
= false;
19 void ImageTransportFactory::Initialize() {
20 DCHECK(!g_factory
|| g_initialized_for_unit_tests
);
21 if (g_initialized_for_unit_tests
)
23 g_factory
= new GpuProcessTransportFactory
;
24 ui::ContextFactory::SetInstance(g_factory
->AsContextFactory());
27 void ImageTransportFactory::InitializeForUnitTests(
28 scoped_ptr
<ui::ContextFactory
> test_factory
) {
30 DCHECK(!g_initialized_for_unit_tests
);
31 g_initialized_for_unit_tests
= true;
32 g_factory
= new NoTransportImageTransportFactory(test_factory
.Pass());
33 ui::ContextFactory::SetInstance(g_factory
->AsContextFactory());
37 void ImageTransportFactory::Terminate() {
38 ui::ContextFactory::SetInstance(NULL
);
41 g_initialized_for_unit_tests
= false;
45 ImageTransportFactory
* ImageTransportFactory::GetInstance() {
49 } // namespace content