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

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

Issue 643993005: Remove limit on number of resources in cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 (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 "android_webview/browser/global_tile_manager.h"
9 #include "android_webview/browser/global_tile_manager_client.h"
10 #include "android_webview/browser/parent_compositor_draw_constraints.h" 8 #include "android_webview/browser/parent_compositor_draw_constraints.h"
11 #include "android_webview/browser/shared_renderer_state.h" 9 #include "android_webview/browser/shared_renderer_state.h"
12 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
13 #include "base/callback.h" 11 #include "base/callback.h"
14 #include "base/cancelable_callback.h" 12 #include "base/cancelable_callback.h"
15 #include "base/debug/trace_event.h" 13 #include "base/debug/trace_event.h"
16 #include "content/public/browser/android/synchronous_compositor.h" 14 #include "content/public/browser/android/synchronous_compositor.h"
17 #include "content/public/browser/android/synchronous_compositor_client.h" 15 #include "content/public/browser/android/synchronous_compositor_client.h"
18 #include "skia/ext/refptr.h" 16 #include "skia/ext/refptr.h"
19 #include "ui/gfx/rect.h" 17 #include "ui/gfx/rect.h"
20 #include "ui/gfx/vector2d_f.h" 18 #include "ui/gfx/vector2d_f.h"
21 19
22 class SkCanvas; 20 class SkCanvas;
23 class SkPicture; 21 class SkPicture;
24 22
25 namespace content { 23 namespace content {
26 struct SynchronousCompositorMemoryPolicy;
27 class WebContents; 24 class WebContents;
28 } 25 }
29 26
30 namespace android_webview { 27 namespace android_webview {
31 28
32 class BrowserViewRendererClient; 29 class BrowserViewRendererClient;
33 30
34 // Delegate to perform rendering actions involving Java objects. 31 // Delegate to perform rendering actions involving Java objects.
35 class BrowserViewRendererJavaHelper { 32 class BrowserViewRendererJavaHelper {
36 public: 33 public:
(...skipping 10 matching lines...) Expand all
47 const gfx::Vector2d& scroll_correction, 44 const gfx::Vector2d& scroll_correction,
48 const gfx::Size& auxiliary_bitmap_size, 45 const gfx::Size& auxiliary_bitmap_size,
49 RenderMethod render_source) = 0; 46 RenderMethod render_source) = 0;
50 47
51 protected: 48 protected:
52 virtual ~BrowserViewRendererJavaHelper() {} 49 virtual ~BrowserViewRendererJavaHelper() {}
53 }; 50 };
54 51
55 // Interface for all the WebView-specific content rendering operations. 52 // Interface for all the WebView-specific content rendering operations.
56 // Provides software and hardware rendering and the Capture Picture API. 53 // Provides software and hardware rendering and the Capture Picture API.
57 class BrowserViewRenderer : public content::SynchronousCompositorClient, 54 class BrowserViewRenderer : public content::SynchronousCompositorClient {
58 public GlobalTileManagerClient {
59 public: 55 public:
60 static void CalculateTileMemoryPolicy(); 56 static void CalculateTileMemoryPolicy();
61 57
62 BrowserViewRenderer( 58 BrowserViewRenderer(
63 BrowserViewRendererClient* client, 59 BrowserViewRendererClient* client,
64 SharedRendererState* shared_renderer_state, 60 SharedRendererState* shared_renderer_state,
65 content::WebContents* web_contents, 61 content::WebContents* web_contents,
66 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner); 62 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner);
67 63
68 virtual ~BrowserViewRenderer(); 64 virtual ~BrowserViewRenderer();
(...skipping 30 matching lines...) Expand all
99 // Set the root layer scroll offset to |new_value|. 95 // Set the root layer scroll offset to |new_value|.
100 void ScrollTo(gfx::Vector2d new_value); 96 void ScrollTo(gfx::Vector2d new_value);
101 97
102 // Android views hierarchy gluing. 98 // Android views hierarchy gluing.
103 bool IsVisible() const; 99 bool IsVisible() const;
104 gfx::Rect GetScreenRect() const; 100 gfx::Rect GetScreenRect() const;
105 bool attached_to_window() const { return attached_to_window_; } 101 bool attached_to_window() const { return attached_to_window_; }
106 bool hardware_enabled() const { return hardware_enabled_; } 102 bool hardware_enabled() const { return hardware_enabled_; }
107 void ReleaseHardware(); 103 void ReleaseHardware();
108 104
109 // Set the memory policy in shared renderer state and request the tiles from
110 // GlobalTileManager. The actually amount of memory allowed by
111 // GlobalTileManager may not be equal to what's requested in |policy|.
112 void RequestMemoryPolicy(content::SynchronousCompositorMemoryPolicy& policy);
113
114 void TrimMemory(const int level, const bool visible); 105 void TrimMemory(const int level, const bool visible);
115 106
116 // SynchronousCompositorClient overrides. 107 // SynchronousCompositorClient overrides.
117 virtual void DidInitializeCompositor( 108 virtual void DidInitializeCompositor(
118 content::SynchronousCompositor* compositor) override; 109 content::SynchronousCompositor* compositor) override;
119 virtual void DidDestroyCompositor(content::SynchronousCompositor* compositor) 110 virtual void DidDestroyCompositor(content::SynchronousCompositor* compositor)
120 override; 111 override;
121 virtual void SetContinuousInvalidate(bool invalidate) override; 112 virtual void SetContinuousInvalidate(bool invalidate) override;
122 virtual void DidUpdateContent() override; 113 virtual void DidUpdateContent() override;
123 virtual gfx::Vector2dF GetTotalRootLayerScrollOffset() override; 114 virtual gfx::Vector2dF GetTotalRootLayerScrollOffset() override;
124 virtual void UpdateRootLayerState( 115 virtual void UpdateRootLayerState(
125 const gfx::Vector2dF& total_scroll_offset_dip, 116 const gfx::Vector2dF& total_scroll_offset_dip,
126 const gfx::Vector2dF& max_scroll_offset_dip, 117 const gfx::Vector2dF& max_scroll_offset_dip,
127 const gfx::SizeF& scrollable_size_dip, 118 const gfx::SizeF& scrollable_size_dip,
128 float page_scale_factor, 119 float page_scale_factor,
129 float min_page_scale_factor, 120 float min_page_scale_factor,
130 float max_page_scale_factor) override; 121 float max_page_scale_factor) override;
131 virtual bool IsExternalFlingActive() const override; 122 virtual bool IsExternalFlingActive() const override;
132 virtual void DidOverscroll(gfx::Vector2dF accumulated_overscroll, 123 virtual void DidOverscroll(gfx::Vector2dF accumulated_overscroll,
133 gfx::Vector2dF latest_overscroll_delta, 124 gfx::Vector2dF latest_overscroll_delta,
134 gfx::Vector2dF current_fling_velocity) override; 125 gfx::Vector2dF current_fling_velocity) override;
135 126
136 // GlobalTileManagerClient overrides.
137 virtual content::SynchronousCompositorMemoryPolicy GetMemoryPolicy()
138 const override;
139 virtual void SetMemoryPolicy(
140 content::SynchronousCompositorMemoryPolicy new_policy,
141 bool effective_immediately) override;
142
143 void UpdateParentDrawConstraints(); 127 void UpdateParentDrawConstraints();
144 void DidSkipCommitFrame(); 128 void DidSkipCommitFrame();
145 129
146 private: 130 private:
147 void SetTotalRootLayerScrollOffset(gfx::Vector2dF new_value_dip); 131 void SetTotalRootLayerScrollOffset(gfx::Vector2dF new_value_dip);
148 // Checks the continuous invalidate and block invalidate state, and schedule 132 // Checks the continuous invalidate and block invalidate state, and schedule
149 // invalidates appropriately. If |force_invalidate| is true, then send a view 133 // invalidates appropriately. If |force_invalidate| is true, then send a view
150 // invalidate regardless of compositor expectation. If |skip_reschedule_tick| 134 // invalidate regardless of compositor expectation. If |skip_reschedule_tick|
151 // is true and if there is already a pending fallback tick, don't reschedule 135 // is true and if there is already a pending fallback tick, don't reschedule
152 // them. 136 // them.
(...skipping 17 matching lines...) Expand all
170 // Do this in a two stage tick due to native MessageLoop favors delayed task, 154 // Do this in a two stage tick due to native MessageLoop favors delayed task,
171 // so ensure delayed task is inserted only after the draw task returns. 155 // so ensure delayed task is inserted only after the draw task returns.
172 void PostFallbackTick(); 156 void PostFallbackTick();
173 void FallbackTickFired(); 157 void FallbackTickFired();
174 158
175 // Force invoke the compositor to run produce a 1x1 software frame that is 159 // Force invoke the compositor to run produce a 1x1 software frame that is
176 // immediately discarded. This is a hack to force invoke parts of the 160 // immediately discarded. This is a hack to force invoke parts of the
177 // compositor that are not directly exposed here. 161 // compositor that are not directly exposed here.
178 void ForceFakeCompositeSW(); 162 void ForceFakeCompositeSW();
179 163
180 void EnforceMemoryPolicyImmediately(
181 content::SynchronousCompositorMemoryPolicy policy);
182
183 gfx::Vector2d max_scroll_offset() const; 164 gfx::Vector2d max_scroll_offset() const;
184 165
185 content::SynchronousCompositorMemoryPolicy CalculateDesiredMemoryPolicy(); 166 size_t CalculateDesiredMemoryPolicy();
186 // For debug tracing or logging. Return the string representation of this 167 // For debug tracing or logging. Return the string representation of this
187 // view renderer's state. 168 // view renderer's state.
188 std::string ToString() const; 169 std::string ToString() const;
189 170
190 BrowserViewRendererClient* client_; 171 BrowserViewRendererClient* client_;
191 SharedRendererState* shared_renderer_state_; 172 SharedRendererState* shared_renderer_state_;
192 content::WebContents* web_contents_; 173 content::WebContents* web_contents_;
193 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; 174 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
194 175
195 content::SynchronousCompositor* compositor_; 176 content::SynchronousCompositor* compositor_;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 gfx::Vector2dF scroll_offset_dip_; 214 gfx::Vector2dF scroll_offset_dip_;
234 215
235 // Max scroll offset in CSS pixels. 216 // Max scroll offset in CSS pixels.
236 gfx::Vector2dF max_scroll_offset_dip_; 217 gfx::Vector2dF max_scroll_offset_dip_;
237 218
238 // Used to prevent rounding errors from accumulating enough to generate 219 // Used to prevent rounding errors from accumulating enough to generate
239 // visible skew (especially noticeable when scrolling up and down in the same 220 // visible skew (especially noticeable when scrolling up and down in the same
240 // spot over a period of time). 221 // spot over a period of time).
241 gfx::Vector2dF overscroll_rounding_error_; 222 gfx::Vector2dF overscroll_rounding_error_;
242 223
243 GlobalTileManager::Key tile_manager_key_;
244 content::SynchronousCompositorMemoryPolicy memory_policy_;
245
246 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); 224 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer);
247 }; 225 };
248 226
249 } // namespace android_webview 227 } // namespace android_webview
250 228
251 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ 229 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698