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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp

Issue 2747163002: Bindings: Manage multiple DOMWrapperWorlds for worklets (2) (Closed)
Patch Set: address review comments & may fix use-after-free bug in the test Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorldTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
index d9d92bc33daabb6ea1bc86a20eb8bcd5a5367da3..3c1a450b6e518ba721d5f1351a8efde525b0a31e 100644
--- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
@@ -175,18 +175,10 @@ static void accumulateArrayBuffersForAllWorlds(
v8::Isolate* isolate,
DOMArrayBuffer* object,
Vector<v8::Local<v8::ArrayBuffer>, 4>& buffers) {
- if (isMainThread()) {
- Vector<RefPtr<DOMWrapperWorld>> worlds;
- DOMWrapperWorld::allWorldsInMainThread(worlds);
- for (size_t i = 0; i < worlds.size(); i++) {
- v8::Local<v8::Object> wrapper =
- worlds[i]->domDataStore().get(object, isolate);
- if (!wrapper.IsEmpty())
- buffers.push_back(v8::Local<v8::ArrayBuffer>::Cast(wrapper));
- }
- } else {
- v8::Local<v8::Object> wrapper =
- DOMWrapperWorld::current(isolate).domDataStore().get(object, isolate);
+ Vector<RefPtr<DOMWrapperWorld>> worlds;
+ DOMWrapperWorld::allWorldsInCurrentThread(worlds);
+ for (const auto& world : worlds) {
+ v8::Local<v8::Object> wrapper = world->domDataStore().get(object, isolate);
if (!wrapper.IsEmpty())
buffers.push_back(v8::Local<v8::ArrayBuffer>::Cast(wrapper));
}
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorldTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698