| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/hardware_renderer.h" | 5 #include "android_webview/browser/hardware_renderer.h" |
| 6 | 6 |
| 7 #include "android_webview/browser/aw_gl_surface.h" | 7 #include "android_webview/browser/aw_gl_surface.h" |
| 8 #include "android_webview/browser/browser_view_renderer_client.h" | 8 #include "android_webview/browser/browser_view_renderer_client.h" |
| 9 #include "android_webview/browser/gl_view_renderer_manager.h" | 9 #include "android_webview/browser/gl_view_renderer_manager.h" |
| 10 #include "android_webview/browser/scoped_app_gl_state_restore.h" | 10 #include "android_webview/browser/scoped_app_gl_state_restore.h" |
| 11 #include "android_webview/public/browser/draw_gl.h" | 11 #include "android_webview/public/browser/draw_gl.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/debug/trace_event.h" | 13 #include "base/debug/trace_event.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 16 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
| 17 #include "gpu/command_buffer/service/shader_translator_cache.h" |
| 17 #include "ui/gfx/transform.h" | 18 #include "ui/gfx/transform.h" |
| 18 | 19 |
| 19 using content::BrowserThread; | 20 using content::BrowserThread; |
| 20 | 21 |
| 21 namespace android_webview { | 22 namespace android_webview { |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| 25 // Used to calculate memory and resource allocation. Determined experimentally. | 26 // Used to calculate memory and resource allocation. Determined experimentally. |
| 26 const size_t g_memory_multiplier = 10; | 27 const size_t g_memory_multiplier = 10; |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 } | 246 } |
| 246 } | 247 } |
| 247 | 248 |
| 248 void DeferredGpuCommandService::ScheduleIdleWork( | 249 void DeferredGpuCommandService::ScheduleIdleWork( |
| 249 const base::Closure& callback) { | 250 const base::Closure& callback) { |
| 250 // TODO(sievers): Should this do anything? | 251 // TODO(sievers): Should this do anything? |
| 251 } | 252 } |
| 252 | 253 |
| 253 bool DeferredGpuCommandService::UseVirtualizedGLContexts() { return true; } | 254 bool DeferredGpuCommandService::UseVirtualizedGLContexts() { return true; } |
| 254 | 255 |
| 256 scoped_refptr<gpu::gles2::ShaderTranslatorCache> |
| 257 DeferredGpuCommandService::shader_translator_cache() { |
| 258 if (!shader_translator_cache_.get()) |
| 259 shader_translator_cache_ = new gpu::gles2::ShaderTranslatorCache; |
| 260 return shader_translator_cache_; |
| 261 } |
| 262 |
| 255 void DeferredGpuCommandService::RunTasks() { | 263 void DeferredGpuCommandService::RunTasks() { |
| 256 bool has_more_tasks; | 264 bool has_more_tasks; |
| 257 { | 265 { |
| 258 base::AutoLock lock(tasks_lock_); | 266 base::AutoLock lock(tasks_lock_); |
| 259 has_more_tasks = tasks_.size() > 0; | 267 has_more_tasks = tasks_.size() > 0; |
| 260 } | 268 } |
| 261 | 269 |
| 262 while (has_more_tasks) { | 270 while (has_more_tasks) { |
| 263 base::Closure task; | 271 base::Closure task; |
| 264 { | 272 { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 278 base::RefCountedThreadSafe<DeferredGpuCommandService>::AddRef(); | 286 base::RefCountedThreadSafe<DeferredGpuCommandService>::AddRef(); |
| 279 } | 287 } |
| 280 | 288 |
| 281 void DeferredGpuCommandService::Release() const { | 289 void DeferredGpuCommandService::Release() const { |
| 282 base::RefCountedThreadSafe<DeferredGpuCommandService>::Release(); | 290 base::RefCountedThreadSafe<DeferredGpuCommandService>::Release(); |
| 283 } | 291 } |
| 284 | 292 |
| 285 } // namespace internal | 293 } // namespace internal |
| 286 | 294 |
| 287 } // namespace android_webview | 295 } // namespace android_webview |
| OLD | NEW |