OLD | NEW |
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_INPUT_INPUT_HANDLER_H_ | 5 #ifndef CC_INPUT_INPUT_HANDLER_H_ |
6 #define CC_INPUT_INPUT_HANDLER_H_ | 6 #define CC_INPUT_INPUT_HANDLER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "cc/base/cc_export.h" | 11 #include "cc/base/cc_export.h" |
| 12 #include "cc/input/main_thread_scrolling_reason.h" |
12 #include "cc/input/scroll_state.h" | 13 #include "cc/input/scroll_state.h" |
13 #include "cc/input/scrollbar.h" | 14 #include "cc/input/scrollbar.h" |
14 #include "cc/trees/swap_promise_monitor.h" | 15 #include "cc/trees/swap_promise_monitor.h" |
15 | 16 |
16 namespace gfx { | 17 namespace gfx { |
17 class Point; | 18 class Point; |
18 class PointF; | 19 class PointF; |
19 class ScrollOffset; | 20 class ScrollOffset; |
20 class SizeF; | 21 class SizeF; |
21 class Vector2d; | 22 class Vector2d; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // interface and bind it to the handler on the compositor thread. | 76 // interface and bind it to the handler on the compositor thread. |
76 class CC_EXPORT InputHandler { | 77 class CC_EXPORT InputHandler { |
77 public: | 78 public: |
78 // Note these are used in a histogram. Do not reorder or delete existing | 79 // Note these are used in a histogram. Do not reorder or delete existing |
79 // entries. | 80 // entries. |
80 enum ScrollThread { | 81 enum ScrollThread { |
81 SCROLL_ON_MAIN_THREAD = 0, | 82 SCROLL_ON_MAIN_THREAD = 0, |
82 SCROLL_ON_IMPL_THREAD, | 83 SCROLL_ON_IMPL_THREAD, |
83 SCROLL_IGNORED, | 84 SCROLL_IGNORED, |
84 SCROLL_UNKNOWN, | 85 SCROLL_UNKNOWN, |
85 // This must be the last entry. | 86 LAST_SCROLL_STATUS = SCROLL_UNKNOWN |
86 ScrollStatusCount | |
87 }; | |
88 | |
89 // Ensure this stays in sync with MainThreadScrollingReason in histograms.xml, | |
90 // and that this extends ScrollingCoordinator::MainThreadScrollingReason. | |
91 // ScrollingCoordinator::MainThreadScrollingReason contains the flags | |
92 // which are associated with a layer. The flags only contained in | |
93 // InputHandler::MainThreadScrollingReason are computed for each scroll | |
94 // begin. | |
95 enum MainThreadScrollingReason { | |
96 NOT_SCROLLING_ON_MAIN = 0, | |
97 HAS_BACKGROUND_ATTACHMENT_FIXED_OBJECTS = 1 << 0, | |
98 HAS_NON_LAYER_VIEWPORT_CONSTRAINED_OBJECTS = 1 << 1, | |
99 THREADED_SCROLLING_DISABLED = 1 << 2, | |
100 SCROLL_BAR_SCROLLING = 1 << 3, | |
101 PAGE_OVERLAY = 1 << 4, | |
102 MaxNonTransientScrollingReason = PAGE_OVERLAY, | |
103 NON_FAST_SCROLLABLE_REGION = 1 << 5, | |
104 EVENT_HANDLERS = 1 << 6, | |
105 FAILED_HIT_TEST = 1 << 7, | |
106 NO_SCROLLING_LAYER = 1 << 8, | |
107 NOT_SCROLLABLE = 1 << 9, | |
108 CONTINUING_MAIN_THREAD_SCROLL = 1 << 10, | |
109 NON_INVERTIBLE_TRANSFORM = 1 << 11, | |
110 PAGE_BASED_SCROLLING = 1 << 12, | |
111 MainThreadScrollingReasonCount = 14 | |
112 }; | 87 }; |
113 | 88 |
114 struct ScrollStatus { | 89 struct ScrollStatus { |
115 ScrollStatus() | 90 ScrollStatus() |
116 : thread(SCROLL_ON_IMPL_THREAD), | 91 : thread(SCROLL_ON_IMPL_THREAD), |
117 main_thread_scrolling_reasons(NOT_SCROLLING_ON_MAIN) {} | 92 main_thread_scrolling_reasons( |
118 ScrollStatus(ScrollThread thread, | 93 MainThreadScrollingReason::kNotScrollingOnMain) {} |
119 MainThreadScrollingReason main_thread_scrolling_reasons) | 94 ScrollStatus(ScrollThread thread, uint32_t main_thread_scrolling_reasons) |
120 : thread(thread), | 95 : thread(thread), |
121 main_thread_scrolling_reasons(main_thread_scrolling_reasons) {} | 96 main_thread_scrolling_reasons(main_thread_scrolling_reasons) {} |
122 ScrollThread thread; | 97 ScrollThread thread; |
123 MainThreadScrollingReason main_thread_scrolling_reasons; | 98 uint32_t main_thread_scrolling_reasons; |
124 }; | 99 }; |
125 | 100 |
126 enum ScrollInputType { GESTURE, WHEEL, ANIMATED_WHEEL, NON_BUBBLING_GESTURE }; | 101 enum ScrollInputType { GESTURE, WHEEL, ANIMATED_WHEEL, NON_BUBBLING_GESTURE }; |
127 | 102 |
128 // Binds a client to this handler to receive notifications. Only one client | 103 // Binds a client to this handler to receive notifications. Only one client |
129 // can be bound to an InputHandler. The client must live at least until the | 104 // can be bound to an InputHandler. The client must live at least until the |
130 // handler calls WillShutdown() on the client. | 105 // handler calls WillShutdown() on the client. |
131 virtual void BindToClient(InputHandlerClient* client) = 0; | 106 virtual void BindToClient(InputHandlerClient* client) = 0; |
132 | 107 |
133 // Selects a layer to be scrolled using the |scroll_state| start position. | 108 // Selects a layer to be scrolled using the |scroll_state| start position. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 virtual ScrollElasticityHelper* CreateScrollElasticityHelper() = 0; | 187 virtual ScrollElasticityHelper* CreateScrollElasticityHelper() = 0; |
213 | 188 |
214 protected: | 189 protected: |
215 InputHandler() {} | 190 InputHandler() {} |
216 virtual ~InputHandler() {} | 191 virtual ~InputHandler() {} |
217 | 192 |
218 private: | 193 private: |
219 DISALLOW_COPY_AND_ASSIGN(InputHandler); | 194 DISALLOW_COPY_AND_ASSIGN(InputHandler); |
220 }; | 195 }; |
221 | 196 |
222 inline const InputHandler::MainThreadScrollingReason& operator|=( | |
223 InputHandler::MainThreadScrollingReason& a, | |
224 InputHandler::MainThreadScrollingReason b) { | |
225 return a = static_cast<InputHandler::MainThreadScrollingReason>( | |
226 static_cast<unsigned>(a) | static_cast<unsigned>(b)); | |
227 } | |
228 | |
229 } // namespace cc | 197 } // namespace cc |
230 | 198 |
231 #endif // CC_INPUT_INPUT_HANDLER_H_ | 199 #endif // CC_INPUT_INPUT_HANDLER_H_ |
OLD | NEW |