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

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

Issue 1136953011: Shrinking EventPath to improve memory usage and performance (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added comment. Created 5 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
« no previous file with comments | « no previous file | Source/core/events/EventPath.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 DECLARE_TRACE(); 68 DECLARE_TRACE();
69 void clear() 69 void clear()
70 { 70 {
71 m_nodeEventContexts.clear(); 71 m_nodeEventContexts.clear();
72 m_treeScopeEventContexts.clear(); 72 m_treeScopeEventContexts.clear();
73 } 73 }
74 74
75 private: 75 private:
76 EventPath(); 76 EventPath();
77 77
78 void addNodeEventContext(Node&);
79
80 void initialize(); 78 void initialize();
81 void calculatePath(); 79 void calculatePath();
82 void calculateAdjustedTargets(); 80 void calculateAdjustedTargets();
83 void calculateTreeScopePrePostOrderNumbers(); 81 void calculateTreeScopePrePostOrderNumbers();
84 82
85 void shrink(size_t newSize) { ASSERT(!m_windowEventContext); m_nodeEventCont exts.shrink(newSize); } 83 void shrink(size_t newSize) { ASSERT(!m_windowEventContext); m_nodeEventCont exts.shrink(newSize); }
86 void shrinkIfNeeded(const Node& target, const EventTarget& relatedTarget); 84 void shrinkIfNeeded(const Node& target, const EventTarget& relatedTarget);
87 85
88 void adjustTouchList(const TouchList*, WillBeHeapVector<RawPtrWillBeMember<T ouchList>> adjustedTouchList, const WillBeHeapVector<RawPtrWillBeMember<TreeScop e>>& treeScopes); 86 void adjustTouchList(const TouchList*, WillBeHeapVector<RawPtrWillBeMember<T ouchList>> adjustedTouchList, const WillBeHeapVector<RawPtrWillBeMember<TreeScop e>>& treeScopes);
89 87
90 typedef WillBeHeapHashMap<RawPtrWillBeMember<TreeScope>, RefPtrWillBeMember< TreeScopeEventContext>> TreeScopeEventContextMap; 88 typedef WillBeHeapHashMap<RawPtrWillBeMember<TreeScope>, RefPtrWillBeMember< TreeScopeEventContext>> TreeScopeEventContextMap;
91 TreeScopeEventContext* ensureTreeScopeEventContext(Node* currentTarget, Tree Scope*, TreeScopeEventContextMap&); 89 TreeScopeEventContext* ensureTreeScopeEventContext(Node* currentTarget, Tree Scope*, TreeScopeEventContextMap&);
92 90
93 typedef WillBeHeapHashMap<RawPtrWillBeMember<TreeScope>, RawPtrWillBeMember< EventTarget>> RelatedTargetMap; 91 typedef WillBeHeapHashMap<RawPtrWillBeMember<TreeScope>, RawPtrWillBeMember< EventTarget>> RelatedTargetMap;
94 92
95 static void buildRelatedNodeMap(const Node&, RelatedTargetMap&); 93 static void buildRelatedNodeMap(const Node&, RelatedTargetMap&);
96 static EventTarget* findRelatedNode(TreeScope&, RelatedTargetMap&); 94 static EventTarget* findRelatedNode(TreeScope&, RelatedTargetMap&);
97 95
98 #if ENABLE(ASSERT) 96 #if ENABLE(ASSERT)
99 static void checkReachability(TreeScope&, TouchList&); 97 static void checkReachability(TreeScope&, TouchList&);
100 #endif 98 #endif
101 99
102 const NodeEventContext& topNodeEventContext(); 100 const NodeEventContext& topNodeEventContext();
103 101
104 WillBeHeapVector<NodeEventContext, 64> m_nodeEventContexts; 102 WillBeHeapVector<NodeEventContext> m_nodeEventContexts;
105 RawPtrWillBeMember<Node> m_node; 103 RawPtrWillBeMember<Node> m_node;
106 RawPtrWillBeMember<Event> m_event; 104 RawPtrWillBeMember<Event> m_event;
107 WillBeHeapVector<RefPtrWillBeMember<TreeScopeEventContext>> m_treeScopeEvent Contexts; 105 WillBeHeapVector<RefPtrWillBeMember<TreeScopeEventContext>> m_treeScopeEvent Contexts;
108 OwnPtrWillBeMember<WindowEventContext> m_windowEventContext; 106 OwnPtrWillBeMember<WindowEventContext> m_windowEventContext;
109 }; 107 };
110 108
111 } // namespace 109 } // namespace
112 110
113 #endif 111 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/events/EventPath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698