summaryrefslogtreecommitdiffstats
path: root/ui/compositor/test/in_process_context_factory.h
blob: 56f2d7ebb9d76b983a10a97f585696abbe875ab5 (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
54
55
// Copyright 2014 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_IN_PROCESS_CONTEXT_FACTORY_H_
#define UI_COMPOSITOR_TEST_IN_PROCESS_CONTEXT_FACTORY_H_

#include "ui/compositor/compositor.h"

namespace base {
class Thread;
}

namespace webkit {
namespace gpu {
class ContextProviderInProcess;
}
}

namespace ui {

class InProcessContextFactory : public ContextFactory {
 public:
  InProcessContextFactory();
  virtual ~InProcessContextFactory();

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

  virtual scoped_refptr<Reflector> CreateReflector(
      Compositor* mirrored_compositor,
      Layer* mirroring_layer) override;
  virtual void RemoveReflector(scoped_refptr<Reflector> reflector) override;

  virtual scoped_refptr<cc::ContextProvider> SharedMainThreadContextProvider()
      override;
  virtual void RemoveCompositor(Compositor* compositor) override;
  virtual bool DoesCreateTestContexts() override;
  virtual cc::SharedBitmapManager* GetSharedBitmapManager() override;
  virtual base::MessageLoopProxy* GetCompositorMessageLoop() override;

 private:
  scoped_ptr<base::Thread> compositor_thread_;
  scoped_refptr<webkit::gpu::ContextProviderInProcess>
      shared_main_thread_contexts_;
  scoped_ptr<cc::SharedBitmapManager> shared_bitmap_manager_;

  DISALLOW_COPY_AND_ASSIGN(InProcessContextFactory);
};

}  // namespace ui

#endif  // UI_COMPOSITOR_TEST_IN_PROCESS_CONTEXT_FACTORY_H_