summaryrefslogtreecommitdiffstats
path: root/ui/compositor/test/default_context_factory.h
blob: 7b8501bf825186df3597c1bca6a8e15b95ad9d9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_COMPOSITOR_TEST_DEFAULT_CONTEXT_FACTORY_H_
#define UI_COMPOSITOR_TEST_DEFAULT_CONTEXT_FACTORY_H_

#include "ui/compositor/compositor.h"

namespace webkit {
namespace gpu {
class ContextProviderInProcess;
}
}

namespace ui {

// The default factory that creates in-process contexts.
class DefaultContextFactory : public ContextFactory {
 public:
  DefaultContextFactory();
  virtual ~DefaultContextFactory();

  // ContextFactory implementation
  virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(
      Compositor* compositor, bool software_fallback) OVERRIDE;

  virtual scoped_refptr<Reflector> CreateReflector(
      Compositor* compositor,
      Layer* layer) OVERRIDE;
  virtual void RemoveReflector(scoped_refptr<Reflector> reflector) OVERRIDE;

  virtual scoped_refptr<cc::ContextProvider>
      OffscreenCompositorContextProvider() OVERRIDE;
  virtual scoped_refptr<cc::ContextProvider>
      SharedMainThreadContextProvider() OVERRIDE;
  virtual void RemoveCompositor(Compositor* compositor) OVERRIDE;
  virtual bool DoesCreateTestContexts() OVERRIDE;

  bool Initialize();

 private:
  scoped_refptr<webkit::gpu::ContextProviderInProcess>
      offscreen_compositor_contexts_;
  scoped_refptr<webkit::gpu::ContextProviderInProcess>
      shared_main_thread_contexts_;

  DISALLOW_COPY_AND_ASSIGN(DefaultContextFactory);
};

}  // namespace ui

#endif  // UI_COMPOSITOR_TEST_DEFAULT_CONTEXT_FACTORY_H_