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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 scoped_ptr<DrawGLInput> PassDrawGLInput(); | 57 scoped_ptr<DrawGLInput> PassDrawGLInput(); |
58 | 58 |
59 bool IsInsideHardwareRelease() const; | 59 bool IsInsideHardwareRelease() const; |
60 void UpdateDrawConstraints( | 60 void UpdateDrawConstraints( |
61 const ParentCompositorDrawConstraints& parent_draw_constraints); | 61 const ParentCompositorDrawConstraints& parent_draw_constraints); |
62 void PostExternalDrawConstraintsToChildCompositor( | 62 void PostExternalDrawConstraintsToChildCompositor( |
63 const ParentCompositorDrawConstraints& parent_draw_constraints); | 63 const ParentCompositorDrawConstraints& parent_draw_constraints); |
64 | 64 |
65 const ParentCompositorDrawConstraints ParentDrawConstraints() const; | 65 const ParentCompositorDrawConstraints ParentDrawConstraints() const; |
66 | 66 |
67 void SetSharedContext(gpu::GLInProcessContext* context); | |
68 gpu::GLInProcessContext* GetSharedContext() const; | |
69 | |
70 void InsertReturnedResources(const cc::ReturnedResourceArray& resources); | 67 void InsertReturnedResources(const cc::ReturnedResourceArray& resources); |
71 void SwapReturnedResources(cc::ReturnedResourceArray* resources); | 68 void SwapReturnedResources(cc::ReturnedResourceArray* resources); |
72 bool ReturnedResourcesEmpty() const; | 69 bool ReturnedResourcesEmpty() const; |
73 | 70 |
74 private: | 71 private: |
75 friend class InsideHardwareReleaseReset; | 72 friend class InsideHardwareReleaseReset; |
76 friend class internal::RequestDrawGLTracker; | 73 friend class internal::RequestDrawGLTracker; |
77 | 74 |
78 void ResetRequestDrawGLCallback(); | 75 void ResetRequestDrawGLCallback(); |
79 void ClientRequestDrawGLOnUIThread(); | 76 void ClientRequestDrawGLOnUIThread(); |
80 void UpdateParentDrawConstraintsOnUIThread(); | 77 void UpdateParentDrawConstraintsOnUIThread(); |
81 void SetInsideHardwareRelease(bool inside); | 78 void SetInsideHardwareRelease(bool inside); |
82 | 79 |
83 scoped_refptr<base::MessageLoopProxy> ui_loop_; | 80 scoped_refptr<base::MessageLoopProxy> ui_loop_; |
84 BrowserViewRendererClient* client_on_ui_; | 81 BrowserViewRendererClient* client_on_ui_; |
85 base::WeakPtrFactory<SharedRendererState> weak_factory_on_ui_thread_; | 82 base::WeakPtrFactory<SharedRendererState> weak_factory_on_ui_thread_; |
86 base::WeakPtr<SharedRendererState> ui_thread_weak_ptr_; | 83 base::WeakPtr<SharedRendererState> ui_thread_weak_ptr_; |
87 base::CancelableClosure request_draw_gl_cancelable_closure_; | 84 base::CancelableClosure request_draw_gl_cancelable_closure_; |
88 | 85 |
89 // Accessed by both UI and RT thread. | 86 // Accessed by both UI and RT thread. |
90 mutable base::Lock lock_; | 87 mutable base::Lock lock_; |
91 scoped_ptr<DrawGLInput> draw_gl_input_; | 88 scoped_ptr<DrawGLInput> draw_gl_input_; |
92 bool inside_hardware_release_; | 89 bool inside_hardware_release_; |
93 ParentCompositorDrawConstraints parent_draw_constraints_; | 90 ParentCompositorDrawConstraints parent_draw_constraints_; |
94 gpu::GLInProcessContext* share_context_; | |
95 cc::ReturnedResourceArray returned_resources_; | 91 cc::ReturnedResourceArray returned_resources_; |
96 base::Closure request_draw_gl_closure_; | 92 base::Closure request_draw_gl_closure_; |
97 | 93 |
98 DISALLOW_COPY_AND_ASSIGN(SharedRendererState); | 94 DISALLOW_COPY_AND_ASSIGN(SharedRendererState); |
99 }; | 95 }; |
100 | 96 |
101 class InsideHardwareReleaseReset { | 97 class InsideHardwareReleaseReset { |
102 public: | 98 public: |
103 explicit InsideHardwareReleaseReset( | 99 explicit InsideHardwareReleaseReset( |
104 SharedRendererState* shared_renderer_state); | 100 SharedRendererState* shared_renderer_state); |
105 ~InsideHardwareReleaseReset(); | 101 ~InsideHardwareReleaseReset(); |
106 | 102 |
107 private: | 103 private: |
108 SharedRendererState* shared_renderer_state_; | 104 SharedRendererState* shared_renderer_state_; |
109 | 105 |
110 DISALLOW_COPY_AND_ASSIGN(InsideHardwareReleaseReset); | 106 DISALLOW_COPY_AND_ASSIGN(InsideHardwareReleaseReset); |
111 }; | 107 }; |
112 | 108 |
113 } // namespace android_webview | 109 } // namespace android_webview |
114 | 110 |
115 #endif // ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ | 111 #endif // ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ |
OLD | NEW |