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"
17 class SynchronousCompositorExternalBeginFrameSource
;
18 class SynchronousCompositorImpl
;
19 class SynchronousCompositorOutputSurface
;
20 class SynchronousInputHandlerProxy
;
22 class SynchronousCompositorRegistry
{
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(
32 SynchronousCompositorExternalBeginFrameSource
* begin_frame_source
);
33 void UnregisterBeginFrameSource(
35 SynchronousCompositorExternalBeginFrameSource
* begin_frame_source
);
36 void RegisterOutputSurface(
38 SynchronousCompositorOutputSurface
* output_surface
);
39 void UnregisterOutputSurface(
41 SynchronousCompositorOutputSurface
* output_surface
);
42 void RegisterInputHandler(
44 cc::InputHandler
* input_handler
,
45 SynchronousInputHandlerProxy
* synchronous_input_handler_proxy
);
46 void UnregisterInputHandler(int routing_id
);
49 friend struct base::DefaultLazyInstanceTraits
<SynchronousCompositorRegistry
>;
50 SynchronousCompositorRegistry();
51 ~SynchronousCompositorRegistry();
54 SynchronousCompositorImpl
* compositor
;
55 SynchronousCompositorExternalBeginFrameSource
* begin_frame_source
;
56 SynchronousCompositorOutputSurface
* output_surface
;
57 cc::InputHandler
* input_handler
;
58 SynchronousInputHandlerProxy
* synchronous_input_handler_proxy
;
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;
73 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorRegistry
);
76 } // namespace content
78 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_REGISTRY_H_