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

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

Issue 1904453004: Transfer DrawGLFunctor ownership from AwContents to AwGLFunctor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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_RENDER_THREAD_MANAGER_H_ 5 #ifndef ANDROID_WEBVIEW_BROWSER_RENDER_THREAD_MANAGER_H_
6 #define ANDROID_WEBVIEW_BROWSER_RENDER_THREAD_MANAGER_H_ 6 #define ANDROID_WEBVIEW_BROWSER_RENDER_THREAD_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "android_webview/browser/gl_view_renderer_manager.h" 10 #include "android_webview/browser/gl_view_renderer_manager.h"
11 #include "android_webview/browser/parent_compositor_draw_constraints.h" 11 #include "android_webview/browser/parent_compositor_draw_constraints.h"
12 #include "base/cancelable_callback.h" 12 #include "base/cancelable_callback.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
16 #include "base/synchronization/lock.h" 16 #include "base/synchronization/lock.h"
17 #include "cc/output/compositor_frame_ack.h" 17 #include "cc/output/compositor_frame_ack.h"
18 #include "ui/gfx/geometry/rect.h" 18 #include "ui/gfx/geometry/rect.h"
19 #include "ui/gfx/geometry/vector2d.h" 19 #include "ui/gfx/geometry/vector2d.h"
20 20
21 struct AwDrawGLInfo; 21 struct AwDrawGLInfo;
22 namespace android_webview { 22 namespace android_webview {
23 23
24 namespace internal { 24 namespace internal {
25 class RequestDrawGLTracker; 25 class RequestInvokeGLTracker;
26 } 26 }
27 27
28 class RenderThreadManagerClient; 28 class RenderThreadManagerClient;
29 class ChildFrame; 29 class ChildFrame;
30 class HardwareRenderer; 30 class HardwareRenderer;
31 class InsideHardwareReleaseReset; 31 class InsideHardwareReleaseReset;
32 32
33 // This class is used to pass data between UI thread and RenderThread. 33 // This class is used to pass data between UI thread and RenderThread.
34 class RenderThreadManager { 34 class RenderThreadManager {
35 public: 35 public:
36 struct ReturnedResources { 36 struct ReturnedResources {
37 ReturnedResources(); 37 ReturnedResources();
38 ~ReturnedResources(); 38 ~ReturnedResources();
39 39
40 uint32_t output_surface_id; 40 uint32_t output_surface_id;
41 cc::ReturnedResourceArray resources; 41 cc::ReturnedResourceArray resources;
42 }; 42 };
43 using ReturnedResourcesMap = std::map<uint32_t, ReturnedResources>; 43 using ReturnedResourcesMap = std::map<uint32_t, ReturnedResources>;
44 44
45 RenderThreadManager( 45 RenderThreadManager(
46 RenderThreadManagerClient* client, 46 RenderThreadManagerClient* client,
47 const scoped_refptr<base::SingleThreadTaskRunner>& ui_loop); 47 const scoped_refptr<base::SingleThreadTaskRunner>& ui_loop);
48 ~RenderThreadManager(); 48 ~RenderThreadManager();
49 49
50 // This function can be called from any thread. 50 // This function can be called from any thread.
51 void ClientRequestDrawGL(bool for_idle); 51 void ClientRequestInvokeGL(bool for_idle);
52 52
53 // UI thread methods. 53 // UI thread methods.
54 void SetScrollOffsetOnUI(gfx::Vector2d scroll_offset); 54 void SetScrollOffsetOnUI(gfx::Vector2d scroll_offset);
55 void SetFrameOnUI(std::unique_ptr<ChildFrame> frame); 55 void SetFrameOnUI(std::unique_ptr<ChildFrame> frame);
56 void InitializeHardwareDrawIfNeededOnUI(); 56 void InitializeHardwareDrawIfNeededOnUI();
57 ParentCompositorDrawConstraints GetParentDrawConstraintsOnUI() const; 57 ParentCompositorDrawConstraints GetParentDrawConstraintsOnUI() const;
58 void SwapReturnedResourcesOnUI(ReturnedResourcesMap* returned_resource_map); 58 void SwapReturnedResourcesOnUI(ReturnedResourcesMap* returned_resource_map);
59 bool ReturnedResourcesEmptyOnUI() const; 59 bool ReturnedResourcesEmptyOnUI() const;
60 std::unique_ptr<ChildFrame> PassUncommittedFrameOnUI(); 60 std::unique_ptr<ChildFrame> PassUncommittedFrameOnUI();
61 bool HasFrameOnUI() const; 61 bool HasFrameOnUI() const;
62 void DeleteHardwareRendererOnUI(); 62 void DeleteHardwareRendererOnUI();
63 63
64 // RT thread methods. 64 // RT thread methods.
65 gfx::Vector2d GetScrollOffsetOnRT(); 65 gfx::Vector2d GetScrollOffsetOnRT();
66 std::unique_ptr<ChildFrame> PassFrameOnRT(); 66 std::unique_ptr<ChildFrame> PassFrameOnRT();
67 void DrawGL(AwDrawGLInfo* draw_info); 67 void DrawGL(AwDrawGLInfo* draw_info);
68 void PostExternalDrawConstraintsToChildCompositorOnRT( 68 void PostExternalDrawConstraintsToChildCompositorOnRT(
69 const ParentCompositorDrawConstraints& parent_draw_constraints); 69 const ParentCompositorDrawConstraints& parent_draw_constraints);
70 void InsertReturnedResourcesOnRT(const cc::ReturnedResourceArray& resources, 70 void InsertReturnedResourcesOnRT(const cc::ReturnedResourceArray& resources,
71 uint32_t compositor_id, 71 uint32_t compositor_id,
72 uint32_t output_surface_id); 72 uint32_t output_surface_id);
73 73
74 private: 74 private:
75 friend class internal::RequestDrawGLTracker; 75 friend class internal::RequestInvokeGLTracker;
76 class InsideHardwareReleaseReset { 76 class InsideHardwareReleaseReset {
77 public: 77 public:
78 explicit InsideHardwareReleaseReset( 78 explicit InsideHardwareReleaseReset(
79 RenderThreadManager* render_thread_manager); 79 RenderThreadManager* render_thread_manager);
80 ~InsideHardwareReleaseReset(); 80 ~InsideHardwareReleaseReset();
81 81
82 private: 82 private:
83 RenderThreadManager* render_thread_manager_; 83 RenderThreadManager* render_thread_manager_;
84 }; 84 };
85 85
86 // RT thread method. 86 // RT thread method.
87 void DidDrawGLProcess(); 87 void DidInvokeGLProcess();
88 bool HasFrameForHardwareRendererOnRT() const; 88 bool HasFrameForHardwareRendererOnRT() const;
89 89
90 // UI thread methods. 90 // UI thread methods.
91 void ResetRequestDrawGLCallback(); 91 void ResetRequestInvokeGLCallback();
92 void ClientRequestDrawGLOnUI(); 92 void ClientRequestInvokeGLOnUI();
93 void UpdateParentDrawConstraintsOnUI(); 93 void UpdateParentDrawConstraintsOnUI();
94 bool IsInsideHardwareRelease() const; 94 bool IsInsideHardwareRelease() const;
95 void SetInsideHardwareRelease(bool inside); 95 void SetInsideHardwareRelease(bool inside);
96 96
97 // Accessed by UI thread. 97 // Accessed by UI thread.
98 scoped_refptr<base::SingleThreadTaskRunner> ui_loop_; 98 scoped_refptr<base::SingleThreadTaskRunner> ui_loop_;
99 RenderThreadManagerClient* const client_; 99 RenderThreadManagerClient* const client_;
100 base::WeakPtr<RenderThreadManager> ui_thread_weak_ptr_; 100 base::WeakPtr<RenderThreadManager> ui_thread_weak_ptr_;
101 base::CancelableClosure request_draw_gl_cancelable_closure_; 101 base::CancelableClosure request_draw_gl_cancelable_closure_;
102 102
(...skipping 14 matching lines...) Expand all
117 base::Closure request_draw_gl_closure_; 117 base::Closure request_draw_gl_closure_;
118 118
119 base::WeakPtrFactory<RenderThreadManager> weak_factory_on_ui_thread_; 119 base::WeakPtrFactory<RenderThreadManager> weak_factory_on_ui_thread_;
120 120
121 DISALLOW_COPY_AND_ASSIGN(RenderThreadManager); 121 DISALLOW_COPY_AND_ASSIGN(RenderThreadManager);
122 }; 122 };
123 123
124 } // namespace android_webview 124 } // namespace android_webview
125 125
126 #endif // ANDROID_WEBVIEW_BROWSER_RENDER_THREAD_MANAGER_H_ 126 #endif // ANDROID_WEBVIEW_BROWSER_RENDER_THREAD_MANAGER_H_
OLDNEW
« no previous file with comments | « android_webview/browser/deferred_gpu_command_service.cc ('k') | android_webview/browser/render_thread_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698