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