| 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_SHARED_RENDERER_STATE_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "android_webview/browser/gl_view_renderer_manager.h" | 10 #include "android_webview/browser/gl_view_renderer_manager.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 SharedRendererState( | 45 SharedRendererState( |
| 46 SharedRendererStateClient* client, | 46 SharedRendererStateClient* client, |
| 47 const scoped_refptr<base::SingleThreadTaskRunner>& ui_loop); | 47 const scoped_refptr<base::SingleThreadTaskRunner>& ui_loop); |
| 48 ~SharedRendererState(); | 48 ~SharedRendererState(); |
| 49 | 49 |
| 50 // This function can be called from any thread. | 50 // This function can be called from any thread. |
| 51 void ClientRequestDrawGL(bool for_idle); | 51 void ClientRequestDrawGL(bool for_idle); |
| 52 | 52 |
| 53 // UI thread methods. | 53 // UI thread methods. |
| 54 void SetScrollOffsetOnUI(gfx::Vector2d scroll_offset); | 54 void SetScrollOffsetOnUI(gfx::Vector2d scroll_offset); |
| 55 void SetFrameOnUI(scoped_ptr<ChildFrame> frame); | 55 void SetFrameOnUI(std::unique_ptr<ChildFrame> frame); |
| 56 void InitializeHardwareDrawIfNeededOnUI(); | 56 void InitializeHardwareDrawIfNeededOnUI(); |
| 57 ParentCompositorDrawConstraints GetParentDrawConstraintsOnUI() const; | 57 ParentCompositorDrawConstraints GetParentDrawConstraintsOnUI() const; |
| 58 void SwapReturnedResourcesOnUI(ReturnedResourcesMap* returned_resource_map); | 58 void SwapReturnedResourcesOnUI(ReturnedResourcesMap* returned_resource_map); |
| 59 bool ReturnedResourcesEmptyOnUI() const; | 59 bool ReturnedResourcesEmptyOnUI() const; |
| 60 scoped_ptr<ChildFrame> PassUncommittedFrameOnUI(); | 60 std::unique_ptr<ChildFrame> PassUncommittedFrameOnUI(); |
| 61 bool HasFrameOnUI() const; | 61 bool HasFrameOnUI() const; |
| 62 void DeleteHardwareRendererOnUI(); | 62 void DeleteHardwareRendererOnUI(); |
| 63 | 63 |
| 64 // RT thread methods. | 64 // RT thread methods. |
| 65 gfx::Vector2d GetScrollOffsetOnRT(); | 65 gfx::Vector2d GetScrollOffsetOnRT(); |
| 66 scoped_ptr<ChildFrame> PassFrameOnRT(); | 66 std::unique_ptr<ChildFrame> PassFrameOnRT(); |
| 67 void DrawGL(AwDrawGLInfo* draw_info); | 67 void DrawGL(AwDrawGLInfo* draw_info); |
| 68 void PostExternalDrawConstraintsToChildCompositorOnRT( | 68 void PostExternalDrawConstraintsToChildCompositorOnRT( |
| 69 const ParentCompositorDrawConstraints& parent_draw_constraints); | 69 const ParentCompositorDrawConstraints& parent_draw_constraints); |
| 70 void InsertReturnedResourcesOnRT(const cc::ReturnedResourceArray& resources, | 70 void InsertReturnedResourcesOnRT(const cc::ReturnedResourceArray& resources, |
| 71 uint32_t compositor_id, | 71 uint32_t compositor_id, |
| 72 uint32_t output_surface_id); | 72 uint32_t output_surface_id); |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 friend class internal::RequestDrawGLTracker; | 75 friend class internal::RequestDrawGLTracker; |
| 76 class InsideHardwareReleaseReset { | 76 class InsideHardwareReleaseReset { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 93 bool IsInsideHardwareRelease() const; | 93 bool IsInsideHardwareRelease() const; |
| 94 void SetInsideHardwareRelease(bool inside); | 94 void SetInsideHardwareRelease(bool inside); |
| 95 | 95 |
| 96 // Accessed by UI thread. | 96 // Accessed by UI thread. |
| 97 scoped_refptr<base::SingleThreadTaskRunner> ui_loop_; | 97 scoped_refptr<base::SingleThreadTaskRunner> ui_loop_; |
| 98 SharedRendererStateClient* const client_; | 98 SharedRendererStateClient* const client_; |
| 99 base::WeakPtr<SharedRendererState> ui_thread_weak_ptr_; | 99 base::WeakPtr<SharedRendererState> ui_thread_weak_ptr_; |
| 100 base::CancelableClosure request_draw_gl_cancelable_closure_; | 100 base::CancelableClosure request_draw_gl_cancelable_closure_; |
| 101 | 101 |
| 102 // Accessed by RT thread. | 102 // Accessed by RT thread. |
| 103 scoped_ptr<HardwareRenderer> hardware_renderer_; | 103 std::unique_ptr<HardwareRenderer> hardware_renderer_; |
| 104 | 104 |
| 105 // This is accessed by both UI and RT now. TODO(hush): move to RT only. | 105 // This is accessed by both UI and RT now. TODO(hush): move to RT only. |
| 106 GLViewRendererManager::Key renderer_manager_key_; | 106 GLViewRendererManager::Key renderer_manager_key_; |
| 107 | 107 |
| 108 // Accessed by both UI and RT thread. | 108 // Accessed by both UI and RT thread. |
| 109 mutable base::Lock lock_; | 109 mutable base::Lock lock_; |
| 110 bool hardware_renderer_has_frame_; | 110 bool hardware_renderer_has_frame_; |
| 111 gfx::Vector2d scroll_offset_; | 111 gfx::Vector2d scroll_offset_; |
| 112 scoped_ptr<ChildFrame> child_frame_; | 112 std::unique_ptr<ChildFrame> child_frame_; |
| 113 bool inside_hardware_release_; | 113 bool inside_hardware_release_; |
| 114 ParentCompositorDrawConstraints parent_draw_constraints_; | 114 ParentCompositorDrawConstraints parent_draw_constraints_; |
| 115 ReturnedResourcesMap returned_resources_map_; | 115 ReturnedResourcesMap returned_resources_map_; |
| 116 base::Closure request_draw_gl_closure_; | 116 base::Closure request_draw_gl_closure_; |
| 117 | 117 |
| 118 base::WeakPtrFactory<SharedRendererState> weak_factory_on_ui_thread_; | 118 base::WeakPtrFactory<SharedRendererState> weak_factory_on_ui_thread_; |
| 119 | 119 |
| 120 DISALLOW_COPY_AND_ASSIGN(SharedRendererState); | 120 DISALLOW_COPY_AND_ASSIGN(SharedRendererState); |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 } // namespace android_webview | 123 } // namespace android_webview |
| 124 | 124 |
| 125 #endif // ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ | 125 #endif // ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ |
| OLD | NEW |