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
;
21 class SynchronousCompositorRegistry
{
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(
31 SynchronousCompositorExternalBeginFrameSource
* begin_frame_source
);
32 void UnregisterBeginFrameSource(
34 SynchronousCompositorExternalBeginFrameSource
* begin_frame_source
);
35 void RegisterOutputSurface(
37 SynchronousCompositorOutputSurface
* output_surface
);
38 void UnregisterOutputSurface(
40 SynchronousCompositorOutputSurface
* output_surface
);
41 void RegisterInputHandler(
43 cc::InputHandler
* input_handler
);
44 void UnregisterInputHandler(int routing_id
);
47 friend struct base::DefaultLazyInstanceTraits
<SynchronousCompositorRegistry
>;
48 SynchronousCompositorRegistry();
49 ~SynchronousCompositorRegistry();
52 SynchronousCompositorImpl
* compositor
;
53 SynchronousCompositorExternalBeginFrameSource
* begin_frame_source
;
54 SynchronousCompositorOutputSurface
* output_surface
;
55 cc::InputHandler
* input_handler
;
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;
70 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorRegistry
);
73 } // namespace content
75 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_REGISTRY_H_