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

Side by Side Diff: content/browser/aura/image_transport_factory.cc

Issue 137893007: Add the UI compositor to the Mac build (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add missed file Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #include "content/browser/aura/image_transport_factory.h"
6
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"
10
11 namespace content {
12
13 namespace {
14 ImageTransportFactory* g_factory = NULL;
15 bool g_initialized_for_unit_tests = false;
16 }
17
18 // static
19 void ImageTransportFactory::Initialize() {
20 DCHECK(!g_factory || g_initialized_for_unit_tests);
21 if (g_initialized_for_unit_tests)
22 return;
23 g_factory = new GpuProcessTransportFactory;
24 ui::ContextFactory::SetInstance(g_factory->AsContextFactory());
25 }
26
27 void ImageTransportFactory::InitializeForUnitTests(
28 scoped_ptr<ui::ContextFactory> test_factory) {
29 DCHECK(!g_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());
34 }
35
36 // static
37 void ImageTransportFactory::Terminate() {
38 ui::ContextFactory::SetInstance(NULL);
39 delete g_factory;
40 g_factory = NULL;
41 g_initialized_for_unit_tests = false;
42 }
43
44 // static
45 ImageTransportFactory* ImageTransportFactory::GetInstance() {
46 return g_factory;
47 }
48
49 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/aura/image_transport_factory.h ('k') | content/browser/aura/image_transport_factory_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698