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