| Index: third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp
|
| diff --git a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp
|
| index b01fec9de8d90057ffd32f26320064480c86195b..bca8f89e360b9637ed13b3d07b2491c3ea07ec99 100644
|
| --- a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp
|
| +++ b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp
|
| @@ -29,6 +29,7 @@
|
|
|
| #include "bindings/core/v8/DOMDataStore.h"
|
| #include "bindings/core/v8/ScriptSourceCode.h"
|
| +#include "bindings/core/v8/V8Binding.h"
|
| #include "bindings/core/v8/V8HiddenValue.h"
|
| #include "bindings/core/v8/V8ObjectConstructor.h"
|
| #include "bindings/core/v8/V8PrivateProperty.h"
|
| @@ -189,6 +190,28 @@ void V8PerIsolateData::setInterfaceTemplate(
|
| map.insert(key, v8::Eternal<v8::FunctionTemplate>(isolate(), value));
|
| }
|
|
|
| +const v8::Eternal<v8::Name>* V8PerIsolateData::findOrCreateEternalNameCache(
|
| + const void* lookupKey,
|
| + const char* const names[],
|
| + size_t count) {
|
| + auto it = m_eternalNameCache.find(lookupKey);
|
| + const Vector<v8::Eternal<v8::Name>>* vector = nullptr;
|
| + if (UNLIKELY(it == m_eternalNameCache.end())) {
|
| + v8::Isolate* isolate = this->isolate();
|
| + Vector<v8::Eternal<v8::Name>> newVector(count);
|
| + std::transform(
|
| + names, names + count, newVector.begin(), [isolate](const char* name) {
|
| + return v8::Eternal<v8::Name>(isolate, v8AtomicString(isolate, name));
|
| + });
|
| + vector = &m_eternalNameCache.set(lookupKey, std::move(newVector))
|
| + .storedValue->value;
|
| + } else {
|
| + vector = &it->value;
|
| + }
|
| + DCHECK_EQ(vector->size(), count);
|
| + return vector->data();
|
| +}
|
| +
|
| v8::Local<v8::Context> V8PerIsolateData::ensureScriptRegexpContext() {
|
| if (!m_scriptRegexpScriptState) {
|
| LEAK_SANITIZER_DISABLED_SCOPE;
|
|
|