Changeset 205033 in webkit
- Timestamp:
- Aug 26, 2016, 1:22:21 PM (9 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r205027 r205033 1 2016-08-26 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: HeapProfiler/ScriptProfiler do not destruct safely when JSContext is destroyed 4 https://bugs.webkit.org/show_bug.cgi?id=161027 5 <rdar://problem/27871349> 6 7 Reviewed by Mark Lam. 8 9 For JSContext inspection, when a frontend connects keep the target alive. 10 This means ref'ing the JSGlobalObject / VM when the first frontend 11 connects and deref'ing when the last frontend disconnects. 12 13 * inspector/JSGlobalObjectInspectorController.h: 14 * inspector/JSGlobalObjectInspectorController.cpp: 15 (Inspector::JSGlobalObjectInspectorController::globalObjectDestroyed): 16 (Inspector::JSGlobalObjectInspectorController::disconnectAllFrontends): Deleted. 17 Now that frontends keep the global object alive, when the global object 18 is destroyed that must mean that no frontends exist. Remove the now 19 stale code path. 20 21 (Inspector::JSGlobalObjectInspectorController::connectFrontend): 22 (Inspector::JSGlobalObjectInspectorController::disconnectFrontend): 23 Ref the target when the first frontend connects, deref when the last disconnects. 24 1 25 2016-08-26 Yusuke Suzuki <utatane.tea@gmail.com> 2 26 -
trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp
r204912 r205033 116 116 void JSGlobalObjectInspectorController::globalObjectDestroyed() 117 117 { 118 disconnectAllFrontends();118 ASSERT(!m_frontendRouter->hasFrontends()); 119 119 120 120 m_injectedScriptManager->disconnect(); … … 132 132 if (!connectedFirstFrontend) 133 133 return; 134 135 // Keep the JSGlobalObject and VM alive while we are debugging it. 136 m_strongVM = &m_globalObject.vm(); 137 m_strongGlobalObject.set(m_globalObject.vm(), &m_globalObject); 134 138 135 139 // FIXME: change this to notify agents which frontend has connected (by id). … … 163 167 m_augmentingClient->inspectorDisconnected(); 164 168 #endif 165 } 166 167 void JSGlobalObjectInspectorController::disconnectAllFrontends() 168 { 169 // FIXME: change this to notify agents which frontend has disconnected (by id). 170 m_agents.willDestroyFrontendAndBackend(DisconnectReason::InspectedTargetDestroyed); 171 172 m_frontendRouter->disconnectAllFrontends(); 173 174 m_isAutomaticInspection = false; 175 176 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) 177 if (m_augmentingClient) 178 m_augmentingClient->inspectorDisconnected(); 179 #endif 169 170 // Remove our JSGlobalObject and VM references, we are done debugging it. 171 m_strongGlobalObject.clear(); 172 m_strongVM = nullptr; 180 173 } 181 174 … … 316 309 317 310 } // namespace Inspector 318 -
trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.h
r204479 r205033 43 43 class ExecState; 44 44 class JSGlobalObject; 45 class JSValue;46 45 } 47 46 … … 54 53 class InspectorConsoleAgent; 55 54 class InspectorDebuggerAgent; 56 class InspectorHeapAgent;57 55 class InspectorScriptProfilerAgent; 58 56 class JSGlobalObjectConsoleClient; … … 73 71 void connectFrontend(FrontendChannel*, bool isAutomaticInspection); 74 72 void disconnectFrontend(FrontendChannel*); 75 void disconnectAllFrontends();76 73 77 74 void dispatchMessageFromFrontend(const String&); … … 122 119 Ref<BackendDispatcher> m_backendDispatcher; 123 120 121 // Used to keep the JSGlobalObject and VM alive while we are debugging it. 122 JSC::Strong<JSC::JSGlobalObject> m_strongGlobalObject; 123 RefPtr<JSC::VM> m_strongVM; 124 124 125 bool m_includeNativeCallStackWithExceptions { true }; 125 126 bool m_isAutomaticInspection { false };
Note:
See TracChangeset
for help on using the changeset viewer.