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

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

Issue 2347563003: Added FrameFuture class (Closed)
Patch Set: Code review Created 4 years, 2 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/compositor_frame_consumer.h" 10 #include "android_webview/browser/compositor_frame_consumer.h"
(...skipping 29 matching lines...) Expand all
40 const scoped_refptr<base::SingleThreadTaskRunner>& ui_loop); 40 const scoped_refptr<base::SingleThreadTaskRunner>& ui_loop);
41 ~RenderThreadManager() override; 41 ~RenderThreadManager() override;
42 42
43 // This function can be called from any thread. 43 // This function can be called from any thread.
44 void ClientRequestInvokeGL(bool for_idle); 44 void ClientRequestInvokeGL(bool for_idle);
45 45
46 // CompositorFrameConsumer methods. 46 // CompositorFrameConsumer methods.
47 void SetCompositorFrameProducer( 47 void SetCompositorFrameProducer(
48 CompositorFrameProducer* compositor_frame_producer) override; 48 CompositorFrameProducer* compositor_frame_producer) override;
49 void SetScrollOffsetOnUI(gfx::Vector2d scroll_offset) override; 49 void SetScrollOffsetOnUI(gfx::Vector2d scroll_offset) override;
50 void SetFrameOnUI(std::unique_ptr<ChildFrame> frame) override; 50 void SetFrameOnUI(
51 std::unique_ptr<ChildFrame> frame,
52 const scoped_refptr<content::SynchronousCompositor::FrameFuture>&
53 frame_future) override;
51 void InitializeHardwareDrawIfNeededOnUI() override; 54 void InitializeHardwareDrawIfNeededOnUI() override;
52 ParentCompositorDrawConstraints GetParentDrawConstraintsOnUI() const override; 55 ParentCompositorDrawConstraints GetParentDrawConstraintsOnUI() const override;
53 void SwapReturnedResourcesOnUI( 56 void SwapReturnedResourcesOnUI(
54 ReturnedResourcesMap* returned_resource_map) override; 57 ReturnedResourcesMap* returned_resource_map) override;
55 bool ReturnedResourcesEmptyOnUI() const override; 58 bool ReturnedResourcesEmptyOnUI() const override;
56 std::unique_ptr<ChildFrame> PassUncommittedFrameOnUI() override; 59 std::unique_ptr<ChildFrame> PassUncommittedFrameOnUI() override;
57 bool HasFrameOnUI() const override; 60 bool HasFrameOnUI() const override;
58 void DeleteHardwareRendererOnUI() override; 61 void DeleteHardwareRendererOnUI() override;
59 62
60 // RT thread methods. 63 // RT thread methods.
(...skipping 10 matching lines...) Expand all
71 friend class internal::RequestInvokeGLTracker; 74 friend class internal::RequestInvokeGLTracker;
72 class InsideHardwareReleaseReset { 75 class InsideHardwareReleaseReset {
73 public: 76 public:
74 explicit InsideHardwareReleaseReset( 77 explicit InsideHardwareReleaseReset(
75 RenderThreadManager* render_thread_manager); 78 RenderThreadManager* render_thread_manager);
76 ~InsideHardwareReleaseReset(); 79 ~InsideHardwareReleaseReset();
77 80
78 private: 81 private:
79 RenderThreadManager* render_thread_manager_; 82 RenderThreadManager* render_thread_manager_;
80 }; 83 };
84 static std::unique_ptr<ChildFrame> GetSynchronousCompositorFrame(
85 scoped_refptr<content::SynchronousCompositor::FrameFuture> frame_future,
86 std::unique_ptr<ChildFrame> child_frame);
81 87
82 // RT thread method. 88 // RT thread method.
83 void DidInvokeGLProcess(); 89 void DidInvokeGLProcess();
84 bool HasFrameForHardwareRendererOnRT() const; 90 bool HasFrameForHardwareRendererOnRT() const;
85 91
86 // UI thread methods. 92 // UI thread methods.
87 void ResetRequestInvokeGLCallback(); 93 void ResetRequestInvokeGLCallback();
88 void ClientRequestInvokeGLOnUI(); 94 void ClientRequestInvokeGLOnUI();
89 void UpdateParentDrawConstraintsOnUI(); 95 void UpdateParentDrawConstraintsOnUI();
90 bool IsInsideHardwareRelease() const; 96 bool IsInsideHardwareRelease() const;
91 void SetInsideHardwareRelease(bool inside); 97 void SetInsideHardwareRelease(bool inside);
92 98
93 // Accessed by UI thread. 99 // Accessed by UI thread.
94 scoped_refptr<base::SingleThreadTaskRunner> ui_loop_; 100 scoped_refptr<base::SingleThreadTaskRunner> ui_loop_;
95 RenderThreadManagerClient* const client_; 101 RenderThreadManagerClient* const client_;
96 CompositorFrameProducer* compositor_frame_producer_; 102 CompositorFrameProducer* compositor_frame_producer_;
97 base::WeakPtr<RenderThreadManager> ui_thread_weak_ptr_; 103 base::WeakPtr<RenderThreadManager> ui_thread_weak_ptr_;
98 base::CancelableClosure request_draw_gl_cancelable_closure_; 104 base::CancelableClosure request_draw_gl_cancelable_closure_;
105 void GetSynchronousCompositorFrame();
boliu 2016/09/28 22:49:30 remove
99 106
100 // Accessed by RT thread. 107 // Accessed by RT thread.
101 std::unique_ptr<HardwareRenderer> hardware_renderer_; 108 std::unique_ptr<HardwareRenderer> hardware_renderer_;
102 109
103 // This is accessed by both UI and RT now. TODO(hush): move to RT only. 110 // This is accessed by both UI and RT now. TODO(hush): move to RT only.
104 GLViewRendererManager::Key renderer_manager_key_; 111 GLViewRendererManager::Key renderer_manager_key_;
105 112
106 // Accessed by both UI and RT thread. 113 // Accessed by both UI and RT thread.
107 mutable base::Lock lock_; 114 mutable base::Lock lock_;
108 bool hardware_renderer_has_frame_; 115 bool hardware_renderer_has_frame_;
109 gfx::Vector2d scroll_offset_; 116 gfx::Vector2d scroll_offset_;
110 std::unique_ptr<ChildFrame> child_frame_; 117 std::unique_ptr<ChildFrame> child_frame_;
118 const bool async_on_draw_hardware_;
119 scoped_refptr<content::SynchronousCompositor::FrameFuture> frame_future_;
111 bool inside_hardware_release_; 120 bool inside_hardware_release_;
112 ParentCompositorDrawConstraints parent_draw_constraints_; 121 ParentCompositorDrawConstraints parent_draw_constraints_;
113 ReturnedResourcesMap returned_resources_map_; 122 ReturnedResourcesMap returned_resources_map_;
114 base::Closure request_draw_gl_closure_; 123 base::Closure request_draw_gl_closure_;
115 124
116 base::WeakPtrFactory<RenderThreadManager> weak_factory_on_ui_thread_; 125 base::WeakPtrFactory<RenderThreadManager> weak_factory_on_ui_thread_;
117 126
118 DISALLOW_COPY_AND_ASSIGN(RenderThreadManager); 127 DISALLOW_COPY_AND_ASSIGN(RenderThreadManager);
119 }; 128 };
120 129
121 } // namespace android_webview 130 } // namespace android_webview
122 131
123 #endif // ANDROID_WEBVIEW_BROWSER_RENDER_THREAD_MANAGER_H_ 132 #endif // ANDROID_WEBVIEW_BROWSER_RENDER_THREAD_MANAGER_H_
OLDNEW
« no previous file with comments | « android_webview/browser/compositor_frame_consumer.h ('k') | android_webview/browser/render_thread_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698