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

Side by Side Diff: android_webview/browser/hardware_renderer.cc

Issue 217813004: Make ShaderTranslatorCache thread safe (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « android_webview/browser/hardware_renderer.h ('k') | content/common/gpu/gpu_channel_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « android_webview/browser/hardware_renderer.h ('k') | content/common/gpu/gpu_channel_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698