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

Unified Diff: android_webview/browser/in_process_view_renderer.cc

Issue 172793002: aw: Do not assume functor will be called on UI thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: dcheck Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « android_webview/browser/gl_view_renderer_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« no previous file with comments | « android_webview/browser/gl_view_renderer_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698