| Index: android_webview/browser/browser_view_renderer.h
|
| diff --git a/android_webview/browser/browser_view_renderer.h b/android_webview/browser/browser_view_renderer.h
|
| index da82fce8ae253a37c78bfd484f6dd17108d80c87..45c34b37e9cbba01cf3fa0f6c3f8d9e991a97621 100644
|
| --- a/android_webview/browser/browser_view_renderer.h
|
| +++ b/android_webview/browser/browser_view_renderer.h
|
| @@ -5,6 +5,8 @@
|
| #ifndef ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_
|
| #define ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_
|
|
|
| +#include "android_webview/browser/global_tile_manager.h"
|
| +#include "android_webview/browser/global_tile_manager_client.h"
|
| #include "android_webview/browser/shared_renderer_state.h"
|
| #include "base/android/scoped_java_ref.h"
|
| #include "base/callback.h"
|
| @@ -22,6 +24,7 @@ struct AwDrawSWFunctionTable;
|
| namespace content {
|
| class ContentViewCore;
|
| class SynchronousCompositor;
|
| +class SynchronousCompositorMemoryPolicy;
|
| class WebContents;
|
| }
|
|
|
| @@ -52,7 +55,8 @@ class BrowserViewRendererJavaHelper {
|
|
|
| // Interface for all the WebView-specific content rendering operations.
|
| // Provides software and hardware rendering and the Capture Picture API.
|
| -class BrowserViewRenderer : public content::SynchronousCompositorClient {
|
| +class BrowserViewRenderer : public content::SynchronousCompositorClient,
|
| + public GlobalTileManagerClient {
|
| public:
|
| BrowserViewRenderer(
|
| BrowserViewRendererClient* client,
|
| @@ -106,6 +110,13 @@ class BrowserViewRenderer : public content::SynchronousCompositorClient {
|
| // compositor that are not directly exposed here.
|
| void ForceFakeCompositeSW();
|
|
|
| + // Set the memory policy in shared renderer state and request the tiles from
|
| + // GlobalTileManager. The actually amount of memory allowed by
|
| + // GlobalTileManager may not be equal to what's requested in |policy|.
|
| + void RequestMemoryPolicy(content::SynchronousCompositorMemoryPolicy& policy);
|
| +
|
| + void TrimMemory(const int level, const bool visible);
|
| +
|
| // SynchronousCompositorClient overrides
|
| virtual void DidInitializeCompositor(
|
| content::SynchronousCompositor* compositor) OVERRIDE;
|
| @@ -127,6 +138,12 @@ class BrowserViewRenderer : public content::SynchronousCompositorClient {
|
| gfx::Vector2dF latest_overscroll_delta,
|
| gfx::Vector2dF current_fling_velocity) OVERRIDE;
|
|
|
| + // GlobalTileManagerClient overrides
|
| + virtual size_t CalculateTileRequest() const OVERRIDE;
|
| + virtual bool NeedsEviction() const OVERRIDE;
|
| + virtual size_t ForceDropTiles() OVERRIDE;
|
| + virtual size_t GetTilesNum() const OVERRIDE;
|
| +
|
| private:
|
| // Checks the continuous invalidate and block invalidate state, and schedule
|
| // invalidates appropriately. If |force_invalidate| is true, then send a view
|
| @@ -142,6 +159,7 @@ class BrowserViewRenderer : public content::SynchronousCompositorClient {
|
|
|
| gfx::Vector2d max_scroll_offset() const;
|
|
|
| + content::SynchronousCompositorMemoryPolicy CalculateDesiredMemoryPolicy();
|
| // For debug tracing or logging. Return the string representation of this
|
| // view renderer's state and the |draw_info| if provided.
|
| std::string ToString(AwDrawGLInfo* draw_info) const;
|
| @@ -199,6 +217,11 @@ class BrowserViewRenderer : public content::SynchronousCompositorClient {
|
| // spot over a period of time).
|
| gfx::Vector2dF overscroll_rounding_error_;
|
|
|
| + // Number of times the BrowserViewRenderer gets the tile allocation less than
|
| + // kGrallocHungryLimit.
|
| + size_t num_consecutive_hungry_frames_;
|
| + GlobalTileManager::Key tile_manager_key_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer);
|
| };
|
|
|
|
|