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

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

Issue 1377593003: Refactor BrowserViewRenderer to support page visibility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test compilation Created 5 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
« no previous file with comments | « no previous file | android_webview/browser/browser_view_renderer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/parent_compositor_draw_constraints.h" 8 #include "android_webview/browser/parent_compositor_draw_constraints.h"
9 #include "android_webview/browser/shared_renderer_state.h" 9 #include "android_webview/browser/shared_renderer_state.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 21 matching lines...) Expand all
32 // Interface for all the WebView-specific content rendering operations. 32 // Interface for all the WebView-specific content rendering operations.
33 // Provides software and hardware rendering and the Capture Picture API. 33 // Provides software and hardware rendering and the Capture Picture API.
34 class BrowserViewRenderer : public content::SynchronousCompositorClient { 34 class BrowserViewRenderer : public content::SynchronousCompositorClient {
35 public: 35 public:
36 static void CalculateTileMemoryPolicy(); 36 static void CalculateTileMemoryPolicy();
37 static BrowserViewRenderer* FromWebContents( 37 static BrowserViewRenderer* FromWebContents(
38 content::WebContents* web_contents); 38 content::WebContents* web_contents);
39 39
40 BrowserViewRenderer( 40 BrowserViewRenderer(
41 BrowserViewRendererClient* client, 41 BrowserViewRendererClient* client,
42 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner); 42 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner,
43 bool disable_page_visibility);
43 44
44 ~BrowserViewRenderer() override; 45 ~BrowserViewRenderer() override;
45 46
46 void RegisterWithWebContents(content::WebContents* web_contents); 47 void RegisterWithWebContents(content::WebContents* web_contents);
47 48
48 SharedRendererState* GetAwDrawGLViewContext(); 49 SharedRendererState* GetAwDrawGLViewContext();
49 bool RequestDrawGL(bool wait_for_completion); 50 bool RequestDrawGL(bool wait_for_completion);
50 51
51 // Called before either OnDrawHardware or OnDrawSoftware to set the view 52 // Called before either OnDrawHardware or OnDrawSoftware to set the view
52 // state of this frame. |scroll| is the view's current scroll offset. 53 // state of this frame. |scroll| is the view's current scroll offset.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 void ScrollTo(gfx::Vector2d new_value); 87 void ScrollTo(gfx::Vector2d new_value);
87 88
88 // Android views hierarchy gluing. 89 // Android views hierarchy gluing.
89 bool IsVisible() const; 90 bool IsVisible() const;
90 gfx::Rect GetScreenRect() const; 91 gfx::Rect GetScreenRect() const;
91 bool attached_to_window() const { return attached_to_window_; } 92 bool attached_to_window() const { return attached_to_window_; }
92 bool hardware_enabled() const { return hardware_enabled_; } 93 bool hardware_enabled() const { return hardware_enabled_; }
93 gfx::Size size() const { return size_; } 94 gfx::Size size() const { return size_; }
94 void ReleaseHardware(); 95 void ReleaseHardware();
95 96
97 bool IsClientVisible() const;
96 void TrimMemory(const int level, const bool visible); 98 void TrimMemory(const int level, const bool visible);
97 99
98 // SynchronousCompositorClient overrides. 100 // SynchronousCompositorClient overrides.
99 void DidInitializeCompositor( 101 void DidInitializeCompositor(
100 content::SynchronousCompositor* compositor) override; 102 content::SynchronousCompositor* compositor) override;
101 void DidDestroyCompositor( 103 void DidDestroyCompositor(
102 content::SynchronousCompositor* compositor) override; 104 content::SynchronousCompositor* compositor) override;
103 void PostInvalidate() override; 105 void PostInvalidate() override;
104 void DidUpdateContent() override; 106 void DidUpdateContent() override;
105 void UpdateRootLayerState(const gfx::Vector2dF& total_scroll_offset_dip, 107 void UpdateRootLayerState(const gfx::Vector2dF& total_scroll_offset_dip,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 151
150 void UpdateMemoryPolicy(); 152 void UpdateMemoryPolicy();
151 153
152 // For debug tracing or logging. Return the string representation of this 154 // For debug tracing or logging. Return the string representation of this
153 // view renderer's state. 155 // view renderer's state.
154 std::string ToString() const; 156 std::string ToString() const;
155 157
156 BrowserViewRendererClient* client_; 158 BrowserViewRendererClient* client_;
157 SharedRendererState shared_renderer_state_; 159 SharedRendererState shared_renderer_state_;
158 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; 160 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
161 bool disable_page_visibility_;
159 162
160 content::SynchronousCompositor* compositor_; 163 content::SynchronousCompositor* compositor_;
161 164
162 bool is_paused_; 165 bool is_paused_;
163 bool view_visible_; 166 bool view_visible_;
164 bool window_visible_; // Only applicable if |attached_to_window_| is true. 167 bool window_visible_; // Only applicable if |attached_to_window_| is true.
165 bool attached_to_window_; 168 bool attached_to_window_;
166 bool hardware_enabled_; 169 bool hardware_enabled_;
167 float dip_scale_; 170 float dip_scale_;
168 float page_scale_factor_; 171 float page_scale_factor_;
(...skipping 28 matching lines...) Expand all
197 // spot over a period of time). 200 // spot over a period of time).
198 // TODO(miletus): Make overscroll_rounding_error_ a gfx::ScrollOffset. 201 // TODO(miletus): Make overscroll_rounding_error_ a gfx::ScrollOffset.
199 gfx::Vector2dF overscroll_rounding_error_; 202 gfx::Vector2dF overscroll_rounding_error_;
200 203
201 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); 204 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer);
202 }; 205 };
203 206
204 } // namespace android_webview 207 } // namespace android_webview
205 208
206 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ 209 #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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698