Chromium Code Reviews| 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 ANDROID_WEBVIEW_BROWSER_RENDER_THREAD_MANAGER_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_RENDER_THREAD_MANAGER_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_RENDER_THREAD_MANAGER_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_RENDER_THREAD_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "android_webview/browser/compositor_frame_consumer.h" | 10 #include "android_webview/browser/compositor_frame_consumer.h" |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 const scoped_refptr<base::SingleThreadTaskRunner>& ui_loop); | 40 const scoped_refptr<base::SingleThreadTaskRunner>& ui_loop); |
| 41 ~RenderThreadManager() override; | 41 ~RenderThreadManager() override; |
| 42 | 42 |
| 43 // This function can be called from any thread. | 43 // This function can be called from any thread. |
| 44 void ClientRequestInvokeGL(bool for_idle); | 44 void ClientRequestInvokeGL(bool for_idle); |
| 45 | 45 |
| 46 // CompositorFrameConsumer methods. | 46 // CompositorFrameConsumer methods. |
| 47 void SetCompositorFrameProducer( | 47 void SetCompositorFrameProducer( |
| 48 CompositorFrameProducer* compositor_frame_producer) override; | 48 CompositorFrameProducer* compositor_frame_producer) override; |
| 49 void SetScrollOffsetOnUI(gfx::Vector2d scroll_offset) override; | 49 void SetScrollOffsetOnUI(gfx::Vector2d scroll_offset) override; |
| 50 void SetFrameOnUI(std::unique_ptr<ChildFrame> frame) override; | 50 void SetFrameOnUI( |
| 51 std::unique_ptr<ChildFrame> frame, | |
| 52 const scoped_refptr<content::SynchronousCompositor::FrameFuture>& | |
| 53 frame_future) override; | |
| 51 void InitializeHardwareDrawIfNeededOnUI() override; | 54 void InitializeHardwareDrawIfNeededOnUI() override; |
| 52 ParentCompositorDrawConstraints GetParentDrawConstraintsOnUI() const override; | 55 ParentCompositorDrawConstraints GetParentDrawConstraintsOnUI() const override; |
| 53 void SwapReturnedResourcesOnUI( | 56 void SwapReturnedResourcesOnUI( |
| 54 ReturnedResourcesMap* returned_resource_map) override; | 57 ReturnedResourcesMap* returned_resource_map) override; |
| 55 bool ReturnedResourcesEmptyOnUI() const override; | 58 bool ReturnedResourcesEmptyOnUI() const override; |
| 56 std::unique_ptr<ChildFrame> PassUncommittedFrameOnUI() override; | 59 std::unique_ptr<ChildFrame> PassUncommittedFrameOnUI() override; |
| 57 bool HasFrameOnUI() const override; | 60 bool HasFrameOnUI() const override; |
| 58 void DeleteHardwareRendererOnUI() override; | 61 void DeleteHardwareRendererOnUI() override; |
| 59 | 62 |
| 60 // RT thread methods. | 63 // RT thread methods. |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 89 void UpdateParentDrawConstraintsOnUI(); | 92 void UpdateParentDrawConstraintsOnUI(); |
| 90 bool IsInsideHardwareRelease() const; | 93 bool IsInsideHardwareRelease() const; |
| 91 void SetInsideHardwareRelease(bool inside); | 94 void SetInsideHardwareRelease(bool inside); |
| 92 | 95 |
| 93 // Accessed by UI thread. | 96 // Accessed by UI thread. |
| 94 scoped_refptr<base::SingleThreadTaskRunner> ui_loop_; | 97 scoped_refptr<base::SingleThreadTaskRunner> ui_loop_; |
| 95 RenderThreadManagerClient* const client_; | 98 RenderThreadManagerClient* const client_; |
| 96 CompositorFrameProducer* compositor_frame_producer_; | 99 CompositorFrameProducer* compositor_frame_producer_; |
| 97 base::WeakPtr<RenderThreadManager> ui_thread_weak_ptr_; | 100 base::WeakPtr<RenderThreadManager> ui_thread_weak_ptr_; |
| 98 base::CancelableClosure request_draw_gl_cancelable_closure_; | 101 base::CancelableClosure request_draw_gl_cancelable_closure_; |
| 102 void GetSynchronousCompositorFrame(); | |
|
boliu
2016/09/28 00:36:01
move this above "// RT thread method." as this is
ojars
2016/09/28 22:44:19
Done.
| |
| 99 | 103 |
| 100 // Accessed by RT thread. | 104 // Accessed by RT thread. |
| 101 std::unique_ptr<HardwareRenderer> hardware_renderer_; | 105 std::unique_ptr<HardwareRenderer> hardware_renderer_; |
| 102 | 106 |
| 103 // This is accessed by both UI and RT now. TODO(hush): move to RT only. | 107 // This is accessed by both UI and RT now. TODO(hush): move to RT only. |
| 104 GLViewRendererManager::Key renderer_manager_key_; | 108 GLViewRendererManager::Key renderer_manager_key_; |
| 105 | 109 |
| 106 // Accessed by both UI and RT thread. | 110 // Accessed by both UI and RT thread. |
| 107 mutable base::Lock lock_; | 111 mutable base::Lock lock_; |
| 108 bool hardware_renderer_has_frame_; | 112 bool hardware_renderer_has_frame_; |
| 109 gfx::Vector2d scroll_offset_; | 113 gfx::Vector2d scroll_offset_; |
| 110 std::unique_ptr<ChildFrame> child_frame_; | 114 std::unique_ptr<ChildFrame> child_frame_; |
| 115 const bool async_on_draw_hardware_; | |
| 116 scoped_refptr<content::SynchronousCompositor::FrameFuture> frame_future_; | |
| 111 bool inside_hardware_release_; | 117 bool inside_hardware_release_; |
| 112 ParentCompositorDrawConstraints parent_draw_constraints_; | 118 ParentCompositorDrawConstraints parent_draw_constraints_; |
| 113 ReturnedResourcesMap returned_resources_map_; | 119 ReturnedResourcesMap returned_resources_map_; |
| 114 base::Closure request_draw_gl_closure_; | 120 base::Closure request_draw_gl_closure_; |
| 115 | 121 |
| 116 base::WeakPtrFactory<RenderThreadManager> weak_factory_on_ui_thread_; | 122 base::WeakPtrFactory<RenderThreadManager> weak_factory_on_ui_thread_; |
| 117 | 123 |
| 118 DISALLOW_COPY_AND_ASSIGN(RenderThreadManager); | 124 DISALLOW_COPY_AND_ASSIGN(RenderThreadManager); |
| 119 }; | 125 }; |
| 120 | 126 |
| 121 } // namespace android_webview | 127 } // namespace android_webview |
| 122 | 128 |
| 123 #endif // ANDROID_WEBVIEW_BROWSER_RENDER_THREAD_MANAGER_H_ | 129 #endif // ANDROID_WEBVIEW_BROWSER_RENDER_THREAD_MANAGER_H_ |
| OLD | NEW |