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"
13 class SynchronousCompositorExternalBeginFrameSource
;
14 class SynchronousCompositorImpl
;
15 class SynchronousCompositorOutputSurface
;
17 class SynchronousCompositorRegistry
{
19 static SynchronousCompositorRegistry
* GetInstance();
21 void RegisterCompositor(int routing_id
,
22 SynchronousCompositorImpl
* compositor
);
23 void UnregisterCompositor(int routing_id
,
24 SynchronousCompositorImpl
* compositor
);
25 void RegisterBeginFrameSource(
27 SynchronousCompositorExternalBeginFrameSource
* begin_frame_source
);
28 void UnregisterBeginFrameSource(
30 SynchronousCompositorExternalBeginFrameSource
* begin_frame_source
);
31 void RegisterOutputSurface(
33 SynchronousCompositorOutputSurface
* output_surface
);
34 void UnregisterOutputSurface(
36 SynchronousCompositorOutputSurface
* output_surface
);
39 friend struct base::DefaultLazyInstanceTraits
<SynchronousCompositorRegistry
>;
40 SynchronousCompositorRegistry();
41 ~SynchronousCompositorRegistry();
44 SynchronousCompositorImpl
* compositor
;
45 SynchronousCompositorExternalBeginFrameSource
* begin_frame_source
;
46 SynchronousCompositorOutputSurface
* output_surface
;
52 using EntryMap
= base::hash_map
<int, Entry
>;
54 void CheckIsReady(int routing_id
);
55 void UnregisterObjects(int routing_id
);
56 void RemoveEntryIfNeeded(int routing_id
);
57 bool CalledOnValidThread() const;
61 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorRegistry
);
64 } // namespace content
66 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_REGISTRY_H_