|
Change RefPtr<DOMWrapperWorld> that causes reference cycles to DOMWrapperWorld*
Currently a lot of V8-proxy objects hold RefPtr<DOMWrapperWorld>s, but these RefPtrs can cause reference cycles. For example, V8MutationCallback holds RefPtr<DOMWrapperWorld> like this:
class V8MutationCallback {
RefPtr<DOMWrapperWorld> m_world;
};
This causes the following cycle: V8MutationCallback --(RefPtr)--> DOMWrapperWorld --(OwnPtr)--> DOMDataStore --(UnsafePersistent)--> some wrapper --> V8MutationCallback's wrapper --(RefPtr)--> V8MutationCallback.
Previously these cycles were not a problem, because only the main thread had DOMWrapperWorld and it was OK to leak memory when shutting down the main thread. However, now that we support DOMWrapperWorlds for worker threads, it's not OK to leak memory when shutting down the worker threads. Thus this CL fixes the cycles.
From the perspective of the ownership of DOMWrapperWorlds, we just need to use RefPtr<DOMWrapperWorld> in V8WindowShell, WorkerScriptController and ScriptPreprocessor. Other places should use DOMWrapperWorld*. Note that it's OK to use a raw pointer for V8MutationCallback::m_world, because DOMWrapperWorld is destroyed at the very end of the main/worker thread executions. V8MutationCallback should not outlive the DOMWrapperWorld.
BUG= 341032
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+49 lines, -49 lines) |
Patch |
 |
M |
Source/bindings/templates/callback_interface.h
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
Source/bindings/templates/callback_interface.cpp
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
Source/bindings/tests/results/V8TestCallbackInterface.h
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
Source/bindings/tests/results/V8TestCallbackInterface.cpp
|
View
|
|
8 chunks |
+8 lines, -8 lines |
0 comments
|
Download
|
 |
M |
Source/bindings/v8/DOMRequestState.h
|
View
|
|
3 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
 |
M |
Source/bindings/v8/DOMWrapperWorld.h
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
Source/bindings/v8/DOMWrapperWorld.cpp
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
Source/bindings/v8/ScriptController.h
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
Source/bindings/v8/ScriptController.cpp
|
View
|
1
|
3 chunks |
+4 lines, -4 lines |
0 comments
|
Download
|
 |
M |
Source/bindings/v8/SerializedScriptValue.cpp
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
Source/bindings/v8/V8AbstractEventListener.h
|
View
|
|
2 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
 |
M |
Source/bindings/v8/V8AbstractEventListener.cpp
|
View
|
|
4 chunks |
+4 lines, -4 lines |
0 comments
|
Download
|
 |
M |
Source/bindings/v8/V8CustomElementLifecycleCallbacks.h
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
Source/bindings/v8/V8CustomElementLifecycleCallbacks.cpp
|
View
|
|
4 chunks |
+4 lines, -4 lines |
0 comments
|
Download
|
 |
M |
Source/bindings/v8/V8MutationCallback.h
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
Source/bindings/v8/V8MutationCallback.cpp
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
Source/bindings/v8/WorkerScriptController.cpp
|
View
|
1
2
3
4
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
Source/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
Source/core/events/ErrorEvent.h
|
View
|
|
5 chunks |
+5 lines, -5 lines |
0 comments
|
Download
|
 |
M |
Source/core/events/ErrorEvent.cpp
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
Source/core/loader/FrameLoader.cpp
|
View
|
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
Source/core/workers/WorkerMessagingProxy.cpp
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
Source/web/tests/CustomEventTest.cpp
|
View
|
1
2
3
4
5
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
Total messages: 10 (0 generated)
|