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

Side by Side Diff: Source/core/events/PointerIdManager.h

Issue 1310643003: Make classes and structures in core/events and core/fetch fast-allocated. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 PointerIdManager_h 5 #ifndef PointerIdManager_h
6 #define PointerIdManager_h 6 #define PointerIdManager_h
7 7
8 #include "wtf/Allocator.h"
8 #include "wtf/ListHashSet.h" 9 #include "wtf/ListHashSet.h"
9 10
10 namespace blink { 11 namespace blink {
11 12
12 /** 13 /**
13 Helper class for tracking the primary pointer id for each type of PointerEvent s. 14 Helper class for tracking the primary pointer id for each type of PointerEvent s.
14 */ 15 */
15 class PointerIdManager { 16 class PointerIdManager {
17 DISALLOW_ALLOCATION();
16 public: 18 public:
17 // TODO(mustaq): Move this enum to PointerEvent.h? Change the spec to use en ums? 19 // TODO(mustaq): Move this enum to PointerEvent.h? Change the spec to use en ums?
18 enum PointerType { 20 enum PointerType {
19 PointerTypeUnknown = 0, 21 PointerTypeUnknown = 0,
20 PointerTypeMouse, 22 PointerTypeMouse,
21 PointerTypePen, 23 PointerTypePen,
22 PointerTypeTouch, 24 PointerTypeTouch,
23 PointerTypeLastEntry // Must be the last entry in the list 25 PointerTypeLastEntry // Must be the last entry in the list
24 }; 26 };
25 27
26 PointerIdManager(); 28 PointerIdManager();
27 ~PointerIdManager(); 29 ~PointerIdManager();
28 void clear(); 30 void clear();
29 void add(PointerType, unsigned); 31 void add(PointerType, unsigned);
30 void remove(PointerType, unsigned); 32 void remove(PointerType, unsigned);
31 bool isPrimary(PointerType, unsigned); 33 bool isPrimary(PointerType, unsigned);
32 34
33 private: 35 private:
34 ListHashSet<unsigned> m_ids[PointerTypeLastEntry]; 36 ListHashSet<unsigned> m_ids[PointerTypeLastEntry];
35 bool m_hasPrimaryId[PointerTypeLastEntry]; 37 bool m_hasPrimaryId[PointerTypeLastEntry];
36 }; 38 };
37 39
38 } // namespace blink 40 } // namespace blink
39 41
40 #endif // PointerIdManager_h 42 #endif // PointerIdManager_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698