| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 bool HardwareEnabled() { | 130 bool HardwareEnabled() { |
| 131 static bool g_hw_enabled = !CommandLine::ForCurrentProcess()->HasSwitch( | 131 static bool g_hw_enabled = !CommandLine::ForCurrentProcess()->HasSwitch( |
| 132 switches::kDisableWebViewGLMode); | 132 switches::kDisableWebViewGLMode); |
| 133 return g_hw_enabled; | 133 return g_hw_enabled; |
| 134 } | 134 } |
| 135 | 135 |
| 136 // Provides software rendering functions from the Android glue layer. | 136 // Provides software rendering functions from the Android glue layer. |
| 137 // Allows preventing extra copies of data when rendering. | 137 // Allows preventing extra copies of data when rendering. |
| 138 AwDrawSWFunctionTable* g_sw_draw_functions = NULL; | 138 AwDrawSWFunctionTable* g_sw_draw_functions = NULL; |
| 139 | 139 |
| 140 const int64 kFallbackTickTimeoutInMilliseconds = 20; | 140 const int64 kFallbackTickTimeoutInMilliseconds = 200; |
| 141 | 141 |
| 142 | 142 |
| 143 // Used to calculate memory and resource allocation. Determined experimentally. | 143 // Used to calculate memory and resource allocation. Determined experimentally. |
| 144 size_t g_memory_multiplier = 10; | 144 size_t g_memory_multiplier = 10; |
| 145 size_t g_num_gralloc_limit = 150; | 145 size_t g_num_gralloc_limit = 150; |
| 146 const size_t kBytesPerPixel = 4; | 146 const size_t kBytesPerPixel = 4; |
| 147 const size_t kMemoryAllocationStep = 5 * 1024 * 1024; | 147 const size_t kMemoryAllocationStep = 5 * 1024 * 1024; |
| 148 | 148 |
| 149 class ScopedAllowGL { | 149 class ScopedAllowGL { |
| 150 public: | 150 public: |
| (...skipping 29 matching lines...) Expand all Loading... |
| 180 BrowserThread::PostTask( | 180 BrowserThread::PostTask( |
| 181 BrowserThread::UI, FROM_HERE, base::Bind(&RequestProcessGLOnUIThread)); | 181 BrowserThread::UI, FROM_HERE, base::Bind(&RequestProcessGLOnUIThread)); |
| 182 return; | 182 return; |
| 183 } | 183 } |
| 184 | 184 |
| 185 InProcessViewRenderer* renderer = static_cast<InProcessViewRenderer*>( | 185 InProcessViewRenderer* renderer = static_cast<InProcessViewRenderer*>( |
| 186 g_view_renderer_manager.Get().GetMostRecentlyDrawn()); | 186 g_view_renderer_manager.Get().GetMostRecentlyDrawn()); |
| 187 if (!renderer || !renderer->RequestProcessGL()) { | 187 if (!renderer || !renderer->RequestProcessGL()) { |
| 188 LOG(ERROR) << "Failed to request GL process. Deadlock likely: " | 188 LOG(ERROR) << "Failed to request GL process. Deadlock likely: " |
| 189 << !!renderer; | 189 << !!renderer; |
| 190 gpu::InProcessCommandBuffer::ProcessGpuWorkOnCurrentThread(); |
| 190 } | 191 } |
| 191 } | 192 } |
| 192 | 193 |
| 193 } // namespace | 194 } // namespace |
| 194 | 195 |
| 195 // Called from different threads! | 196 // Called from different threads! |
| 196 static void ScheduleGpuWork() { | 197 static void ScheduleGpuWork() { |
| 197 if (ScopedAllowGL::IsAllowed()) { | 198 if (ScopedAllowGL::IsAllowed()) { |
| 198 gpu::InProcessCommandBuffer::ProcessGpuWorkOnCurrentThread(); | 199 gpu::InProcessCommandBuffer::ProcessGpuWorkOnCurrentThread(); |
| 199 } else { | 200 } else { |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 base::StringAppendF(&str, | 989 base::StringAppendF(&str, |
| 989 "surface width height: [%d %d] ", | 990 "surface width height: [%d %d] ", |
| 990 draw_info->width, | 991 draw_info->width, |
| 991 draw_info->height); | 992 draw_info->height); |
| 992 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); | 993 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); |
| 993 } | 994 } |
| 994 return str; | 995 return str; |
| 995 } | 996 } |
| 996 | 997 |
| 997 } // namespace android_webview | 998 } // namespace android_webview |
| OLD | NEW |