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

Unified Diff: Source/bindings/v8/DOMDataStore.h

Issue 26792002: Reland: Reland: Implement new Blink IDL attribute [SetReference] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: codegen impl Created 7 years, 2 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: Source/bindings/v8/DOMDataStore.h
diff --git a/Source/bindings/v8/DOMDataStore.h b/Source/bindings/v8/DOMDataStore.h
index 78bc836647fc2e29ed58c6cbb76b20fbbd4ffdbb..2fc5d4f8851227d04a4d3718d8e93e25ec3e297b 100644
--- a/Source/bindings/v8/DOMDataStore.h
+++ b/Source/bindings/v8/DOMDataStore.h
@@ -101,6 +101,20 @@ public:
}
template<typename V8T, typename T>
+ static UnsafePersistent<v8::Object> getWrapperPersistent(T* object, v8::Isolate* isolate)
+ {
+ if (ScriptWrappable::wrapperCanBeStoredInObject(object) && !canExistInWorker(object)) {
+ if (LIKELY(!DOMWrapperWorld::isolatedWorldsExist())) {
+ UnsafePersistent<v8::Object> unsafePersistent = ScriptWrappable::getUnsafeWrapperFromObject(object);
+ // Security: always guard against malicious tampering.
+ RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(unsafePersistent.isEmpty() || unsafePersistent.value()->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex) == V8T::toInternalPointer(object));
+ return unsafePersistent;
+ }
+ }
+ return current(isolate)->template getPersistent<V8T>(object, isolate);
+ }
+
+ template<typename V8T, typename T>
static void setWrapper(T* object, v8::Handle<v8::Object> wrapper, v8::Isolate* isolate, const WrapperConfiguration& configuration)
{
if (ScriptWrappable::wrapperCanBeStoredInObject(object) && !canExistInWorker(object)) {
@@ -127,6 +141,14 @@ public:
}
template<typename V8T, typename T>
+ inline UnsafePersistent<v8::Object> getPersistent(T* object, v8::Isolate* isolate)
+ {
+ if (ScriptWrappable::wrapperCanBeStoredInObject(object) && m_type == MainWorld)
+ return ScriptWrappable::getUnsafeWrapperFromObject(object);
+ return m_wrapperMap.get(V8T::toInternalPointer(object));
+ }
+
+ template<typename V8T, typename T>
inline bool setReturnValueFrom(v8::ReturnValue<v8::Value> returnValue, T* object)
{
if (ScriptWrappable::wrapperCanBeStoredInObject(object) && m_type == MainWorld)

Powered by Google App Engine
This is Rietveld 408576698