1868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
2868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// found in the LICENSE file.
4868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
5868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "content/renderer/android/synchronous_compositor_factory.h"
6868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
7868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/command_line.h"
8868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/logging.h"
9868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "content/public/common/content_switches.h"
10868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
11868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)namespace content {
12868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
13868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)namespace {
14868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)SynchronousCompositorFactory* g_instance = NULL;
15868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}  // namespace
16868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
17868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// static
18868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)void SynchronousCompositorFactory::SetInstance(
19868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    SynchronousCompositorFactory* instance) {
20868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  DCHECK(g_instance == NULL);
21868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
22868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // This feature only makes sense in single process mode.
23868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  CHECK(CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess));
24868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
25868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  g_instance = instance;
26868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}
27868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
28868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// static
29868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)SynchronousCompositorFactory* SynchronousCompositorFactory::GetInstance() {
30868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  return g_instance;
31868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}
32868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
33868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}  // namespace content
34