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 "android_webview/browser/parent_compositor_draw_constraints.h" | 8 #include "android_webview/browser/parent_compositor_draw_constraints.h" |
9 #include "base/cancelable_callback.h" | 9 #include "base/cancelable_callback.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 ~SharedRendererState(); | 51 ~SharedRendererState(); |
52 | 52 |
53 void ClientRequestDrawGL(); | 53 void ClientRequestDrawGL(); |
54 void DidDrawGLProcess(); | 54 void DidDrawGLProcess(); |
55 | 55 |
56 bool HasDrawGLInput() const; | 56 bool HasDrawGLInput() const; |
57 void SetDrawGLInput(scoped_ptr<DrawGLInput> input); | 57 void SetDrawGLInput(scoped_ptr<DrawGLInput> input); |
58 scoped_ptr<DrawGLInput> PassDrawGLInput(); | 58 scoped_ptr<DrawGLInput> PassDrawGLInput(); |
59 | 59 |
60 bool IsInsideHardwareRelease() const; | 60 bool IsInsideHardwareRelease() const; |
61 void UpdateDrawConstraints( | 61 // Returns true if the draw constraints are updated. |
| 62 bool UpdateDrawConstraints( |
62 const ParentCompositorDrawConstraints& parent_draw_constraints); | 63 const ParentCompositorDrawConstraints& parent_draw_constraints); |
63 void PostExternalDrawConstraintsToChildCompositor( | 64 void PostExternalDrawConstraintsToChildCompositor( |
64 const ParentCompositorDrawConstraints& parent_draw_constraints); | 65 const ParentCompositorDrawConstraints& parent_draw_constraints); |
65 | 66 |
66 const ParentCompositorDrawConstraints ParentDrawConstraints() const; | 67 const ParentCompositorDrawConstraints ParentDrawConstraints() const; |
67 | 68 |
| 69 void SetForceInvalidateOnNextDrawGL( |
| 70 bool needs_force_invalidate_on_next_draw_gl); |
| 71 bool NeedsForceInvalidateOnNextDrawGL() const; |
| 72 |
68 void InsertReturnedResources(const cc::ReturnedResourceArray& resources); | 73 void InsertReturnedResources(const cc::ReturnedResourceArray& resources); |
69 void SwapReturnedResources(cc::ReturnedResourceArray* resources); | 74 void SwapReturnedResources(cc::ReturnedResourceArray* resources); |
70 bool ReturnedResourcesEmpty() const; | 75 bool ReturnedResourcesEmpty() const; |
71 | 76 |
72 private: | 77 private: |
73 friend class InsideHardwareReleaseReset; | 78 friend class InsideHardwareReleaseReset; |
74 friend class internal::RequestDrawGLTracker; | 79 friend class internal::RequestDrawGLTracker; |
75 | 80 |
76 void ResetRequestDrawGLCallback(); | 81 void ResetRequestDrawGLCallback(); |
77 void ClientRequestDrawGLOnUIThread(); | 82 void ClientRequestDrawGLOnUIThread(); |
78 void UpdateParentDrawConstraintsOnUIThread(); | 83 void UpdateParentDrawConstraintsOnUIThread(); |
79 void SetInsideHardwareRelease(bool inside); | 84 void SetInsideHardwareRelease(bool inside); |
80 | 85 |
81 scoped_refptr<base::MessageLoopProxy> ui_loop_; | 86 scoped_refptr<base::MessageLoopProxy> ui_loop_; |
82 BrowserViewRendererClient* client_on_ui_; | 87 BrowserViewRendererClient* client_on_ui_; |
83 base::WeakPtr<SharedRendererState> ui_thread_weak_ptr_; | 88 base::WeakPtr<SharedRendererState> ui_thread_weak_ptr_; |
84 base::CancelableClosure request_draw_gl_cancelable_closure_; | 89 base::CancelableClosure request_draw_gl_cancelable_closure_; |
85 | 90 |
86 // Accessed by both UI and RT thread. | 91 // Accessed by both UI and RT thread. |
87 mutable base::Lock lock_; | 92 mutable base::Lock lock_; |
88 scoped_ptr<DrawGLInput> draw_gl_input_; | 93 scoped_ptr<DrawGLInput> draw_gl_input_; |
89 bool inside_hardware_release_; | 94 bool inside_hardware_release_; |
| 95 bool needs_force_invalidate_on_next_draw_gl_; |
90 ParentCompositorDrawConstraints parent_draw_constraints_; | 96 ParentCompositorDrawConstraints parent_draw_constraints_; |
91 cc::ReturnedResourceArray returned_resources_; | 97 cc::ReturnedResourceArray returned_resources_; |
92 base::Closure request_draw_gl_closure_; | 98 base::Closure request_draw_gl_closure_; |
93 | 99 |
94 base::WeakPtrFactory<SharedRendererState> weak_factory_on_ui_thread_; | 100 base::WeakPtrFactory<SharedRendererState> weak_factory_on_ui_thread_; |
95 | 101 |
96 DISALLOW_COPY_AND_ASSIGN(SharedRendererState); | 102 DISALLOW_COPY_AND_ASSIGN(SharedRendererState); |
97 }; | 103 }; |
98 | 104 |
99 class InsideHardwareReleaseReset { | 105 class InsideHardwareReleaseReset { |
100 public: | 106 public: |
101 explicit InsideHardwareReleaseReset( | 107 explicit InsideHardwareReleaseReset( |
102 SharedRendererState* shared_renderer_state); | 108 SharedRendererState* shared_renderer_state); |
103 ~InsideHardwareReleaseReset(); | 109 ~InsideHardwareReleaseReset(); |
104 | 110 |
105 private: | 111 private: |
106 SharedRendererState* shared_renderer_state_; | 112 SharedRendererState* shared_renderer_state_; |
107 | 113 |
108 DISALLOW_COPY_AND_ASSIGN(InsideHardwareReleaseReset); | 114 DISALLOW_COPY_AND_ASSIGN(InsideHardwareReleaseReset); |
109 }; | 115 }; |
110 | 116 |
111 } // namespace android_webview | 117 } // namespace android_webview |
112 | 118 |
113 #endif // ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ | 119 #endif // ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ |
OLD | NEW |