| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_HARDWARE_RENDERER_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_HARDWARE_RENDERER_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_HARDWARE_RENDERER_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_HARDWARE_RENDERER_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 | 9 |
| 10 #include "android_webview/browser/gl_view_renderer_manager.h" | 10 #include "android_webview/browser/gl_view_renderer_manager.h" |
| 11 #include "android_webview/browser/shared_renderer_state.h" | 11 #include "android_webview/browser/shared_renderer_state.h" |
| 12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/threading/thread_local.h" | 14 #include "base/threading/thread_local.h" |
| 15 #include "content/public/browser/android/synchronous_compositor.h" | |
| 16 | 15 |
| 17 struct AwDrawGLInfo; | 16 struct AwDrawGLInfo; |
| 18 | 17 |
| 19 namespace android_webview { | 18 namespace android_webview { |
| 20 | 19 |
| 21 class AwGLSurface; | 20 class AwGLSurface; |
| 22 class BrowserViewRendererClient; | 21 class BrowserViewRendererClient; |
| 23 | 22 |
| 24 namespace internal { | 23 namespace internal { |
| 25 class DeferredGpuCommandService; | 24 class DeferredGpuCommandService; |
| 26 } // namespace internal | 25 } // namespace internal |
| 27 | 26 |
| 28 class HardwareRenderer { | 27 class HardwareRenderer { |
| 29 public: | 28 public: |
| 30 explicit HardwareRenderer(SharedRendererState* state); | 29 explicit HardwareRenderer(SharedRendererState* state); |
| 31 ~HardwareRenderer(); | 30 ~HardwareRenderer(); |
| 32 | 31 |
| 33 static void CalculateTileMemoryPolicy(); | 32 static void CalculateTileMemoryPolicy(); |
| 34 | 33 |
| 35 bool DrawGL(AwDrawGLInfo* draw_info, DrawGLResult* result); | 34 bool DrawGL(AwDrawGLInfo* draw_info, DrawGLResult* result); |
| 36 bool TrimMemory(int level, bool visible); | |
| 37 | 35 |
| 38 private: | 36 private: |
| 39 friend class internal::DeferredGpuCommandService; | 37 friend class internal::DeferredGpuCommandService; |
| 40 | 38 |
| 41 void SetMemoryPolicy(content::SynchronousCompositorMemoryPolicy& new_policy); | 39 void SetCompositorMemoryPolicy(); |
| 42 | 40 |
| 43 SharedRendererState* shared_renderer_state_; | 41 SharedRendererState* shared_renderer_state_; |
| 44 | 42 |
| 45 typedef void* EGLContext; | 43 typedef void* EGLContext; |
| 46 EGLContext last_egl_context_; | 44 EGLContext last_egl_context_; |
| 47 | 45 |
| 48 scoped_refptr<AwGLSurface> gl_surface_; | 46 scoped_refptr<AwGLSurface> gl_surface_; |
| 49 content::SynchronousCompositorMemoryPolicy memory_policy_; | |
| 50 | 47 |
| 51 GLViewRendererManager::Key manager_key_; | 48 GLViewRendererManager::Key renderer_manager_key_; |
| 52 | 49 |
| 53 DISALLOW_COPY_AND_ASSIGN(HardwareRenderer); | 50 DISALLOW_COPY_AND_ASSIGN(HardwareRenderer); |
| 54 }; | 51 }; |
| 55 | 52 |
| 56 namespace internal { | 53 namespace internal { |
| 57 | 54 |
| 58 class ScopedAllowGL { | 55 class ScopedAllowGL { |
| 59 public: | 56 public: |
| 60 ScopedAllowGL(); | 57 ScopedAllowGL(); |
| 61 ~ScopedAllowGL(); | 58 ~ScopedAllowGL(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 95 |
| 99 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; | 96 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; |
| 100 DISALLOW_COPY_AND_ASSIGN(DeferredGpuCommandService); | 97 DISALLOW_COPY_AND_ASSIGN(DeferredGpuCommandService); |
| 101 }; | 98 }; |
| 102 | 99 |
| 103 } // namespace internal | 100 } // namespace internal |
| 104 | 101 |
| 105 } // namespace android_webview | 102 } // namespace android_webview |
| 106 | 103 |
| 107 #endif // ANDROID_WEBVIEW_BROWSER_HARDWARE_RENDERER_H_ | 104 #endif // ANDROID_WEBVIEW_BROWSER_HARDWARE_RENDERER_H_ |
| OLD | NEW |