Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: android_webview/browser/shared_renderer_state.h

Issue 394113002: Tiling priorities in Android Webview. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
25 namespace content {
26 class SynchronousCompositor;
27 }
28
24 namespace android_webview { 29 namespace android_webview {
25 30
26 class BrowserViewRendererClient; 31 class BrowserViewRendererClient;
27 32
28 // Set by BrowserViewRenderer and read by HardwareRenderer. 33 // Set by BrowserViewRenderer and read by HardwareRenderer.
29 struct DrawGLInput { 34 struct DrawGLInput {
30 gfx::Vector2d scroll_offset; 35 gfx::Vector2d scroll_offset;
31 int width; 36 int width;
32 int height; 37 int height;
33 cc::CompositorFrame frame; 38 cc::CompositorFrame frame;
34 39
35 DrawGLInput(); 40 DrawGLInput();
36 ~DrawGLInput(); 41 ~DrawGLInput();
37 }; 42 };
38 43
39 // This class is used to pass data between UI thread and RenderThread. 44 // This class is used to pass data between UI thread and RenderThread.
40 class SharedRendererState { 45 class SharedRendererState {
41 public: 46 public:
42 SharedRendererState(scoped_refptr<base::MessageLoopProxy> ui_loop, 47 SharedRendererState(scoped_refptr<base::MessageLoopProxy> ui_loop,
43 BrowserViewRendererClient* client); 48 BrowserViewRendererClient* client);
44 ~SharedRendererState(); 49 ~SharedRendererState();
45 50
46 void ClientRequestDrawGL(); 51 void ClientRequestDrawGL();
52 void ClientPostInvalidate();
47 53
48 void SetDrawGLInput(scoped_ptr<DrawGLInput> input); 54 void SetDrawGLInput(scoped_ptr<DrawGLInput> input);
49 scoped_ptr<DrawGLInput> PassDrawGLInput(); 55 scoped_ptr<DrawGLInput> PassDrawGLInput();
50 56
57 void PostExternalDrawConstraintsToChildCompositor(
58 const gfx::Rect& clip_,
59 const gfx::Transform& transform);
60
51 // Set by UI and read by RT. 61 // Set by UI and read by RT.
52 void SetHardwareAllowed(bool allowed); 62 void SetHardwareAllowed(bool allowed);
53 bool IsHardwareAllowed() const; 63 bool IsHardwareAllowed() const;
64 void SetParentDrawConstraintsDirty(bool dirty);
65 bool IsParentDrawConstraintsDirty();
66
67 const gfx::Rect& ParentClip() const;
68 const gfx::Transform& ParentTransform() const;
54 69
55 void SetSharedContext(gpu::GLInProcessContext* context); 70 void SetSharedContext(gpu::GLInProcessContext* context);
56 gpu::GLInProcessContext* GetSharedContext() const; 71 gpu::GLInProcessContext* GetSharedContext() const;
57 72
58 void InsertReturnedResources(const cc::ReturnedResourceArray& resources); 73 void InsertReturnedResources(const cc::ReturnedResourceArray& resources);
59 void SwapReturnedResources(cc::ReturnedResourceArray* resources); 74 void SwapReturnedResources(cc::ReturnedResourceArray* resources);
60 bool ReturnedResourcesEmpty() const; 75 bool ReturnedResourcesEmpty() const;
61 76
62 private: 77 private:
63 void ClientRequestDrawGLOnUIThread(); 78 void ClientRequestDrawGLOnUIThread();
79 void ClientPostInvalidateOnUIThread();
64 80
65 scoped_refptr<base::MessageLoopProxy> ui_loop_; 81 scoped_refptr<base::MessageLoopProxy> ui_loop_;
66 BrowserViewRendererClient* client_on_ui_; 82 BrowserViewRendererClient* client_on_ui_;
67 base::WeakPtrFactory<SharedRendererState> weak_factory_on_ui_thread_; 83 base::WeakPtrFactory<SharedRendererState> weak_factory_on_ui_thread_;
68 base::WeakPtr<SharedRendererState> ui_thread_weak_ptr_; 84 base::WeakPtr<SharedRendererState> ui_thread_weak_ptr_;
69 85
70 // Accessed by both UI and RT thread. 86 // Accessed by both UI and RT thread.
71 mutable base::Lock lock_; 87 mutable base::Lock lock_;
72 scoped_ptr<DrawGLInput> draw_gl_input_; 88 scoped_ptr<DrawGLInput> draw_gl_input_;
73 bool hardware_allowed_; 89 bool hardware_allowed_;
90 bool parent_draw_constraints_dirty_;
91 gfx::Rect parent_clip_;
92 gfx::Transform parent_transform_;
74 gpu::GLInProcessContext* share_context_; 93 gpu::GLInProcessContext* share_context_;
75 cc::ReturnedResourceArray returned_resources_; 94 cc::ReturnedResourceArray returned_resources_;
76 }; 95 };
77 96
78 } // namespace android_webview 97 } // namespace android_webview
79 98
80 #endif // ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ 99 #endif // ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698