| 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 "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 9 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
| 11 #include "cc/output/compositor_frame.h" | 12 #include "cc/output/compositor_frame.h" |
| 12 #include "cc/output/compositor_frame_ack.h" | 13 #include "cc/output/compositor_frame_ack.h" |
| 13 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
| 14 #include "ui/gfx/geometry/vector2d.h" | 15 #include "ui/gfx/geometry/vector2d.h" |
| 15 | 16 |
| 16 namespace cc { | 17 namespace cc { |
| 17 class CompositorFrameAck; | 18 class CompositorFrameAck; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 43 SharedRendererState(scoped_refptr<base::MessageLoopProxy> ui_loop, | 44 SharedRendererState(scoped_refptr<base::MessageLoopProxy> ui_loop, |
| 44 BrowserViewRendererClient* client); | 45 BrowserViewRendererClient* client); |
| 45 ~SharedRendererState(); | 46 ~SharedRendererState(); |
| 46 | 47 |
| 47 void ClientRequestDrawGL(); | 48 void ClientRequestDrawGL(); |
| 48 | 49 |
| 49 void SetDrawGLInput(scoped_ptr<DrawGLInput> input); | 50 void SetDrawGLInput(scoped_ptr<DrawGLInput> input); |
| 50 scoped_ptr<DrawGLInput> PassDrawGLInput(); | 51 scoped_ptr<DrawGLInput> PassDrawGLInput(); |
| 51 | 52 |
| 52 bool IsInsideHardwareRelease() const; | 53 bool IsInsideHardwareRelease() const; |
| 54 void PostExternalDrawConstraintsToChildCompositor( |
| 55 const ParentCompositorDrawConstraints& parent_draw_constraints); |
| 56 |
| 57 const ParentCompositorDrawConstraints ParentDrawConstraints() const; |
| 53 | 58 |
| 54 void SetSharedContext(gpu::GLInProcessContext* context); | 59 void SetSharedContext(gpu::GLInProcessContext* context); |
| 55 gpu::GLInProcessContext* GetSharedContext() const; | 60 gpu::GLInProcessContext* GetSharedContext() const; |
| 56 | 61 |
| 57 void InsertReturnedResources(const cc::ReturnedResourceArray& resources); | 62 void InsertReturnedResources(const cc::ReturnedResourceArray& resources); |
| 58 void SwapReturnedResources(cc::ReturnedResourceArray* resources); | 63 void SwapReturnedResources(cc::ReturnedResourceArray* resources); |
| 59 bool ReturnedResourcesEmpty() const; | 64 bool ReturnedResourcesEmpty() const; |
| 60 | 65 |
| 61 private: | 66 private: |
| 62 friend class InsideHardwareReleaseReset; | 67 friend class InsideHardwareReleaseReset; |
| 63 | 68 |
| 64 void ClientRequestDrawGLOnUIThread(); | 69 void ClientRequestDrawGLOnUIThread(); |
| 70 void UpdateParentDrawConstraintsOnUIThread(); |
| 65 void SetInsideHardwareRelease(bool inside); | 71 void SetInsideHardwareRelease(bool inside); |
| 66 | 72 |
| 67 scoped_refptr<base::MessageLoopProxy> ui_loop_; | 73 scoped_refptr<base::MessageLoopProxy> ui_loop_; |
| 68 BrowserViewRendererClient* client_on_ui_; | 74 BrowserViewRendererClient* client_on_ui_; |
| 69 base::WeakPtrFactory<SharedRendererState> weak_factory_on_ui_thread_; | 75 base::WeakPtrFactory<SharedRendererState> weak_factory_on_ui_thread_; |
| 70 base::WeakPtr<SharedRendererState> ui_thread_weak_ptr_; | 76 base::WeakPtr<SharedRendererState> ui_thread_weak_ptr_; |
| 71 | 77 |
| 72 // Accessed by both UI and RT thread. | 78 // Accessed by both UI and RT thread. |
| 73 mutable base::Lock lock_; | 79 mutable base::Lock lock_; |
| 74 scoped_ptr<DrawGLInput> draw_gl_input_; | 80 scoped_ptr<DrawGLInput> draw_gl_input_; |
| 75 bool inside_hardware_release_; | 81 bool inside_hardware_release_; |
| 82 ParentCompositorDrawConstraints parent_draw_constraints_; |
| 76 gpu::GLInProcessContext* share_context_; | 83 gpu::GLInProcessContext* share_context_; |
| 77 cc::ReturnedResourceArray returned_resources_; | 84 cc::ReturnedResourceArray returned_resources_; |
| 78 | 85 |
| 79 DISALLOW_COPY_AND_ASSIGN(SharedRendererState); | 86 DISALLOW_COPY_AND_ASSIGN(SharedRendererState); |
| 80 }; | 87 }; |
| 81 | 88 |
| 82 class InsideHardwareReleaseReset { | 89 class InsideHardwareReleaseReset { |
| 83 public: | 90 public: |
| 84 explicit InsideHardwareReleaseReset( | 91 explicit InsideHardwareReleaseReset( |
| 85 SharedRendererState* shared_renderer_state); | 92 SharedRendererState* shared_renderer_state); |
| 86 ~InsideHardwareReleaseReset(); | 93 ~InsideHardwareReleaseReset(); |
| 87 | 94 |
| 88 private: | 95 private: |
| 89 SharedRendererState* shared_renderer_state_; | 96 SharedRendererState* shared_renderer_state_; |
| 90 | 97 |
| 91 DISALLOW_COPY_AND_ASSIGN(InsideHardwareReleaseReset); | 98 DISALLOW_COPY_AND_ASSIGN(InsideHardwareReleaseReset); |
| 92 }; | 99 }; |
| 93 | 100 |
| 94 } // namespace android_webview | 101 } // namespace android_webview |
| 95 | 102 |
| 96 #endif // ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ | 103 #endif // ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ |
| OLD | NEW |