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

Side by Side Diff: cc/trees/proxy.h

Issue 363383002: Forward input tasks to the Blink scheduler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup. DefaultMainThreadTaskRunner now dispatches properly. Created 6 years, 5 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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 CC_TREES_PROXY_H_ 5 #ifndef CC_TREES_PROXY_H_
6 #define CC_TREES_PROXY_H_ 6 #define CC_TREES_PROXY_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/threading/platform_thread.h" 14 #include "base/threading/platform_thread.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "cc/base/cc_export.h" 17 #include "cc/base/cc_export.h"
18 #include "cc/trees/main_thread_task_runner.h"
18 19
19 namespace base { class SingleThreadTaskRunner; } 20 namespace base { class SingleThreadTaskRunner; }
20 21
21 namespace gfx { 22 namespace gfx {
22 class Rect; 23 class Rect;
23 class Vector2d; 24 class Vector2d;
24 } 25 }
25 26
26 namespace cc { 27 namespace cc {
27 28
28 class LayerTreeDebugState; 29 class LayerTreeDebugState;
30 class MainThreadTaskRunner;
29 class OutputSurface; 31 class OutputSurface;
30 struct RendererCapabilities; 32 struct RendererCapabilities;
31 33
32 // Abstract class responsible for proxying commands from the main-thread side of 34 // Abstract class responsible for proxying commands from the main-thread side of
33 // the compositor over to the compositor implementation. 35 // the compositor over to the compositor implementation.
34 class CC_EXPORT Proxy { 36 class CC_EXPORT Proxy {
35 public: 37 public:
36 base::SingleThreadTaskRunner* MainThreadTaskRunner() const; 38 MainThreadTaskRunner* MainThreadTaskRunner() const;
37 bool HasImplThread() const; 39 bool HasImplThread() const;
38 base::SingleThreadTaskRunner* ImplThreadTaskRunner() const; 40 base::SingleThreadTaskRunner* ImplThreadTaskRunner() const;
39 41
40 // Debug hooks. 42 // Debug hooks.
41 bool IsMainThread() const; 43 bool IsMainThread() const;
42 bool IsImplThread() const; 44 bool IsImplThread() const;
43 bool IsMainThreadBlocked() const; 45 bool IsMainThreadBlocked() const;
44 #if DCHECK_IS_ON 46 #if DCHECK_IS_ON
45 void SetMainThreadBlocked(bool is_main_thread_blocked); 47 void SetMainThreadBlocked(bool is_main_thread_blocked);
46 void SetCurrentThreadIsImplThread(bool is_impl_thread); 48 void SetCurrentThreadIsImplThread(bool is_impl_thread);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 95
94 virtual scoped_ptr<base::Value> AsValue() const = 0; 96 virtual scoped_ptr<base::Value> AsValue() const = 0;
95 97
96 virtual void SetDebugState(const LayerTreeDebugState& debug_state) = 0; 98 virtual void SetDebugState(const LayerTreeDebugState& debug_state) = 0;
97 99
98 // Testing hooks 100 // Testing hooks
99 virtual bool CommitPendingForTesting() = 0; 101 virtual bool CommitPendingForTesting() = 0;
100 virtual scoped_ptr<base::Value> SchedulerAsValueForTesting(); 102 virtual scoped_ptr<base::Value> SchedulerAsValueForTesting();
101 103
102 protected: 104 protected:
103 explicit Proxy( 105 Proxy(scoped_refptr<cc::MainThreadTaskRunner> main_task_runner,
104 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); 106 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
105 friend class DebugScopedSetImplThread; 107 friend class DebugScopedSetImplThread;
106 friend class DebugScopedSetMainThread; 108 friend class DebugScopedSetMainThread;
107 friend class DebugScopedSetMainThreadBlocked; 109 friend class DebugScopedSetMainThreadBlocked;
108 110
109 private: 111 private:
110 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; 112 scoped_refptr<cc::MainThreadTaskRunner> main_task_runner_;
111 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_; 113 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_;
112 #if DCHECK_IS_ON 114 #if DCHECK_IS_ON
113 const base::PlatformThreadId main_thread_id_; 115 const base::PlatformThreadId main_thread_id_;
114 bool impl_thread_is_overridden_; 116 bool impl_thread_is_overridden_;
115 bool is_main_thread_blocked_; 117 bool is_main_thread_blocked_;
116 #endif 118 #endif
117 119
118 DISALLOW_COPY_AND_ASSIGN(Proxy); 120 DISALLOW_COPY_AND_ASSIGN(Proxy);
119 }; 121 };
120 122
(...skipping 18 matching lines...) Expand all
139 explicit DebugScopedSetMainThreadBlocked(Proxy* proxy) {} 141 explicit DebugScopedSetMainThreadBlocked(Proxy* proxy) {}
140 ~DebugScopedSetMainThreadBlocked() {} 142 ~DebugScopedSetMainThreadBlocked() {}
141 private: 143 private:
142 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetMainThreadBlocked); 144 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetMainThreadBlocked);
143 }; 145 };
144 #endif 146 #endif
145 147
146 } // namespace cc 148 } // namespace cc
147 149
148 #endif // CC_TREES_PROXY_H_ 150 #endif // CC_TREES_PROXY_H_
OLDNEW
« no previous file with comments | « cc/trees/main_thread_task_runner.cc ('k') | cc/trees/proxy.cc » ('j') | cc/trees/thread_proxy.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698