Chromium Code Reviews| Index: android_webview/browser/in_process_view_renderer.cc |
| diff --git a/android_webview/browser/in_process_view_renderer.cc b/android_webview/browser/in_process_view_renderer.cc |
| index 26eaa2f04e0a04162be0f3a9b96d71329dd88901..9048da331fd1a28d0a973d41643e93ae6e62d433 100644 |
| --- a/android_webview/browser/in_process_view_renderer.cc |
| +++ b/android_webview/browser/in_process_view_renderer.cc |
| @@ -43,7 +43,6 @@ namespace android_webview { |
| namespace { |
| - |
| const void* kUserDataKey = &kUserDataKey; |
| class UserData : public content::WebContents::Data { |
| @@ -139,20 +138,22 @@ AwDrawSWFunctionTable* g_sw_draw_functions = NULL; |
| const int64 kFallbackTickTimeoutInMilliseconds = 20; |
| - |
| // Used to calculate memory and resource allocation. Determined experimentally. |
| size_t g_memory_multiplier = 10; |
| size_t g_num_gralloc_limit = 150; |
| const size_t kBytesPerPixel = 4; |
| const size_t kMemoryAllocationStep = 5 * 1024 * 1024; |
| +base::LazyInstance<GLViewRendererManager>::Leaky g_view_renderer_manager = |
| + LAZY_INSTANCE_INITIALIZER; |
| + |
| class ScopedAllowGL { |
| public: |
| ScopedAllowGL(); |
| ~ScopedAllowGL(); |
| static bool IsAllowed() { |
| - return BrowserThread::CurrentlyOn(BrowserThread::UI) && allow_gl; |
| + return g_view_renderer_manager.Get().OnRenderThread() && allow_gl; |
| } |
| private: |
| @@ -162,7 +163,6 @@ class ScopedAllowGL { |
| }; |
| ScopedAllowGL::ScopedAllowGL() { |
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
|
no sievers
2014/02/19 21:12:19
Should we keep this check?
boliu
2014/02/19 21:33:40
No. This will be called on render thread.
no sievers
2014/02/19 21:36:30
I meant the idea of the check :)
I.e. DCHECK(g_vie
boliu
2014/02/19 21:39:57
Aha! Done.
|
| DCHECK(!allow_gl); |
| allow_gl = true; |
| } |
| @@ -173,9 +173,6 @@ ScopedAllowGL::~ScopedAllowGL() { |
| bool ScopedAllowGL::allow_gl = false; |
| -base::LazyInstance<GLViewRendererManager>::Leaky g_view_renderer_manager = |
| - LAZY_INSTANCE_INITIALIZER; |
| - |
| void RequestProcessGLOnUIThread() { |
| if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| BrowserThread::PostTask( |