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

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

Issue 444173003: aw: Improve idle task scheduling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove CurrentlyOnUIThread Created 6 years, 4 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 | « no previous file | android_webview/browser/deferred_gpu_command_service.cc » ('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 #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 #include <utility> 9 #include <utility>
10 10
(...skipping 27 matching lines...) Expand all
38 38
39 virtual void ScheduleTask(const base::Closure& task) OVERRIDE; 39 virtual void ScheduleTask(const base::Closure& task) OVERRIDE;
40 virtual void ScheduleIdleWork(const base::Closure& task) OVERRIDE; 40 virtual void ScheduleIdleWork(const base::Closure& task) OVERRIDE;
41 virtual bool UseVirtualizedGLContexts() OVERRIDE; 41 virtual bool UseVirtualizedGLContexts() OVERRIDE;
42 virtual scoped_refptr<gpu::gles2::ShaderTranslatorCache> 42 virtual scoped_refptr<gpu::gles2::ShaderTranslatorCache>
43 shader_translator_cache() OVERRIDE; 43 shader_translator_cache() OVERRIDE;
44 44
45 void RunTasks(); 45 void RunTasks();
46 // If |is_idle| is false, this will only run older idle tasks. 46 // If |is_idle| is false, this will only run older idle tasks.
47 void PerformIdleWork(bool is_idle); 47 void PerformIdleWork(bool is_idle);
48 bool HasIdleWork(); 48 // Flush the idle queue until it is empty. This is different from
49 // PerformIdleWork(is_idle = true), which does not run any newly scheduled
50 // idle tasks during the idle run.
51 void PerformAllIdleWork();
49 52
50 virtual void AddRef() const OVERRIDE; 53 virtual void AddRef() const OVERRIDE;
51 virtual void Release() const OVERRIDE; 54 virtual void Release() const OVERRIDE;
52 55
53 protected: 56 protected:
54 virtual ~DeferredGpuCommandService(); 57 virtual ~DeferredGpuCommandService();
55 friend class base::RefCountedThreadSafe<DeferredGpuCommandService>; 58 friend class base::RefCountedThreadSafe<DeferredGpuCommandService>;
56 59
57 private: 60 private:
58 friend class ScopedAllowGL; 61 friend class ScopedAllowGL;
59 static void RequestProcessGL(); 62 static void RequestProcessGL();
60 63
61 DeferredGpuCommandService(); 64 DeferredGpuCommandService();
65 size_t IdleQueueSize();
62 66
63 base::Lock tasks_lock_; 67 base::Lock tasks_lock_;
64 std::queue<base::Closure> tasks_; 68 std::queue<base::Closure> tasks_;
65 std::queue<std::pair<base::Time, base::Closure> > idle_tasks_; 69 std::queue<std::pair<base::Time, base::Closure> > idle_tasks_;
66 70
67 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; 71 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_;
68 DISALLOW_COPY_AND_ASSIGN(DeferredGpuCommandService); 72 DISALLOW_COPY_AND_ASSIGN(DeferredGpuCommandService);
69 }; 73 };
70 74
71 } // namespace android_webview 75 } // namespace android_webview
72 76
73 #endif // ANDROID_WEBVIEW_BROWSER_DEFERRED_GPU_COMMAND_SERVICE_H_ 77 #endif // ANDROID_WEBVIEW_BROWSER_DEFERRED_GPU_COMMAND_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | android_webview/browser/deferred_gpu_command_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698