OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_REGISTRY_IN_PR
OC_H_ | |
6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_REGISTRY_IN_PR
OC_H_ | |
7 | |
8 #include "base/containers/hash_tables.h" | |
9 #include "base/lazy_instance.h" | |
10 #include "base/macros.h" | |
11 #include "content/renderer/android/synchronous_compositor_registry.h" | |
12 #include "ui/events/blink/synchronous_input_handler_proxy.h" | |
13 | |
14 namespace ui { | |
15 class SynchronousInputHandlerProxy; | |
16 } | |
17 | |
18 namespace content { | |
19 | |
20 class SynchronousCompositorExternalBeginFrameSource; | |
21 class SynchronousCompositorImpl; | |
22 class SynchronousCompositorOutputSurface; | |
23 | |
24 class SynchronousCompositorRegistryInProc | |
25 : public SynchronousCompositorRegistry { | |
26 public: | |
27 static SynchronousCompositorRegistryInProc* GetInstance(); | |
28 | |
29 void RegisterCompositor(int routing_id, | |
30 SynchronousCompositorImpl* compositor); | |
31 void UnregisterCompositor(int routing_id, | |
32 SynchronousCompositorImpl* compositor); | |
33 void RegisterInputHandler( | |
34 int routing_id, | |
35 ui::SynchronousInputHandlerProxy* synchronous_input_handler_proxy); | |
36 void UnregisterInputHandler(int routing_id); | |
37 | |
38 // SynchronousCompositorRegistry overrides. | |
39 void RegisterBeginFrameSource(int routing_id, | |
40 SynchronousCompositorExternalBeginFrameSource* | |
41 begin_frame_source) override; | |
42 void UnregisterBeginFrameSource(int routing_id, | |
43 SynchronousCompositorExternalBeginFrameSource* | |
44 begin_frame_source) override; | |
45 void RegisterOutputSurface( | |
46 int routing_id, | |
47 SynchronousCompositorOutputSurface* output_surface) override; | |
48 void UnregisterOutputSurface( | |
49 int routing_id, | |
50 SynchronousCompositorOutputSurface* output_surface) override; | |
51 | |
52 private: | |
53 friend struct base::DefaultLazyInstanceTraits< | |
54 SynchronousCompositorRegistryInProc>; | |
55 SynchronousCompositorRegistryInProc(); | |
56 ~SynchronousCompositorRegistryInProc() override; | |
57 | |
58 struct Entry { | |
59 SynchronousCompositorImpl* compositor; | |
60 SynchronousCompositorExternalBeginFrameSource* begin_frame_source; | |
61 SynchronousCompositorOutputSurface* output_surface; | |
62 ui::SynchronousInputHandlerProxy* synchronous_input_handler_proxy; | |
63 | |
64 Entry(); | |
65 bool IsReady(); | |
66 }; | |
67 | |
68 using EntryMap = base::hash_map<int, Entry>; | |
69 | |
70 void CheckIsReady(int routing_id); | |
71 void UnregisterObjects(int routing_id); | |
72 void RemoveEntryIfNeeded(int routing_id); | |
73 bool CalledOnValidThread() const; | |
74 | |
75 EntryMap entry_map_; | |
76 | |
77 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorRegistryInProc); | |
78 }; | |
79 | |
80 } // namespace content | |
81 | |
82 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_REGISTRY_IN
_PROC_H_ | |
OLD | NEW |