Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "android_webview/browser/in_process_view_renderer.h" | 5 #include "android_webview/browser/in_process_view_renderer.h" |
| 6 | 6 |
| 7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
| 8 | 8 |
| 9 #include "android_webview/browser/aw_gl_surface.h" | 9 #include "android_webview/browser/aw_gl_surface.h" |
| 10 #include "android_webview/browser/scoped_app_gl_state_restore.h" | 10 #include "android_webview/browser/scoped_app_gl_state_restore.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 } | 164 } |
| 165 | 165 |
| 166 ScopedAllowGL::~ScopedAllowGL() { | 166 ScopedAllowGL::~ScopedAllowGL() { |
| 167 allow_gl = false; | 167 allow_gl = false; |
| 168 } | 168 } |
| 169 | 169 |
| 170 bool ScopedAllowGL::allow_gl = false; | 170 bool ScopedAllowGL::allow_gl = false; |
| 171 | 171 |
| 172 base::LazyInstance<GLViewRendererManager>::Leaky g_view_renderer_manager; | 172 base::LazyInstance<GLViewRendererManager>::Leaky g_view_renderer_manager; |
| 173 | 173 |
| 174 void RequestProcessGLOnUIThread() { | |
| 175 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 176 InProcessViewRenderer* renderer = static_cast<InProcessViewRenderer*>( | |
| 177 g_view_renderer_manager.Get().GetMostRecentlyDrawn()); | |
| 178 if (!renderer || !renderer->RequestProcessGL()) { | |
| 179 LOG(ERROR) << "Failed to request DrawGL. Probably going to deadlock."; | |
|
joth
2013/08/21 18:37:29
"Failed to request GL process. Deadlock likely. "
| |
| 180 } | |
| 181 } | |
| 182 | |
| 174 } // namespace | 183 } // namespace |
| 175 | 184 |
| 176 // Called from different threads! | 185 // Called from different threads! |
| 177 static void ScheduleGpuWork() { | 186 static void ScheduleGpuWork() { |
| 178 if (ScopedAllowGL::IsAllowed()) { | 187 if (ScopedAllowGL::IsAllowed()) { |
| 179 gpu::InProcessCommandBuffer::ProcessGpuWorkOnCurrentThread(); | 188 gpu::InProcessCommandBuffer::ProcessGpuWorkOnCurrentThread(); |
| 180 } else { | 189 } else { |
| 181 InProcessViewRenderer* renderer = static_cast<InProcessViewRenderer*>( | 190 BrowserThread::PostTask( |
|
joth
2013/08/21 18:37:29
How about just calling RequestProcessGL() here, th
| |
| 182 g_view_renderer_manager.Get().GetMostRecentlyDrawn()); | 191 BrowserThread::UI, FROM_HERE, base::Bind(&RequestProcessGLOnUIThread)); |
| 183 if (!renderer || !renderer->RequestProcessGL()) { | |
| 184 LOG(ERROR) << "Failed to request DrawGL. Probably going to deadlock."; | |
| 185 } | |
| 186 } | 192 } |
| 187 } | 193 } |
| 188 | 194 |
| 189 // static | 195 // static |
| 190 void BrowserViewRenderer::SetAwDrawSWFunctionTable( | 196 void BrowserViewRenderer::SetAwDrawSWFunctionTable( |
| 191 AwDrawSWFunctionTable* table) { | 197 AwDrawSWFunctionTable* table) { |
| 192 g_sw_draw_functions = table; | 198 g_sw_draw_functions = table; |
| 193 gpu::InProcessCommandBuffer::SetScheduleCallback( | 199 gpu::InProcessCommandBuffer::SetScheduleCallback( |
| 194 base::Bind(&ScheduleGpuWork)); | 200 base::Bind(&ScheduleGpuWork)); |
| 195 } | 201 } |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 859 base::StringAppendF(&str, | 865 base::StringAppendF(&str, |
| 860 "surface width height: [%d %d] ", | 866 "surface width height: [%d %d] ", |
| 861 draw_info->width, | 867 draw_info->width, |
| 862 draw_info->height); | 868 draw_info->height); |
| 863 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); | 869 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); |
| 864 } | 870 } |
| 865 return str; | 871 return str; |
| 866 } | 872 } |
| 867 | 873 |
| 868 } // namespace android_webview | 874 } // namespace android_webview |
| OLD | NEW |