Add remoting and PPAPI tests to GN build
[chromium-blink-merge.git] / content / browser / android / in_process / synchronous_compositor_registry.h
blob5014c8799f9ce5152844bf6da40ecc74342e4edc
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 content {
13 class SynchronousCompositorExternalBeginFrameSource;
14 class SynchronousCompositorImpl;
15 class SynchronousCompositorOutputSurface;
17 class SynchronousCompositorRegistry {
18 public:
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(
26 int routing_id,
27 SynchronousCompositorExternalBeginFrameSource* begin_frame_source);
28 void UnregisterBeginFrameSource(
29 int routing_id,
30 SynchronousCompositorExternalBeginFrameSource* begin_frame_source);
31 void RegisterOutputSurface(
32 int routing_id,
33 SynchronousCompositorOutputSurface* output_surface);
34 void UnregisterOutputSurface(
35 int routing_id,
36 SynchronousCompositorOutputSurface* output_surface);
38 private:
39 friend struct base::DefaultLazyInstanceTraits<SynchronousCompositorRegistry>;
40 SynchronousCompositorRegistry();
41 ~SynchronousCompositorRegistry();
43 struct Entry {
44 SynchronousCompositorImpl* compositor;
45 SynchronousCompositorExternalBeginFrameSource* begin_frame_source;
46 SynchronousCompositorOutputSurface* output_surface;
48 Entry();
49 bool IsReady();
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;
59 EntryMap entry_map_;
61 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorRegistry);
64 } // namespace content
66 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_REGISTRY_H_