| 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 10 matching lines...) Expand all Loading... |
| 71 friend class internal::RequestInvokeGLTracker; | 74 friend class internal::RequestInvokeGLTracker; |
| 72 class InsideHardwareReleaseReset { | 75 class InsideHardwareReleaseReset { |
| 73 public: | 76 public: |
| 74 explicit InsideHardwareReleaseReset( | 77 explicit InsideHardwareReleaseReset( |
| 75 RenderThreadManager* render_thread_manager); | 78 RenderThreadManager* render_thread_manager); |
| 76 ~InsideHardwareReleaseReset(); | 79 ~InsideHardwareReleaseReset(); |
| 77 | 80 |
| 78 private: | 81 private: |
| 79 RenderThreadManager* render_thread_manager_; | 82 RenderThreadManager* render_thread_manager_; |
| 80 }; | 83 }; |
| 84 static std::unique_ptr<ChildFrame> GetSynchronousCompositorFrame( |
| 85 scoped_refptr<content::SynchronousCompositor::FrameFuture> frame_future, |
| 86 std::unique_ptr<ChildFrame> child_frame); |
| 81 | 87 |
| 82 // RT thread method. | 88 // RT thread method. |
| 83 void DidInvokeGLProcess(); | 89 void DidInvokeGLProcess(); |
| 84 bool HasFrameForHardwareRendererOnRT() const; | 90 bool HasFrameForHardwareRendererOnRT() const; |
| 85 | 91 |
| 86 // UI thread methods. | 92 // UI thread methods. |
| 87 void ResetRequestInvokeGLCallback(); | 93 void ResetRequestInvokeGLCallback(); |
| 88 void ClientRequestInvokeGLOnUI(); | 94 void ClientRequestInvokeGLOnUI(); |
| 89 void UpdateParentDrawConstraintsOnUI(); | 95 void UpdateParentDrawConstraintsOnUI(); |
| 90 bool IsInsideHardwareRelease() const; | 96 bool IsInsideHardwareRelease() const; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 101 std::unique_ptr<HardwareRenderer> hardware_renderer_; | 107 std::unique_ptr<HardwareRenderer> hardware_renderer_; |
| 102 | 108 |
| 103 // This is accessed by both UI and RT now. TODO(hush): move to RT only. | 109 // This is accessed by both UI and RT now. TODO(hush): move to RT only. |
| 104 GLViewRendererManager::Key renderer_manager_key_; | 110 GLViewRendererManager::Key renderer_manager_key_; |
| 105 | 111 |
| 106 // Accessed by both UI and RT thread. | 112 // Accessed by both UI and RT thread. |
| 107 mutable base::Lock lock_; | 113 mutable base::Lock lock_; |
| 108 bool hardware_renderer_has_frame_; | 114 bool hardware_renderer_has_frame_; |
| 109 gfx::Vector2d scroll_offset_; | 115 gfx::Vector2d scroll_offset_; |
| 110 std::unique_ptr<ChildFrame> child_frame_; | 116 std::unique_ptr<ChildFrame> child_frame_; |
| 117 const bool async_on_draw_hardware_; |
| 118 scoped_refptr<content::SynchronousCompositor::FrameFuture> frame_future_; |
| 111 bool inside_hardware_release_; | 119 bool inside_hardware_release_; |
| 112 ParentCompositorDrawConstraints parent_draw_constraints_; | 120 ParentCompositorDrawConstraints parent_draw_constraints_; |
| 113 ReturnedResourcesMap returned_resources_map_; | 121 ReturnedResourcesMap returned_resources_map_; |
| 114 base::Closure request_draw_gl_closure_; | 122 base::Closure request_draw_gl_closure_; |
| 115 | 123 |
| 116 base::WeakPtrFactory<RenderThreadManager> weak_factory_on_ui_thread_; | 124 base::WeakPtrFactory<RenderThreadManager> weak_factory_on_ui_thread_; |
| 117 | 125 |
| 118 DISALLOW_COPY_AND_ASSIGN(RenderThreadManager); | 126 DISALLOW_COPY_AND_ASSIGN(RenderThreadManager); |
| 119 }; | 127 }; |
| 120 | 128 |
| 121 } // namespace android_webview | 129 } // namespace android_webview |
| 122 | 130 |
| 123 #endif // ANDROID_WEBVIEW_BROWSER_RENDER_THREAD_MANAGER_H_ | 131 #endif // ANDROID_WEBVIEW_BROWSER_RENDER_THREAD_MANAGER_H_ |
| OLD | NEW |