Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/compositor/image_transport_factory.h" | 5 #include "content/browser/compositor/image_transport_factory.h" |
| 6 | 6 |
| 7 #include "content/browser/compositor/gpu_process_transport_factory.h" | 7 #include "content/browser/compositor/gpu_process_transport_factory.h" |
| 8 #include "content/browser/compositor/no_transport_image_transport_factory.h" | 8 #include "content/browser/compositor/no_transport_image_transport_factory.h" |
| 9 #include "content/common/host_shared_bitmap_manager.h" | |
| 9 #include "ui/compositor/compositor.h" | 10 #include "ui/compositor/compositor.h" |
| 10 | 11 |
| 11 namespace content { | 12 namespace content { |
| 12 | 13 |
| 13 namespace { | 14 namespace { |
| 14 ImageTransportFactory* g_factory = NULL; | 15 ImageTransportFactory* g_factory = NULL; |
| 15 bool g_initialized_for_unit_tests = false; | 16 bool g_initialized_for_unit_tests = false; |
| 16 } | 17 } |
| 17 | 18 |
| 18 // static | 19 // static |
| 19 void ImageTransportFactory::Initialize() { | 20 void ImageTransportFactory::Initialize() { |
| 21 ui::Compositor::SetSharedBitmapManager(HostSharedBitmapManager::current()); | |
|
danakj
2014/01/30 22:59:01
move to bottom of this method
| |
| 20 DCHECK(!g_factory || g_initialized_for_unit_tests); | 22 DCHECK(!g_factory || g_initialized_for_unit_tests); |
| 21 if (g_initialized_for_unit_tests) | 23 if (g_initialized_for_unit_tests) |
| 22 return; | 24 return; |
| 23 g_factory = new GpuProcessTransportFactory; | 25 g_factory = new GpuProcessTransportFactory; |
| 24 ui::ContextFactory::SetInstance(g_factory->AsContextFactory()); | 26 ui::ContextFactory::SetInstance(g_factory->AsContextFactory()); |
| 25 } | 27 } |
| 26 | 28 |
| 27 void ImageTransportFactory::InitializeForUnitTests( | 29 void ImageTransportFactory::InitializeForUnitTests( |
| 28 scoped_ptr<ui::ContextFactory> test_factory) { | 30 scoped_ptr<ui::ContextFactory> test_factory) { |
| 29 DCHECK(!g_factory); | 31 DCHECK(!g_factory); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 40 g_factory = NULL; | 42 g_factory = NULL; |
| 41 g_initialized_for_unit_tests = false; | 43 g_initialized_for_unit_tests = false; |
| 42 } | 44 } |
| 43 | 45 |
| 44 // static | 46 // static |
| 45 ImageTransportFactory* ImageTransportFactory::GetInstance() { | 47 ImageTransportFactory* ImageTransportFactory::GetInstance() { |
| 46 return g_factory; | 48 return g_factory; |
| 47 } | 49 } |
| 48 | 50 |
| 49 } // namespace content | 51 } // namespace content |
| OLD | NEW |