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

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: no cc change Created 6 years, 1 month 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 content::WebContents* web_contents, 60 content::WebContents* web_contents,
65 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner); 61 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner);
66 62
67 virtual ~BrowserViewRenderer(); 63 virtual ~BrowserViewRenderer();
68 64
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // Set the root layer scroll offset to |new_value|. 97 // Set the root layer scroll offset to |new_value|.
102 void ScrollTo(gfx::Vector2d new_value); 98 void ScrollTo(gfx::Vector2d new_value);
103 99
104 // Android views hierarchy gluing. 100 // Android views hierarchy gluing.
105 bool IsVisible() const; 101 bool IsVisible() const;
106 gfx::Rect GetScreenRect() const; 102 gfx::Rect GetScreenRect() const;
107 bool attached_to_window() const { return attached_to_window_; } 103 bool attached_to_window() const { return attached_to_window_; }
108 bool hardware_enabled() const { return hardware_enabled_; } 104 bool hardware_enabled() const { return hardware_enabled_; }
109 void ReleaseHardware(); 105 void ReleaseHardware();
110 106
111 // Set the memory policy in shared renderer state and request the tiles from
112 // GlobalTileManager. The actually amount of memory allowed by
113 // GlobalTileManager may not be equal to what's requested in |policy|.
114 void RequestMemoryPolicy(content::SynchronousCompositorMemoryPolicy& policy);
115
116 void TrimMemory(const int level, const bool visible); 107 void TrimMemory(const int level, const bool visible);
117 108
118 // SynchronousCompositorClient overrides. 109 // SynchronousCompositorClient overrides.
119 virtual void DidInitializeCompositor( 110 virtual void DidInitializeCompositor(
120 content::SynchronousCompositor* compositor) override; 111 content::SynchronousCompositor* compositor) override;
121 virtual void DidDestroyCompositor(content::SynchronousCompositor* compositor) 112 virtual void DidDestroyCompositor(content::SynchronousCompositor* compositor)
122 override; 113 override;
123 virtual void SetContinuousInvalidate(bool invalidate) override; 114 virtual void SetContinuousInvalidate(bool invalidate) override;
124 virtual void DidUpdateContent() override; 115 virtual void DidUpdateContent() override;
125 virtual gfx::Vector2dF GetTotalRootLayerScrollOffset() override; 116 virtual gfx::Vector2dF GetTotalRootLayerScrollOffset() override;
126 virtual void UpdateRootLayerState( 117 virtual void UpdateRootLayerState(
127 const gfx::Vector2dF& total_scroll_offset_dip, 118 const gfx::Vector2dF& total_scroll_offset_dip,
128 const gfx::Vector2dF& max_scroll_offset_dip, 119 const gfx::Vector2dF& max_scroll_offset_dip,
129 const gfx::SizeF& scrollable_size_dip, 120 const gfx::SizeF& scrollable_size_dip,
130 float page_scale_factor, 121 float page_scale_factor,
131 float min_page_scale_factor, 122 float min_page_scale_factor,
132 float max_page_scale_factor) override; 123 float max_page_scale_factor) override;
133 virtual bool IsExternalFlingActive() const override; 124 virtual bool IsExternalFlingActive() const override;
134 virtual void DidOverscroll(gfx::Vector2dF accumulated_overscroll, 125 virtual void DidOverscroll(gfx::Vector2dF accumulated_overscroll,
135 gfx::Vector2dF latest_overscroll_delta, 126 gfx::Vector2dF latest_overscroll_delta,
136 gfx::Vector2dF current_fling_velocity) override; 127 gfx::Vector2dF current_fling_velocity) override;
137 128
138 // GlobalTileManagerClient overrides.
139 virtual content::SynchronousCompositorMemoryPolicy GetMemoryPolicy()
140 const override;
141 virtual void SetMemoryPolicy(
142 content::SynchronousCompositorMemoryPolicy new_policy,
143 bool effective_immediately) override;
144
145 void UpdateParentDrawConstraints(); 129 void UpdateParentDrawConstraints();
146 void DidSkipCommitFrame(); 130 void DidSkipCommitFrame();
147 131
148 private: 132 private:
149 void SetTotalRootLayerScrollOffset(gfx::Vector2dF new_value_dip); 133 void SetTotalRootLayerScrollOffset(gfx::Vector2dF new_value_dip);
150 // Checks the continuous invalidate and block invalidate state, and schedule 134 // Checks the continuous invalidate and block invalidate state, and schedule
151 // invalidates appropriately. If |force_invalidate| is true, then send a view 135 // invalidates appropriately. If |force_invalidate| is true, then send a view
152 // invalidate regardless of compositor expectation. If |skip_reschedule_tick| 136 // invalidate regardless of compositor expectation. If |skip_reschedule_tick|
153 // is true and if there is already a pending fallback tick, don't reschedule 137 // is true and if there is already a pending fallback tick, don't reschedule
154 // them. 138 // them.
(...skipping 17 matching lines...) Expand all
172 // Do this in a two stage tick due to native MessageLoop favors delayed task, 156 // Do this in a two stage tick due to native MessageLoop favors delayed task,
173 // so ensure delayed task is inserted only after the draw task returns. 157 // so ensure delayed task is inserted only after the draw task returns.
174 void PostFallbackTick(); 158 void PostFallbackTick();
175 void FallbackTickFired(); 159 void FallbackTickFired();
176 160
177 // Force invoke the compositor to run produce a 1x1 software frame that is 161 // Force invoke the compositor to run produce a 1x1 software frame that is
178 // immediately discarded. This is a hack to force invoke parts of the 162 // immediately discarded. This is a hack to force invoke parts of the
179 // compositor that are not directly exposed here. 163 // compositor that are not directly exposed here.
180 void ForceFakeCompositeSW(); 164 void ForceFakeCompositeSW();
181 165
182 void EnforceMemoryPolicyImmediately(
183 content::SynchronousCompositorMemoryPolicy policy);
184
185 gfx::Vector2d max_scroll_offset() const; 166 gfx::Vector2d max_scroll_offset() const;
186 167
187 content::SynchronousCompositorMemoryPolicy CalculateDesiredMemoryPolicy(); 168 size_t CalculateDesiredMemoryPolicy();
188 // For debug tracing or logging. Return the string representation of this 169 // For debug tracing or logging. Return the string representation of this
189 // view renderer's state. 170 // view renderer's state.
190 std::string ToString() const; 171 std::string ToString() const;
191 172
192 BrowserViewRendererClient* client_; 173 BrowserViewRendererClient* client_;
193 SharedRendererState shared_renderer_state_; 174 SharedRendererState shared_renderer_state_;
194 content::WebContents* web_contents_; 175 content::WebContents* web_contents_;
195 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; 176 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
196 177
197 content::SynchronousCompositor* compositor_; 178 content::SynchronousCompositor* compositor_;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 gfx::Vector2dF scroll_offset_dip_; 216 gfx::Vector2dF scroll_offset_dip_;
236 217
237 // Max scroll offset in CSS pixels. 218 // Max scroll offset in CSS pixels.
238 gfx::Vector2dF max_scroll_offset_dip_; 219 gfx::Vector2dF max_scroll_offset_dip_;
239 220
240 // Used to prevent rounding errors from accumulating enough to generate 221 // Used to prevent rounding errors from accumulating enough to generate
241 // visible skew (especially noticeable when scrolling up and down in the same 222 // visible skew (especially noticeable when scrolling up and down in the same
242 // spot over a period of time). 223 // spot over a period of time).
243 gfx::Vector2dF overscroll_rounding_error_; 224 gfx::Vector2dF overscroll_rounding_error_;
244 225
245 GlobalTileManager::Key tile_manager_key_;
246 content::SynchronousCompositorMemoryPolicy memory_policy_;
247
248 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); 226 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer);
249 }; 227 };
250 228
251 } // namespace android_webview 229 } // namespace android_webview
252 230
253 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ 231 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_
OLDNEW
« no previous file with comments | « android_webview/android_webview_tests.gypi ('k') | android_webview/browser/browser_view_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698