[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / content / browser / android / in_process / synchronous_compositor_registry.h
blobf84bb0dac0b4bafd9eb108f405e07a5f3bda4c21
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;
20 class SynchronousInputHandlerProxy;
22 class SynchronousCompositorRegistry {
23 public:
24 static SynchronousCompositorRegistry* GetInstance();
26 void RegisterCompositor(int routing_id,
27 SynchronousCompositorImpl* compositor);
28 void UnregisterCompositor(int routing_id,
29 SynchronousCompositorImpl* compositor);
30 void RegisterBeginFrameSource(
31 int routing_id,
32 SynchronousCompositorExternalBeginFrameSource* begin_frame_source);
33 void UnregisterBeginFrameSource(
34 int routing_id,
35 SynchronousCompositorExternalBeginFrameSource* begin_frame_source);
36 void RegisterOutputSurface(
37 int routing_id,
38 SynchronousCompositorOutputSurface* output_surface);
39 void UnregisterOutputSurface(
40 int routing_id,
41 SynchronousCompositorOutputSurface* output_surface);
42 void RegisterInputHandler(
43 int routing_id,
44 cc::InputHandler* input_handler,
45 SynchronousInputHandlerProxy* synchronous_input_handler_proxy);
46 void UnregisterInputHandler(int routing_id);
48 private:
49 friend struct base::DefaultLazyInstanceTraits<SynchronousCompositorRegistry>;
50 SynchronousCompositorRegistry();
51 ~SynchronousCompositorRegistry();
53 struct Entry {
54 SynchronousCompositorImpl* compositor;
55 SynchronousCompositorExternalBeginFrameSource* begin_frame_source;
56 SynchronousCompositorOutputSurface* output_surface;
57 cc::InputHandler* input_handler;
58 SynchronousInputHandlerProxy* synchronous_input_handler_proxy;
60 Entry();
61 bool IsReady();
64 using EntryMap = base::hash_map<int, Entry>;
66 void CheckIsReady(int routing_id);
67 void UnregisterObjects(int routing_id);
68 void RemoveEntryIfNeeded(int routing_id);
69 bool CalledOnValidThread() const;
71 EntryMap entry_map_;
73 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorRegistry);
76 } // namespace content
78 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_REGISTRY_H_