Changeset 102067 in webkit
- Timestamp:
- Dec 5, 2011, 4:33:28 PM (15 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 added
- 7 edited
-
ChangeLog (modified) (1 diff)
-
Target.pri (modified) (2 diffs)
-
UseV8.cmake (modified) (1 diff)
-
WebCore.gypi (modified) (1 diff)
-
bindings/v8/V8Binding.h (modified) (2 diffs)
-
bindings/v8/V8Proxy.cpp (modified) (8 diffs)
-
bindings/v8/V8Proxy.h (modified) (1 diff)
-
bindings/v8/V8RecursionScope.cpp (added)
-
bindings/v8/V8RecursionScope.h (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r102064 r102067 1 2011-12-05 Adam Klein <adamk@chromium.org> 2 3 V8RecursionScope should call didLeaveScriptContext when recursionLevel reaches zero 4 https://bugs.webkit.org/show_bug.cgi?id=73867 5 6 Reviewed by Adam Barth. 7 8 Moved V8RecursionScope into its own file, and moved 9 V8Proxy::didLeaveScriptContext into that file, along with a static 10 recursionLevel accessor, hiding the V8BindingPerIsolateData methods 11 from V8Proxy. 12 13 This will make it easy and less error-prone to use V8RecursionScope 14 properly. I plan to make use of it in V8LazyEventListener to fix 15 https://bugs.webkit.org/show_bug.cgi?id=73492. 16 17 No new tests, refactoring only. 18 19 * Target.pri: 20 * UseV8.cmake: 21 * WebCore.gypi: 22 * bindings/v8/V8Binding.h: 23 (WebCore::V8BindingPerIsolateData::incrementRecursionLevel): return the new recursion level. 24 (WebCore::V8BindingPerIsolateData::decrementRecursionLevel): return the new recursion level. 25 * bindings/v8/V8Proxy.cpp: remove didLeaveScriptContext. 26 (WebCore::V8Proxy::runScript): remove explicit call to didLeaveScriptContext. 27 (WebCore::V8Proxy::instrumentedCallFunction): remove explicit call to didLeaveScriptContext. 28 * bindings/v8/V8Proxy.h: remove didLeaveScriptContext. 29 * bindings/v8/V8RecursionScope.cpp: Added. 30 (WebCore::V8RecursionScope::didLeaveScriptContext): copied from V8Proxy.cpp. 31 * bindings/v8/V8RecursionScope.h: Added. 32 (WebCore::V8RecursionScope::V8RecursionScope): 33 (WebCore::V8RecursionScope::~V8RecursionScope): 34 (WebCore::V8RecursionScope::recursionLevel): 35 1 36 2011-12-05 Benjamin Poulain <bpoulain@apple.com> 2 37 -
trunk/Source/WebCore/Target.pri
r101932 r102067 135 135 bindings/v8/V8NodeFilterCondition.cpp \ 136 136 bindings/v8/V8Proxy.cpp \ 137 bindings/v8/V8RecursionScope.cpp \ 137 138 bindings/v8/V8Utilities.cpp \ 138 139 bindings/v8/V8WindowErrorHandler.cpp \ … … 1390 1391 bindings/v8/V8NPUtils.h \ 1391 1392 bindings/v8/V8Proxy.h \ 1393 bindings/v8/V8RecursionScope.h \ 1392 1394 bindings/v8/V8Utilities.h \ 1393 1395 bindings/v8/V8WindowErrorHandler.h \ -
trunk/Source/WebCore/UseV8.cmake
r100126 r102067 54 54 bindings/v8/V8NodeFilterCondition.cpp 55 55 bindings/v8/V8Proxy.cpp 56 bindings/v8/V8RecursionScope.cpp 56 57 bindings/v8/V8Utilities.cpp 57 58 bindings/v8/V8WindowErrorHandler.cpp -
trunk/Source/WebCore/WebCore.gypi
r102018 r102067 2140 2140 'bindings/v8/V8Proxy.cpp', 2141 2141 'bindings/v8/V8Proxy.h', 2142 'bindings/v8/V8RecursionScope.cpp', 2143 'bindings/v8/V8RecursionScope.h', 2142 2144 'bindings/v8/V8Utilities.cpp', 2143 2145 'bindings/v8/V8Utilities.h', -
trunk/Source/WebCore/bindings/v8/V8Binding.h
r100721 r102067 146 146 147 147 int recursionLevel() const { return m_recursionLevel; } 148 void incrementRecursionLevel() {++m_recursionLevel; }149 void decrementRecursionLevel() {--m_recursionLevel; }148 int incrementRecursionLevel() { return ++m_recursionLevel; } 149 int decrementRecursionLevel() { return --m_recursionLevel; } 150 150 151 151 #ifndef NDEBUG … … 177 177 GlobalHandleMap m_globalHandleMap; 178 178 #endif 179 };180 181 class V8RecursionScope {182 WTF_MAKE_NONCOPYABLE(V8RecursionScope);183 public:184 V8RecursionScope() { V8BindingPerIsolateData::current()->incrementRecursionLevel(); }185 ~V8RecursionScope() { V8BindingPerIsolateData::current()->decrementRecursionLevel(); }186 179 }; 187 180 -
trunk/Source/WebCore/bindings/v8/V8Proxy.cpp
r101490 r102067 43 43 #include "FrameLoaderClient.h" 44 44 #include "IDBFactoryBackendInterface.h" 45 #include "IDBPendingTransactionMonitor.h"46 45 #include "InspectorInstrumentation.h" 47 46 #include "Page.h" … … 58 57 #include "V8HiddenPropertyName.h" 59 58 #include "V8IsolatedContext.h" 60 #include " WebKitMutationObserver.h"59 #include "V8RecursionScope.h" 61 60 #include "WorkerContext.h" 62 61 #include "WorkerContextExecutionProxy.h" … … 174 173 // such as out-of-memory by crashing the renderer. 175 174 CRASH(); 176 }177 178 static int recursionLevel()179 {180 return V8BindingPerIsolateData::current()->recursionLevel();181 175 } 182 176 … … 391 385 392 386 V8GCController::checkMemoryUsage(); 393 if ( recursionLevel() >= kMaxRecursionDepth)387 if (V8RecursionScope::recursionLevel() >= kMaxRecursionDepth) 394 388 return handleMaxRecursionDepthExceeded(); 395 389 … … 409 403 } 410 404 411 didLeaveScriptContext();412 413 405 if (handleOutOfMemory()) 414 406 ASSERT(result.IsEmpty()); … … 440 432 V8GCController::checkMemoryUsage(); 441 433 442 if ( recursionLevel() >= kMaxRecursionDepth)434 if (V8RecursionScope::recursionLevel() >= kMaxRecursionDepth) 443 435 return handleMaxRecursionDepthExceeded(); 444 436 … … 461 453 } 462 454 463 // FIXME: Instrument any work that takes place when script exits to c++ (e.g. Mutation Observers).464 didLeaveScriptContext();465 466 455 InspectorInstrumentation::didCallFunction(cookie); 467 456 … … 551 540 return 0; 552 541 return retrieve(static_cast<Document*>(context)->frame()); 553 }554 555 void V8Proxy::didLeaveScriptContext()556 {557 if (recursionLevel())558 return;559 560 #if ENABLE(INDEXED_DATABASE)561 // If we've just left a script context and indexed database has been562 // instantiated, we must let its transaction coordinator know so it can terminate563 // any not-yet-started transactions.564 IDBPendingTransactionMonitor::abortPendingTransactions();565 #endif // ENABLE(INDEXED_DATABASE)566 567 #if ENABLE(MUTATION_OBSERVERS)568 WebCore::WebKitMutationObserver::deliverAllMutations();569 #endif570 542 } 571 543 -
trunk/Source/WebCore/bindings/v8/V8Proxy.h
r101490 r102067 265 265 266 266 private: 267 static void didLeaveScriptContext();268 269 267 void resetIsolatedWorlds(); 270 268
Note:
See TracChangeset
for help on using the changeset viewer.