Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / content / browser / android / in_process / synchronous_compositor_registry.h
blob5dfdc7e8db83f597a797e7a3f649ddcb606566f4
1 // Copyright 2014 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.
5 #ifndef CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_REGISTRY_H_
6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_REGISTRY_H_
8 #include "base/containers/hash_tables.h"
9 #include "base/lazy_instance.h"
11 namespace cc {
12 class InputHandler;
15 namespace content {
17 class SynchronousCompositorExternalBeginFrameSource;
18 class SynchronousCompositorImpl;
19 class SynchronousCompositorOutputSurface;
21 class SynchronousCompositorRegistry {
22 public:
23 static SynchronousCompositorRegistry* GetInstance();
25 void RegisterCompositor(int routing_id,
26 SynchronousCompositorImpl* compositor);
27 void UnregisterCompositor(int routing_id,
28 SynchronousCompositorImpl* compositor);
29 void RegisterBeginFrameSource(
30 int routing_id,
31 SynchronousCompositorExternalBeginFrameSource* begin_frame_source);
32 void UnregisterBeginFrameSource(
33 int routing_id,
34 SynchronousCompositorExternalBeginFrameSource* begin_frame_source);
35 void RegisterOutputSurface(
36 int routing_id,
37 SynchronousCompositorOutputSurface* output_surface);
38 void UnregisterOutputSurface(
39 int routing_id,
40 SynchronousCompositorOutputSurface* output_surface);
41 void RegisterInputHandler(
42 int routing_id,
43 cc::InputHandler* input_handler);
44 void UnregisterInputHandler(int routing_id);
46 private:
47 friend struct base::DefaultLazyInstanceTraits<SynchronousCompositorRegistry>;
48 SynchronousCompositorRegistry();
49 ~SynchronousCompositorRegistry();
51 struct Entry {
52 SynchronousCompositorImpl* compositor;
53 SynchronousCompositorExternalBeginFrameSource* begin_frame_source;
54 SynchronousCompositorOutputSurface* output_surface;
55 cc::InputHandler* input_handler;
57 Entry();
58 bool IsReady();
61 using EntryMap = base::hash_map<int, Entry>;
63 void CheckIsReady(int routing_id);
64 void UnregisterObjects(int routing_id);
65 void RemoveEntryIfNeeded(int routing_id);
66 bool CalledOnValidThread() const;
68 EntryMap entry_map_;
70 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorRegistry);
73 } // namespace content
75 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_REGISTRY_H_