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

Side by Side Diff: android_webview/browser/deferred_gpu_command_service.h

Issue 287993004: [Android WebView] Implement Ubercomp for Render Thread support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 6 years, 7 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
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 #ifndef ANDROID_WEBVIEW_BROWSER_DEFERRED_GPU_COMMAND_SERVICE_H_ 5 #ifndef ANDROID_WEBVIEW_BROWSER_DEFERRED_GPU_COMMAND_SERVICE_H_
6 #define ANDROID_WEBVIEW_BROWSER_DEFERRED_GPU_COMMAND_SERVICE_H_ 6 #define ANDROID_WEBVIEW_BROWSER_DEFERRED_GPU_COMMAND_SERVICE_H_
7 7
8 #include <queue> 8 #include <queue>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/threading/thread_local.h" 12 #include "base/threading/thread_local.h"
13 #include "gpu/command_buffer/service/in_process_command_buffer.h" 13 #include "gpu/command_buffer/service/in_process_command_buffer.h"
14 14
15 namespace android_webview { 15 namespace android_webview {
16 16
17 class ScopedAllowGL { 17 class ScopedAllowGL {
18 public: 18 public:
19 ScopedAllowGL(); 19 ScopedAllowGL();
20 ~ScopedAllowGL(); 20 ~ScopedAllowGL();
21 21
22 static bool IsAllowed(); 22 static bool IsAllowed();
23 23
24 private: 24 private:
25 static base::LazyInstance<base::ThreadLocalBoolean> allow_gl; 25 static base::LazyInstance<base::ThreadLocalBoolean> allow_gl;
26 26
27 DISALLOW_COPY_AND_ASSIGN(ScopedAllowGL); 27 DISALLOW_COPY_AND_ASSIGN(ScopedAllowGL);
28 }; 28 };
29 29
30 // TODO(boliu): Teach this class about RT.
31 class DeferredGpuCommandService 30 class DeferredGpuCommandService
32 : public gpu::InProcessCommandBuffer::Service, 31 : public gpu::InProcessCommandBuffer::Service,
33 public base::RefCountedThreadSafe<DeferredGpuCommandService> { 32 public base::RefCountedThreadSafe<DeferredGpuCommandService> {
34 public: 33 public:
35 static void SetInstance(); 34 static void SetInstance();
35 static DeferredGpuCommandService* GetInstance();
36 36
37 virtual void ScheduleTask(const base::Closure& task) OVERRIDE; 37 virtual void ScheduleTask(const base::Closure& task) OVERRIDE;
38 virtual void ScheduleIdleWork(const base::Closure& task) OVERRIDE; 38 virtual void ScheduleIdleWork(const base::Closure& task) OVERRIDE;
39 virtual bool UseVirtualizedGLContexts() OVERRIDE; 39 virtual bool UseVirtualizedGLContexts() OVERRIDE;
40 virtual scoped_refptr<gpu::gles2::ShaderTranslatorCache> 40 virtual scoped_refptr<gpu::gles2::ShaderTranslatorCache>
41 shader_translator_cache() OVERRIDE; 41 shader_translator_cache() OVERRIDE;
42 42
43 void RunTasks(); 43 void RunTasks();
44 44
45 virtual void AddRef() const OVERRIDE; 45 virtual void AddRef() const OVERRIDE;
46 virtual void Release() const OVERRIDE; 46 virtual void Release() const OVERRIDE;
47 47
48 protected: 48 protected:
49 virtual ~DeferredGpuCommandService(); 49 virtual ~DeferredGpuCommandService();
50 friend class base::RefCountedThreadSafe<DeferredGpuCommandService>; 50 friend class base::RefCountedThreadSafe<DeferredGpuCommandService>;
51 51
52 private: 52 private:
53 static void RequestProcessGLOnUIThread(); 53 static void RequestProcessGL();
54 54
55 DeferredGpuCommandService(); 55 DeferredGpuCommandService();
56 56
57 base::Lock tasks_lock_; 57 base::Lock tasks_lock_;
58 std::queue<base::Closure> tasks_; 58 std::queue<base::Closure> tasks_;
59 59
60 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; 60 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_;
61 DISALLOW_COPY_AND_ASSIGN(DeferredGpuCommandService); 61 DISALLOW_COPY_AND_ASSIGN(DeferredGpuCommandService);
62 }; 62 };
63 63
64 } // namespace android_webview 64 } // namespace android_webview
65 65
66 #endif // ANDROID_WEBVIEW_BROWSER_DEFERRED_GPU_COMMAND_SERVICE_H_ 66 #endif // ANDROID_WEBVIEW_BROWSER_DEFERRED_GPU_COMMAND_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698