OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ui/compositor/test/context_factories_for_test.h" | 5 #include "ui/compositor/test/context_factories_for_test.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/sys_info.h" | 8 #include "base/sys_info.h" |
9 #include "cc/surfaces/surface_manager.h" | 9 #include "cc/surfaces/surface_manager.h" |
10 #include "ui/compositor/compositor.h" | 10 #include "ui/compositor/compositor.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 // static | 25 // static |
26 ui::ContextFactory* InitializeContextFactoryForTests(bool enable_pixel_output) { | 26 ui::ContextFactory* InitializeContextFactoryForTests(bool enable_pixel_output) { |
27 DCHECK(!g_implicit_factory) << | 27 DCHECK(!g_implicit_factory) << |
28 "ContextFactory for tests already initialized."; | 28 "ContextFactory for tests already initialized."; |
29 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 29 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
30 if (command_line->HasSwitch(switches::kEnablePixelOutputInTests)) | 30 if (command_line->HasSwitch(switches::kEnablePixelOutputInTests)) |
31 enable_pixel_output = true; | 31 enable_pixel_output = true; |
32 if (enable_pixel_output) | 32 if (enable_pixel_output) |
33 g_disable_null_draw = new gl::DisableNullDrawGLBindings; | 33 g_disable_null_draw = new gl::DisableNullDrawGLBindings; |
34 bool context_factory_for_test = true; | 34 bool context_factory_for_test = true; |
35 g_surface_manager = new cc::SurfaceManager; | 35 g_surface_manager = new cc::SurfaceManager(nullptr); |
36 g_implicit_factory = | 36 g_implicit_factory = |
37 new InProcessContextFactory(context_factory_for_test, g_surface_manager); | 37 new InProcessContextFactory(context_factory_for_test, g_surface_manager); |
38 return g_implicit_factory; | 38 return g_implicit_factory; |
39 } | 39 } |
40 | 40 |
41 void TerminateContextFactoryForTests() { | 41 void TerminateContextFactoryForTests() { |
42 if (g_implicit_factory) { | 42 if (g_implicit_factory) { |
43 g_implicit_factory->SendOnLostResources(); | 43 g_implicit_factory->SendOnLostResources(); |
44 delete g_implicit_factory; | 44 delete g_implicit_factory; |
45 g_implicit_factory = NULL; | 45 g_implicit_factory = NULL; |
46 } | 46 } |
47 delete g_surface_manager; | 47 delete g_surface_manager; |
48 g_surface_manager = nullptr; | 48 g_surface_manager = nullptr; |
49 delete g_disable_null_draw; | 49 delete g_disable_null_draw; |
50 g_disable_null_draw = NULL; | 50 g_disable_null_draw = NULL; |
51 } | 51 } |
52 | 52 |
53 } // namespace ui | 53 } // namespace ui |
OLD | NEW |