Chromium Code Reviews| Index: third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp |
| diff --git a/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp b/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp |
| index 3d23c73d43c297bb6ea06936628761ccf5e5eb31..61ef07b0336774cd8242a2628c6db18008632811 100644 |
| --- a/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp |
| +++ b/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp |
| @@ -30,6 +30,7 @@ |
| #include "bindings/core/v8/DOMWrapperWorld.h" |
| +#include <memory> |
| #include "bindings/core/v8/DOMDataStore.h" |
| #include "bindings/core/v8/ScriptController.h" |
| #include "bindings/core/v8/V8Binding.h" |
| @@ -42,7 +43,6 @@ |
| #include "wtf/HashTraits.h" |
| #include "wtf/PtrUtil.h" |
| #include "wtf/StdLibExtras.h" |
| -#include <memory> |
| namespace blink { |
| @@ -81,7 +81,7 @@ class DOMObjectHolder : public DOMObjectHolderBase { |
| Persistent<T> m_object; |
| }; |
| -unsigned DOMWrapperWorld::isolatedWorldCount = 0; |
| +unsigned DOMWrapperWorld::numberOfNonMainWorldsInMainThread = 0; |
|
haraken
2017/03/08 09:25:24
s_numberOfNonMainWorldsInMainThread
adithyas
2017/03/08 18:20:10
Done
|
| PassRefPtr<DOMWrapperWorld> DOMWrapperWorld::create(v8::Isolate* isolate, |
| int worldId) { |
| @@ -95,6 +95,8 @@ DOMWrapperWorld::DOMWrapperWorld(v8::Isolate* isolate, int worldId) |
| if (worldId == WorkerWorldId) { |
| workerWorld() = this; |
| } |
| + if (worldId != MainWorldId && isMainThread()) |
| + numberOfNonMainWorldsInMainThread++; |
| } |
| DOMWrapperWorld& DOMWrapperWorld::mainWorld() { |
| @@ -167,6 +169,9 @@ DOMWrapperWorld::~DOMWrapperWorld() { |
| dispose(); |
| + if (isMainThread()) |
|
Yuki
2017/03/08 09:22:04
This should be okay as long as all non-main worlds
adithyas
2017/03/08 18:20:10
There's an ASSERT(!isMainWorld()) directly before
|
| + numberOfNonMainWorldsInMainThread--; |
| + |
| if (!isIsolatedWorld()) |
| return; |
| @@ -179,7 +184,6 @@ DOMWrapperWorld::~DOMWrapperWorld() { |
| ASSERT(it->value == this); |
| map.remove(it); |
| - isolatedWorldCount--; |
| } |
| void DOMWrapperWorld::dispose() { |
| @@ -210,7 +214,6 @@ PassRefPtr<DOMWrapperWorld> DOMWrapperWorld::ensureIsolatedWorld( |
| world = DOMWrapperWorld::create(isolate, worldId); |
| result.storedValue->value = world.get(); |
| - isolatedWorldCount++; |
| return world.release(); |
| } |