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..b0df091b61fbd7760630a2b3b57ac6d855c64322 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,7 @@ class ScopedAllowGL { |
}; |
ScopedAllowGL::ScopedAllowGL() { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ DCHECK(g_view_renderer_manager.Get().OnRenderThread()); |
DCHECK(!allow_gl); |
allow_gl = true; |
} |
@@ -173,9 +174,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( |