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

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

Issue 2726593002: Use mayNotBeMainThread() for wrapper optimization (Closed)
Patch Set: Use V8TestingScope 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
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..42cc28e39e6d35283cca55684adbe7f8abb3752e 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::s_numberOfNonMainWorldsInMainThread = 0;
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())
+ s_numberOfNonMainWorldsInMainThread++;
}
DOMWrapperWorld& DOMWrapperWorld::mainWorld() {
@@ -167,6 +169,9 @@ DOMWrapperWorld::~DOMWrapperWorld() {
dispose();
+ if (isMainThread())
+ s_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();
}
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.h ('k') | third_party/WebKit/Source/bindings/core/v8/ToV8.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698