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" |
| 16 #include "ui/gfx/transform.h" |
15 | 17 |
16 namespace cc { | 18 namespace cc { |
17 class CompositorFrameAck; | 19 class CompositorFrameAck; |
18 } | 20 } |
19 | 21 |
20 namespace gpu { | 22 namespace gpu { |
21 class GLInProcessContext; | 23 class GLInProcessContext; |
22 } | 24 } |
23 | 25 |
24 namespace android_webview { | 26 namespace android_webview { |
(...skipping 12 matching lines...) Expand all Loading... |
37 }; | 39 }; |
38 | 40 |
39 // This class is used to pass data between UI thread and RenderThread. | 41 // This class is used to pass data between UI thread and RenderThread. |
40 class SharedRendererState { | 42 class SharedRendererState { |
41 public: | 43 public: |
42 SharedRendererState(scoped_refptr<base::MessageLoopProxy> ui_loop, | 44 SharedRendererState(scoped_refptr<base::MessageLoopProxy> ui_loop, |
43 BrowserViewRendererClient* client); | 45 BrowserViewRendererClient* client); |
44 ~SharedRendererState(); | 46 ~SharedRendererState(); |
45 | 47 |
46 void ClientRequestDrawGL(); | 48 void ClientRequestDrawGL(); |
| 49 void ClientPostInvalidate(); |
47 | 50 |
48 void SetDrawGLInput(scoped_ptr<DrawGLInput> input); | 51 void SetDrawGLInput(scoped_ptr<DrawGLInput> input); |
49 scoped_ptr<DrawGLInput> PassDrawGLInput(); | 52 scoped_ptr<DrawGLInput> PassDrawGLInput(); |
50 | 53 |
| 54 void PostExternalDrawConstraintsToChildCompositor( |
| 55 const ParentCompositorDrawConstraints& parent_draw_constraints); |
| 56 |
51 // Set by UI and read by RT. | 57 // Set by UI and read by RT. |
52 void SetHardwareAllowed(bool allowed); | 58 void SetHardwareAllowed(bool allowed); |
53 bool IsHardwareAllowed() const; | 59 bool IsHardwareAllowed() const; |
54 | 60 |
| 61 const gfx::Rect& ParentClip() const; |
| 62 const ParentCompositorDrawConstraints& ParentDrawConstraints() const; |
| 63 |
55 void SetSharedContext(gpu::GLInProcessContext* context); | 64 void SetSharedContext(gpu::GLInProcessContext* context); |
56 gpu::GLInProcessContext* GetSharedContext() const; | 65 gpu::GLInProcessContext* GetSharedContext() const; |
57 | 66 |
58 void InsertReturnedResources(const cc::ReturnedResourceArray& resources); | 67 void InsertReturnedResources(const cc::ReturnedResourceArray& resources); |
59 void SwapReturnedResources(cc::ReturnedResourceArray* resources); | 68 void SwapReturnedResources(cc::ReturnedResourceArray* resources); |
60 bool ReturnedResourcesEmpty() const; | 69 bool ReturnedResourcesEmpty() const; |
61 | 70 |
62 private: | 71 private: |
63 void ClientRequestDrawGLOnUIThread(); | 72 void ClientRequestDrawGLOnUIThread(); |
| 73 void ClientPostInvalidateOnUIThread(); |
64 | 74 |
65 scoped_refptr<base::MessageLoopProxy> ui_loop_; | 75 scoped_refptr<base::MessageLoopProxy> ui_loop_; |
66 BrowserViewRendererClient* client_on_ui_; | 76 BrowserViewRendererClient* client_on_ui_; |
67 base::WeakPtrFactory<SharedRendererState> weak_factory_on_ui_thread_; | 77 base::WeakPtrFactory<SharedRendererState> weak_factory_on_ui_thread_; |
68 base::WeakPtr<SharedRendererState> ui_thread_weak_ptr_; | 78 base::WeakPtr<SharedRendererState> ui_thread_weak_ptr_; |
69 | 79 |
70 // Accessed by both UI and RT thread. | 80 // Accessed by both UI and RT thread. |
71 mutable base::Lock lock_; | 81 mutable base::Lock lock_; |
72 scoped_ptr<DrawGLInput> draw_gl_input_; | 82 scoped_ptr<DrawGLInput> draw_gl_input_; |
73 bool hardware_allowed_; | 83 bool hardware_allowed_; |
| 84 ParentCompositorDrawConstraints parent_draw_constraints_; |
74 gpu::GLInProcessContext* share_context_; | 85 gpu::GLInProcessContext* share_context_; |
75 cc::ReturnedResourceArray returned_resources_; | 86 cc::ReturnedResourceArray returned_resources_; |
76 }; | 87 }; |
77 | 88 |
78 } // namespace android_webview | 89 } // namespace android_webview |
79 | 90 |
80 #endif // ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ | 91 #endif // ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ |
OLD | NEW |