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

Side by Side Diff: Source/bindings/dart/DartDOMData.h

Issue 23895004: Keep a persistent handle for the bindings classes to avoid repeated lookups that involve performing… (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: . Created 7 years, 3 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 | Source/bindings/dart/DartDOMData.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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef DartDOMData_h 31 #ifndef DartDOMData_h
32 #define DartDOMData_h 32 #define DartDOMData_h
33 33
34 #include "DartWebkitClassIds.h"
34 #include "bindings/dart/DartStringCache.h" 35 #include "bindings/dart/DartStringCache.h"
35 36
36 #include "wtf/HashMap.h" 37 #include "wtf/HashMap.h"
37 #include "wtf/HashSet.h" 38 #include "wtf/HashSet.h"
38 #include "wtf/RefPtr.h" 39 #include "wtf/RefPtr.h"
39 #include "wtf/Threading.h" 40 #include "wtf/Threading.h"
40 #include "wtf/ThreadingPrimitives.h" 41 #include "wtf/ThreadingPrimitives.h"
41 #include "wtf/Vector.h" 42 #include "wtf/Vector.h"
42 #include "wtf/text/WTFString.h" 43 #include "wtf/text/WTFString.h"
43 #include <dart_api.h> 44 #include <dart_api.h>
(...skipping 13 matching lines...) Expand all
57 class ThreadSafeDartIsolateWrapper; 58 class ThreadSafeDartIsolateWrapper;
58 59
59 typedef HashMap<Node*, Dart_WeakPersistentHandle> DartDOMNodeMap; 60 typedef HashMap<Node*, Dart_WeakPersistentHandle> DartDOMNodeMap;
60 typedef HashMap<void*, Dart_WeakPersistentHandle> DartDOMObjectMap; 61 typedef HashMap<void*, Dart_WeakPersistentHandle> DartDOMObjectMap;
61 typedef HashMap<MessagePort*, Dart_WeakPersistentHandle> DartMessagePortMap; 62 typedef HashMap<MessagePort*, Dart_WeakPersistentHandle> DartMessagePortMap;
62 typedef HashMap<ActiveDOMObject*, Dart_WeakPersistentHandle> DartActiveDOMObject Map; 63 typedef HashMap<ActiveDOMObject*, Dart_WeakPersistentHandle> DartActiveDOMObject Map;
63 typedef HashMap<EventTarget*, Dart_WeakPersistentHandle> DartEventTargetMap; 64 typedef HashMap<EventTarget*, Dart_WeakPersistentHandle> DartEventTargetMap;
64 typedef HashSet<DartWeakCallback*> DartWeakCallbacks; 65 typedef HashSet<DartWeakCallback*> DartWeakCallbacks;
65 typedef HashSet<DartIsolateDestructionObserver*> DartIsolateDestructionObservers ; 66 typedef HashSet<DartIsolateDestructionObserver*> DartIsolateDestructionObservers ;
66 typedef HashMap<String, Dart_PersistentHandle> DartCustomElementMap; 67 typedef HashMap<String, Dart_PersistentHandle> DartCustomElementMap;
68 typedef Dart_PersistentHandle ClassTable[NumWebkitClassIds];
67 69
68 class DartDOMData { 70 class DartDOMData {
69 public: 71 public:
70 DartDOMData(ScriptExecutionContext*, bool isDOMEnabled); 72 DartDOMData(ScriptExecutionContext*, bool isDOMEnabled);
71 ~DartDOMData(); 73 ~DartDOMData();
72 74
73 static DartDOMData* current(); 75 static DartDOMData* current();
74 76
75 ScriptExecutionContext* scriptExecutionContext() { return m_scriptExecutionC ontext; } 77 ScriptExecutionContext* scriptExecutionContext() { return m_scriptExecutionC ontext; }
76 bool isDOMEnabled() { return m_isDOMEnabled; } 78 bool isDOMEnabled() { return m_isDOMEnabled; }
(...skipping 13 matching lines...) Expand all
90 92
91 DartDOMNodeMap* nodeMap() { return &m_nodeMap; } 93 DartDOMNodeMap* nodeMap() { return &m_nodeMap; }
92 DartDOMObjectMap* objectMap() { return &m_objectMap; } 94 DartDOMObjectMap* objectMap() { return &m_objectMap; }
93 DartMessagePortMap* messagePortMap() { return &m_messagePortMap; } 95 DartMessagePortMap* messagePortMap() { return &m_messagePortMap; }
94 DartActiveDOMObjectMap* activeObjectMap() { return &m_activeObjectMap; } 96 DartActiveDOMObjectMap* activeObjectMap() { return &m_activeObjectMap; }
95 DartEventTargetMap* eventTargetMap() { return &m_eventTargetMap; } 97 DartEventTargetMap* eventTargetMap() { return &m_eventTargetMap; }
96 DartWeakCallbacks* weakCallbacks() { return &m_weakCallbacks; } 98 DartWeakCallbacks* weakCallbacks() { return &m_weakCallbacks; }
97 DartIsolateDestructionObservers* isolateDestructionObservers() { return &m_i solateDestructionObservers; } 99 DartIsolateDestructionObservers* isolateDestructionObservers() { return &m_i solateDestructionObservers; }
98 DartCustomElementMap* customElementMap() { return &m_customElementMap; } 100 DartCustomElementMap* customElementMap() { return &m_customElementMap; }
99 DartCustomElementMap* customBaseElementMap() { return &m_customBaseElementMa p; } 101 DartCustomElementMap* customBaseElementMap() { return &m_customBaseElementMa p; }
102 ClassTable* classHandleCache() { return &m_classHandleCache; }
100 103
101 private: 104 private:
102 ScriptExecutionContext* m_scriptExecutionContext; 105 ScriptExecutionContext* m_scriptExecutionContext;
103 bool m_isDOMEnabled; 106 bool m_isDOMEnabled;
104 int m_recursion; 107 int m_recursion;
105 DartStringCache m_stringCache; 108 DartStringCache m_stringCache;
106 RefPtr<ThreadSafeDartIsolateWrapper> m_threadSafeIsolateWrapper; 109 RefPtr<ThreadSafeDartIsolateWrapper> m_threadSafeIsolateWrapper;
107 Mutex m_isolateWrapperMutex; 110 Mutex m_isolateWrapperMutex;
108 RefPtr<DartApplicationLoader> m_applicationLoader; 111 RefPtr<DartApplicationLoader> m_applicationLoader;
109 Vector<uint8_t> m_applicationSnapshot; 112 Vector<uint8_t> m_applicationSnapshot;
110 Dart_WeakPersistentHandle m_reachableWeakHandle; 113 Dart_WeakPersistentHandle m_reachableWeakHandle;
111 114
112 DartDOMNodeMap m_nodeMap; 115 DartDOMNodeMap m_nodeMap;
113 DartDOMObjectMap m_objectMap; 116 DartDOMObjectMap m_objectMap;
114 DartMessagePortMap m_messagePortMap; 117 DartMessagePortMap m_messagePortMap;
115 DartActiveDOMObjectMap m_activeObjectMap; 118 DartActiveDOMObjectMap m_activeObjectMap;
116 DartEventTargetMap m_eventTargetMap; 119 DartEventTargetMap m_eventTargetMap;
117 DartWeakCallbacks m_weakCallbacks; 120 DartWeakCallbacks m_weakCallbacks;
118 DartIsolateDestructionObservers m_isolateDestructionObservers; 121 DartIsolateDestructionObservers m_isolateDestructionObservers;
119 DartCustomElementMap m_customElementMap; 122 DartCustomElementMap m_customElementMap;
120 DartCustomElementMap m_customBaseElementMap; 123 DartCustomElementMap m_customBaseElementMap;
124 ClassTable m_classHandleCache;
121 }; 125 };
122 126
123 } 127 }
124 128
125 #endif // DartDOMData_h 129 #endif // DartDOMData_h
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/dart/DartDOMData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698