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 SynchronousInputHandlerProxy
* synchronous_input_handler_proxy
);
45 void UnregisterInputHandler(int routing_id
);
48 friend struct base::DefaultLazyInstanceTraits
<SynchronousCompositorRegistry
>;
49 SynchronousCompositorRegistry();
50 ~SynchronousCompositorRegistry();
53 SynchronousCompositorImpl
* compositor
;
54 SynchronousCompositorExternalBeginFrameSource
* begin_frame_source
;
55 SynchronousCompositorOutputSurface
* output_surface
;
56 SynchronousInputHandlerProxy
* synchronous_input_handler_proxy
;
62 using EntryMap
= base::hash_map
<int, Entry
>;
64 void CheckIsReady(int routing_id
);
65 void UnregisterObjects(int routing_id
);
66 void RemoveEntryIfNeeded(int routing_id
);
67 bool CalledOnValidThread() const;
71 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorRegistry
);
74 } // namespace content
76 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_REGISTRY_H_