| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FILTER_H_ | 5 #ifndef CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FILTER_H_ |
| 6 #define CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FILTER_H_ | 6 #define CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FILTER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 void OnFilterRemoved() override; | 41 void OnFilterRemoved() override; |
| 42 void OnChannelClosing() override; | 42 void OnChannelClosing() override; |
| 43 bool OnMessageReceived(const IPC::Message& message) override; | 43 bool OnMessageReceived(const IPC::Message& message) override; |
| 44 bool GetSupportedMessageClasses( | 44 bool GetSupportedMessageClasses( |
| 45 std::vector<uint32_t>* supported_message_classes) const override; | 45 std::vector<uint32_t>* supported_message_classes) const override; |
| 46 | 46 |
| 47 // IPC::Sender overrides. | 47 // IPC::Sender overrides. |
| 48 bool Send(IPC::Message* message) override; | 48 bool Send(IPC::Message* message) override; |
| 49 | 49 |
| 50 // SynchronousCompositorRegistry overrides. | 50 // SynchronousCompositorRegistry overrides. |
| 51 void RegisterOutputSurface( | 51 void RegisterCompositorFrameSink( |
| 52 int routing_id, | 52 int routing_id, |
| 53 SynchronousCompositorOutputSurface* output_surface) override; | 53 SynchronousCompositorFrameSink* compositor_frame_sink) override; |
| 54 void UnregisterOutputSurface( | 54 void UnregisterCompositorFrameSink( |
| 55 int routing_id, | 55 int routing_id, |
| 56 SynchronousCompositorOutputSurface* output_surface) override; | 56 SynchronousCompositorFrameSink* compositor_frame_sink) override; |
| 57 | 57 |
| 58 // SynchronousInputHandlerProxyClient overrides. | 58 // SynchronousInputHandlerProxyClient overrides. |
| 59 void DidAddSynchronousHandlerProxy( | 59 void DidAddSynchronousHandlerProxy( |
| 60 int routing_id, | 60 int routing_id, |
| 61 ui::SynchronousInputHandlerProxy* synchronous_input_handler_proxy) | 61 ui::SynchronousInputHandlerProxy* synchronous_input_handler_proxy) |
| 62 override; | 62 override; |
| 63 void DidRemoveSynchronousHandlerProxy(int routing_id) override; | 63 void DidRemoveSynchronousHandlerProxy(int routing_id) override; |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 ~SynchronousCompositorFilter() override; | 66 ~SynchronousCompositorFilter() override; |
| 67 | 67 |
| 68 // IO thread methods. | 68 // IO thread methods. |
| 69 void SendOnIOThread(IPC::Message* message); | 69 void SendOnIOThread(IPC::Message* message); |
| 70 | 70 |
| 71 // Compositor thread methods. | 71 // Compositor thread methods. |
| 72 void FilterReadyOnCompositorThread(); | 72 void FilterReadyOnCompositorThread(); |
| 73 void OnMessageReceivedOnCompositorThread(const IPC::Message& message); | 73 void OnMessageReceivedOnCompositorThread(const IPC::Message& message); |
| 74 void CreateSynchronousCompositorProxy( | 74 void CreateSynchronousCompositorProxy( |
| 75 int routing_id, | 75 int routing_id, |
| 76 ui::SynchronousInputHandlerProxy* synchronous_input_handler_proxy); | 76 ui::SynchronousInputHandlerProxy* synchronous_input_handler_proxy); |
| 77 void SetProxyOutputSurface( | 77 void SetProxyCompositorFrameSink( |
| 78 int routing_id, | 78 int routing_id, |
| 79 SynchronousCompositorOutputSurface* output_surface); | 79 SynchronousCompositorFrameSink* compositor_frame_sink); |
| 80 void UnregisterObjects(int routing_id); | 80 void UnregisterObjects(int routing_id); |
| 81 void RemoveEntryIfNeeded(int routing_id); | 81 void RemoveEntryIfNeeded(int routing_id); |
| 82 SynchronousCompositorProxy* FindProxy(int routing_id); | 82 SynchronousCompositorProxy* FindProxy(int routing_id); |
| 83 void OnSynchronizeRendererState( | 83 void OnSynchronizeRendererState( |
| 84 const std::vector<int>& routing_ids, | 84 const std::vector<int>& routing_ids, |
| 85 std::vector<SyncCompositorCommonRendererParams>* out); | 85 std::vector<SyncCompositorCommonRendererParams>* out); |
| 86 | 86 |
| 87 const scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; | 87 const scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; |
| 88 | 88 |
| 89 // The sender_ only gets invoked on the thread corresponding to io_loop_. | 89 // The sender_ only gets invoked on the thread corresponding to io_loop_. |
| 90 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 90 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 91 IPC::Sender* sender_; | 91 IPC::Sender* sender_; |
| 92 | 92 |
| 93 // Compositor thread-only fields. | 93 // Compositor thread-only fields. |
| 94 using SyncCompositorMap = | 94 using SyncCompositorMap = |
| 95 base::ScopedPtrHashMap<int /* routing_id */, | 95 base::ScopedPtrHashMap<int /* routing_id */, |
| 96 std::unique_ptr<SynchronousCompositorProxy>>; | 96 std::unique_ptr<SynchronousCompositorProxy>>; |
| 97 SyncCompositorMap sync_compositor_map_; | 97 SyncCompositorMap sync_compositor_map_; |
| 98 | 98 |
| 99 bool filter_ready_; | 99 bool filter_ready_; |
| 100 using SynchronousInputHandlerProxyMap = | 100 using SynchronousInputHandlerProxyMap = |
| 101 base::hash_map<int, ui::SynchronousInputHandlerProxy*>; | 101 base::hash_map<int, ui::SynchronousInputHandlerProxy*>; |
| 102 using OutputSurfaceMap = | 102 using CompositorFrameSinkMap = |
| 103 base::hash_map<int, SynchronousCompositorOutputSurface*>; | 103 base::hash_map<int, SynchronousCompositorFrameSink*>; |
| 104 | 104 |
| 105 // This is only used before FilterReadyOnCompositorThread. | 105 // This is only used before FilterReadyOnCompositorThread. |
| 106 SynchronousInputHandlerProxyMap synchronous_input_handler_proxy_map_; | 106 SynchronousInputHandlerProxyMap synchronous_input_handler_proxy_map_; |
| 107 | 107 |
| 108 // This is only used if input_handler_proxy has not been registered. | 108 // This is only used if input_handler_proxy has not been registered. |
| 109 OutputSurfaceMap output_surface_map_; | 109 CompositorFrameSinkMap compositor_frame_sink_map_; |
| 110 | 110 |
| 111 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorFilter); | 111 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorFilter); |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 } // namespace content | 114 } // namespace content |
| 115 | 115 |
| 116 #endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FILTER_H_ | 116 #endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FILTER_H_ |
| OLD | NEW |