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

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

Issue 1943963003: WIP Handle AwContents needing multiple live functors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Testing framework changes to support testing multiple RenderThreadManager instances. Created 4 years, 7 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_BROWSER_VIEW_RENDERER_H_ 5 #ifndef ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_
6 #define ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ 6 #define ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
11 #include <set>
11 12
12 #include "android_webview/browser/compositor_frame_producer.h" 13 #include "android_webview/browser/compositor_frame_producer.h"
13 #include "android_webview/browser/parent_compositor_draw_constraints.h" 14 #include "android_webview/browser/parent_compositor_draw_constraints.h"
14 #include "base/callback.h" 15 #include "base/callback.h"
15 #include "base/cancelable_callback.h" 16 #include "base/cancelable_callback.h"
16 #include "base/macros.h" 17 #include "base/macros.h"
17 #include "base/trace_event/trace_event.h" 18 #include "base/trace_event/trace_event.h"
18 #include "content/public/browser/android/synchronous_compositor.h" 19 #include "content/public/browser/android/synchronous_compositor.h"
19 #include "content/public/browser/android/synchronous_compositor_client.h" 20 #include "content/public/browser/android/synchronous_compositor_client.h"
20 #include "third_party/skia/include/core/SkRefCnt.h" 21 #include "third_party/skia/include/core/SkRefCnt.h"
(...skipping 24 matching lines...) Expand all
45 content::WebContents* web_contents); 46 content::WebContents* web_contents);
46 47
47 BrowserViewRenderer( 48 BrowserViewRenderer(
48 BrowserViewRendererClient* client, 49 BrowserViewRendererClient* client,
49 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner); 50 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner);
50 51
51 ~BrowserViewRenderer() override; 52 ~BrowserViewRenderer() override;
52 53
53 void RegisterWithWebContents(content::WebContents* web_contents); 54 void RegisterWithWebContents(content::WebContents* web_contents);
54 55
55 // The BrowserViewRenderer client is responsible for ensuring that the 56 // The BrowserViewRenderer client is responsible for ensuring that
56 // CompositorFrameConsumer has been set correctly via this method. 57 // the current compositor frame consumer has been set correctly via
57 void SetCompositorFrameConsumer( 58 // this method. The consumer is added to the set of registered
59 // consumers if it is not already registered.
60 void SetCurrentCompositorFrameConsumer(
58 CompositorFrameConsumer* compositor_frame_consumer); 61 CompositorFrameConsumer* compositor_frame_consumer);
62 CompositorFrameConsumer* current_compositor_frame_consumer() {
boliu 2016/05/10 15:18:19 not used?
Tobias Sargeant 2016/05/13 13:23:56 Removed.
63 return current_compositor_frame_consumer_;
64 }
59 65
60 // Called before either OnDrawHardware or OnDrawSoftware to set the view 66 // Called before either OnDrawHardware or OnDrawSoftware to set the view
61 // state of this frame. |scroll| is the view's current scroll offset. 67 // state of this frame. |scroll| is the view's current scroll offset.
62 // |global_visible_rect| is the intersection of the view size and the window 68 // |global_visible_rect| is the intersection of the view size and the window
63 // in window coordinates. 69 // in window coordinates.
64 void PrepareToDraw(const gfx::Vector2d& scroll, 70 void PrepareToDraw(const gfx::Vector2d& scroll,
65 const gfx::Rect& global_visible_rect); 71 const gfx::Rect& global_visible_rect);
66 72
67 // Main handlers for view drawing. A false return value indicates no new 73 // Main handlers for view drawing. A false return value indicates no new
68 // frame is produced. 74 // frame is produced.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 const gfx::Vector2dF& max_scroll_offset_dip, 123 const gfx::Vector2dF& max_scroll_offset_dip,
118 const gfx::SizeF& scrollable_size_dip, 124 const gfx::SizeF& scrollable_size_dip,
119 float page_scale_factor, 125 float page_scale_factor,
120 float min_page_scale_factor, 126 float min_page_scale_factor,
121 float max_page_scale_factor) override; 127 float max_page_scale_factor) override;
122 void DidOverscroll(const gfx::Vector2dF& accumulated_overscroll, 128 void DidOverscroll(const gfx::Vector2dF& accumulated_overscroll,
123 const gfx::Vector2dF& latest_overscroll_delta, 129 const gfx::Vector2dF& latest_overscroll_delta,
124 const gfx::Vector2dF& current_fling_velocity) override; 130 const gfx::Vector2dF& current_fling_velocity) override;
125 131
126 // CompositorFrameProducer overrides 132 // CompositorFrameProducer overrides
127 void OnParentDrawConstraintsUpdated() override; 133 void OnParentDrawConstraintsUpdated(
128 void OnCompositorFrameConsumerWillDestroy() override; 134 CompositorFrameConsumer* compositor_frame_consumer) override;
135 void RemoveCompositorFrameConsumer(
136 CompositorFrameConsumer* compositor_frame_consumer) override;
129 137
130 private: 138 private:
131 void SetTotalRootLayerScrollOffset(const gfx::Vector2dF& new_value_dip); 139 void SetTotalRootLayerScrollOffset(const gfx::Vector2dF& new_value_dip);
132 bool CanOnDraw(); 140 bool CanOnDraw();
133 void UpdateCompositorIsActive(); 141 void UpdateCompositorIsActive();
134 bool CompositeSW(SkCanvas* canvas); 142 bool CompositeSW(SkCanvas* canvas);
135 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> 143 std::unique_ptr<base::trace_event::ConvertableToTraceFormat>
136 RootLayerStateAsValue(const gfx::Vector2dF& total_scroll_offset_dip, 144 RootLayerStateAsValue(const gfx::Vector2dF& total_scroll_offset_dip,
137 const gfx::SizeF& scrollable_size_dip); 145 const gfx::SizeF& scrollable_size_dip);
138 146
139 void ReturnUnusedResource(std::unique_ptr<ChildFrame> frame); 147 void ReturnUnusedResource(std::unique_ptr<ChildFrame> frame);
140 void ReturnResourceFromParent( 148 void ReturnResourceFromParent(
141 CompositorFrameConsumer* compositor_frame_consumer); 149 CompositorFrameConsumer* compositor_frame_consumer);
142 void ReleaseHardware(); 150 void ReleaseHardware();
143 151
144 gfx::Vector2d max_scroll_offset() const; 152 gfx::Vector2d max_scroll_offset() const;
145 153
146 void UpdateMemoryPolicy(); 154 void UpdateMemoryPolicy();
147 155
148 uint32_t GetCompositorID(content::SynchronousCompositor* compositor); 156 uint32_t GetCompositorID(content::SynchronousCompositor* compositor);
149 // For debug tracing or logging. Return the string representation of this 157 // For debug tracing or logging. Return the string representation of this
150 // view renderer's state. 158 // view renderer's state.
151 std::string ToString() const; 159 std::string ToString() const;
152 160
153 BrowserViewRendererClient* const client_; 161 BrowserViewRendererClient* const client_;
154 const scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; 162 const scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
155 CompositorFrameConsumer* compositor_frame_consumer_; 163 CompositorFrameConsumer* current_compositor_frame_consumer_;
164 std::set<CompositorFrameConsumer*> compositor_frame_consumers_;
156 165
157 // The current compositor that's owned by the current RVH. 166 // The current compositor that's owned by the current RVH.
158 content::SynchronousCompositor* compositor_; 167 content::SynchronousCompositor* compositor_;
159 // A map from compositor's per-WebView unique ID to the compositor's raw 168 // A map from compositor's per-WebView unique ID to the compositor's raw
160 // pointer. A raw pointer here is fine because the entry will be erased when 169 // pointer. A raw pointer here is fine because the entry will be erased when
161 // a compositor is destroyed. 170 // a compositor is destroyed.
162 std::map<size_t, content::SynchronousCompositor*> compositor_map_; 171 std::map<size_t, content::SynchronousCompositor*> compositor_map_;
163 172
164 bool is_paused_; 173 bool is_paused_;
165 bool view_visible_; 174 bool view_visible_;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 uint32_t next_compositor_id_; 208 uint32_t next_compositor_id_;
200 209
201 ParentCompositorDrawConstraints external_draw_constraints_; 210 ParentCompositorDrawConstraints external_draw_constraints_;
202 211
203 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); 212 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer);
204 }; 213 };
205 214
206 } // namespace android_webview 215 } // namespace android_webview
207 216
208 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ 217 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_
OLDNEW
« no previous file with comments | « no previous file | android_webview/browser/browser_view_renderer.cc » ('j') | android_webview/browser/browser_view_renderer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698