| 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 } | 243 } |
| 243 } | 244 } |
| 244 | 245 |
| 245 void DeferredGpuCommandService::ScheduleIdleWork( | 246 void DeferredGpuCommandService::ScheduleIdleWork( |
| 246 const base::Closure& callback) { | 247 const base::Closure& callback) { |
| 247 // TODO(sievers): Should this do anything? | 248 // TODO(sievers): Should this do anything? |
| 248 } | 249 } |
| 249 | 250 |
| 250 bool DeferredGpuCommandService::UseVirtualizedGLContexts() { return true; } | 251 bool DeferredGpuCommandService::UseVirtualizedGLContexts() { return true; } |
| 251 | 252 |
| 253 gpu::gles2::ShaderTranslatorCache* |
| 254 DeferredGpuCommandService::shader_translator_cache() { |
| 255 if (!shader_translator_cache_.get()) |
| 256 shader_translator_cache_ = new gpu::gles2::ShaderTranslatorCache; |
| 257 return shader_translator_cache_.get(); |
| 258 } |
| 259 |
| 252 void DeferredGpuCommandService::RunTasks() { | 260 void DeferredGpuCommandService::RunTasks() { |
| 253 bool has_more_tasks; | 261 bool has_more_tasks; |
| 254 { | 262 { |
| 255 base::AutoLock lock(tasks_lock_); | 263 base::AutoLock lock(tasks_lock_); |
| 256 has_more_tasks = tasks_.size() > 0; | 264 has_more_tasks = tasks_.size() > 0; |
| 257 } | 265 } |
| 258 | 266 |
| 259 while (has_more_tasks) { | 267 while (has_more_tasks) { |
| 260 base::Closure task; | 268 base::Closure task; |
| 261 { | 269 { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 275 base::RefCountedThreadSafe<DeferredGpuCommandService>::AddRef(); | 283 base::RefCountedThreadSafe<DeferredGpuCommandService>::AddRef(); |
| 276 } | 284 } |
| 277 | 285 |
| 278 void DeferredGpuCommandService::Release() const { | 286 void DeferredGpuCommandService::Release() const { |
| 279 base::RefCountedThreadSafe<DeferredGpuCommandService>::Release(); | 287 base::RefCountedThreadSafe<DeferredGpuCommandService>::Release(); |
| 280 } | 288 } |
| 281 | 289 |
| 282 } // namespace internal | 290 } // namespace internal |
| 283 | 291 |
| 284 } // namespace android_webview | 292 } // namespace android_webview |
| OLD | NEW |