| OLD | NEW |
| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 typedef HashMap<void*, Dart_WeakPersistentHandle> DartDOMObjectMap; | 64 typedef HashMap<void*, Dart_WeakPersistentHandle> DartDOMObjectMap; |
| 65 /* TODO(terry): Had to change HashMap to point to void* otherwise C++ error: | 65 /* TODO(terry): Had to change HashMap to point to void* otherwise C++ error: |
| 66 * [blink-gc] Class 'DartDOMData' contains invalid fields. Raw | 66 * [blink-gc] Class 'DartDOMData' contains invalid fields. Raw |
| 67 * pointer field 'm_messagePortMap' to a GC managed class. | 67 * pointer field 'm_messagePortMap' to a GC managed class. |
| 68 * typedef HashMap<MessagePort*, Dart_WeakPersistentHandle> DartMessagePortMap; | 68 * typedef HashMap<MessagePort*, Dart_WeakPersistentHandle> DartMessagePortMap; |
| 69 */ | 69 */ |
| 70 typedef HashMap<void*, Dart_WeakPersistentHandle> DartMessagePortMap; | 70 typedef HashMap<void*, Dart_WeakPersistentHandle> DartMessagePortMap; |
| 71 typedef HashSet<DartIsolateDestructionObserver*> DartIsolateDestructionObservers
; | 71 typedef HashSet<DartIsolateDestructionObserver*> DartIsolateDestructionObservers
; |
| 72 typedef Dart_PersistentHandle ClassTable[NumWebkitClassIds]; | 72 typedef Dart_PersistentHandle ClassTable[NumWebkitClassIds]; |
| 73 typedef Dart_PersistentHandle LibraryTable[NumDartLibraryIds]; | 73 typedef Dart_PersistentHandle LibraryTable[NumDartLibraryIds]; |
| 74 typedef HashMap<Node*, Dart_WeakReferenceSet> WeakReferenceSetForRootMap; | |
| 75 | 74 |
| 76 class DartDOMData { | 75 class DartDOMData { |
| 77 public: | 76 public: |
| 78 DartDOMData(ExecutionContext*, const char* scriptURL, const char* packageRoo
t, bool isDOMEnabled); | 77 DartDOMData(ExecutionContext*, const char* scriptURL, const char* packageRoo
t, bool isDOMEnabled); |
| 79 ~DartDOMData(); | 78 ~DartDOMData(); |
| 80 | 79 |
| 81 static DartDOMData* current(); | 80 static DartDOMData* current(); |
| 82 | 81 |
| 83 char* scriptURL() const { return m_scriptURL; } | 82 char* scriptURL() const { return m_scriptURL; } |
| 84 const char* packageRoot() const { return m_packageRoot; } | 83 const char* packageRoot() const { return m_packageRoot; } |
| 85 ExecutionContext* scriptExecutionContext() { return m_scriptExecutionContext
; } | 84 ExecutionContext* scriptExecutionContext() { return m_scriptExecutionContext
; } |
| 86 bool isDOMEnabled() { return m_isDOMEnabled; } | 85 bool isDOMEnabled() { return m_isDOMEnabled; } |
| 87 | 86 |
| 88 // We track the Dart specific recursion level here as well as the global | 87 // We track the Dart specific recursion level here as well as the global |
| 89 // recursion level tracked by m_recursionScope due to dartbug.com/14183. | 88 // recursion level tracked by m_recursionScope due to dartbug.com/14183. |
| 90 int* recursion() { return &m_recursion; } | 89 int* recursion() { return &m_recursion; } |
| 91 DartStringCache& stringCache() { return m_stringCache; } | 90 DartStringCache& stringCache() { return m_stringCache; } |
| 92 | 91 |
| 93 void setThreadSafeIsolateWrapper(PassRefPtr<ThreadSafeDartIsolateWrapper>); | 92 void setThreadSafeIsolateWrapper(PassRefPtr<ThreadSafeDartIsolateWrapper>); |
| 94 PassRefPtr<ThreadSafeDartIsolateWrapper> threadSafeIsolateWrapper(); | 93 PassRefPtr<ThreadSafeDartIsolateWrapper> threadSafeIsolateWrapper(); |
| 95 | 94 |
| 96 void setApplicationLoader(PassRefPtr<DartApplicationLoader>); | 95 void setApplicationLoader(PassRefPtr<DartApplicationLoader>); |
| 97 PassRefPtr<DartApplicationLoader> applicationLoader(); | 96 PassRefPtr<DartApplicationLoader> applicationLoader(); |
| 98 | 97 |
| 98 bool hasApplicationLoader() { return m_applicationLoader; } |
| 99 |
| 99 Vector<uint8_t>* applicationSnapshot() { return &m_applicationSnapshot; } | 100 Vector<uint8_t>* applicationSnapshot() { return &m_applicationSnapshot; } |
| 100 | 101 |
| 101 void setReachableWeakHandle(Dart_WeakPersistentHandle reachableWeakHandle) | 102 void setReachableWeakHandle(Dart_WeakPersistentHandle reachableWeakHandle) |
| 102 { | 103 { |
| 103 m_reachableWeakHandle = reachableWeakHandle; | 104 m_reachableWeakHandle = reachableWeakHandle; |
| 104 } | 105 } |
| 105 Dart_WeakPersistentHandle reachableWeakHandle() { return m_reachableWeakHand
le; } | 106 Dart_WeakPersistentHandle reachableWeakHandle() { return m_reachableWeakHand
le; } |
| 106 | 107 |
| 107 DartDOMObjectMap* objectMap() { return &m_objectMap; } | 108 DartDOMObjectMap* objectMap() { return &m_objectMap; } |
| 108 DartMessagePortMap* messagePortMap() { return &m_messagePortMap; } | 109 DartMessagePortMap* messagePortMap() { return &m_messagePortMap; } |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 187 |
| 187 Dart_PersistentHandle currentException() const | 188 Dart_PersistentHandle currentException() const |
| 188 { | 189 { |
| 189 return m_currentException; | 190 return m_currentException; |
| 190 } | 191 } |
| 191 void setCurrentException(Dart_PersistentHandle exception) | 192 void setCurrentException(Dart_PersistentHandle exception) |
| 192 { | 193 { |
| 193 m_currentException = exception; | 194 m_currentException = exception; |
| 194 } | 195 } |
| 195 | 196 |
| 196 WeakReferenceSetForRootMap* weakReferenceSetForRootMap() const | |
| 197 { | |
| 198 return m_weakReferenceSetForRootMap; | |
| 199 } | |
| 200 void setWeakReferenceSetForRootMap(WeakReferenceSetForRootMap* map) | |
| 201 { | |
| 202 m_weakReferenceSetForRootMap = map; | |
| 203 } | |
| 204 | |
| 205 Dart_WeakReferenceSet documentWeakReferenceSet() const | |
| 206 { | |
| 207 return m_documentWeakReferenceSet; | |
| 208 } | |
| 209 void setDocumentWeakReferenceSet(Dart_WeakReferenceSet set) | |
| 210 { | |
| 211 m_documentWeakReferenceSet = set; | |
| 212 } | |
| 213 | |
| 214 Dart_WeakReferenceSetBuilder weakReferenceSetBuilder() const | |
| 215 { | |
| 216 return m_weakReferenceSetBuilder; | |
| 217 } | |
| 218 void setWeakReferenceSetBuilder(Dart_WeakReferenceSetBuilder setBuilder) | |
| 219 { | |
| 220 m_weakReferenceSetBuilder = setBuilder; | |
| 221 } | |
| 222 | |
| 223 private: | 197 private: |
| 224 Dart_PersistentHandle getLibrary(int libraryId, const char* name); | 198 Dart_PersistentHandle getLibrary(int libraryId, const char* name); |
| 225 | 199 |
| 226 char* m_scriptURL; | 200 char* m_scriptURL; |
| 227 const char* m_packageRoot; | 201 const char* m_packageRoot; |
| 228 ExecutionContext* m_scriptExecutionContext; | 202 ExecutionContext* m_scriptExecutionContext; |
| 229 bool m_isDOMEnabled; | 203 bool m_isDOMEnabled; |
| 230 int m_recursion; | 204 int m_recursion; |
| 231 DartStringCache m_stringCache; | 205 DartStringCache m_stringCache; |
| 232 RefPtr<ThreadSafeDartIsolateWrapper> m_threadSafeIsolateWrapper; | 206 RefPtr<ThreadSafeDartIsolateWrapper> m_threadSafeIsolateWrapper; |
| 233 Mutex m_isolateWrapperMutex; | 207 Mutex m_isolateWrapperMutex; |
| 234 RefPtr<DartApplicationLoader> m_applicationLoader; | 208 RefPtr<DartApplicationLoader> m_applicationLoader; |
| 235 Vector<uint8_t> m_applicationSnapshot; | 209 Vector<uint8_t> m_applicationSnapshot; |
| 236 Dart_WeakPersistentHandle m_reachableWeakHandle; | 210 Dart_WeakPersistentHandle m_reachableWeakHandle; |
| 237 | 211 |
| 238 DartJsInteropData m_jsInteropData; | 212 DartJsInteropData m_jsInteropData; |
| 239 DartDOMObjectMap m_objectMap; | 213 DartDOMObjectMap m_objectMap; |
| 240 DartMessagePortMap m_messagePortMap; | 214 DartMessagePortMap m_messagePortMap; |
| 241 DartIsolateDestructionObservers m_isolateDestructionObservers; | 215 DartIsolateDestructionObservers m_isolateDestructionObservers; |
| 242 ClassTable m_classHandleCache; | 216 ClassTable m_classHandleCache; |
| 243 LibraryTable m_libraryHandleCache; | 217 LibraryTable m_libraryHandleCache; |
| 244 Dart_PersistentHandle m_functionType; | 218 Dart_PersistentHandle m_functionType; |
| 245 Dart_PersistentHandle m_currentException; | 219 Dart_PersistentHandle m_currentException; |
| 246 DartScriptState* m_rootScriptState; | 220 DartScriptState* m_rootScriptState; |
| 247 | |
| 248 WeakReferenceSetForRootMap* m_weakReferenceSetForRootMap; | |
| 249 Dart_WeakReferenceSet m_documentWeakReferenceSet; | |
| 250 Dart_WeakReferenceSetBuilder m_weakReferenceSetBuilder; | |
| 251 }; | 221 }; |
| 252 | 222 |
| 253 } | 223 } |
| 254 | 224 |
| 255 #endif // DartDOMData_h | 225 #endif // DartDOMData_h |
| OLD | NEW |