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

Side by Side Diff: Source/bindings/tests/results/V8TestObject.cpp

Issue 135843008: Remove V8HiddenPropertyName (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "bindings/v8/BindingSecurity.h" 49 #include "bindings/v8/BindingSecurity.h"
50 #include "bindings/v8/Dictionary.h" 50 #include "bindings/v8/Dictionary.h"
51 #include "bindings/v8/ExceptionState.h" 51 #include "bindings/v8/ExceptionState.h"
52 #include "bindings/v8/ScriptState.h" 52 #include "bindings/v8/ScriptState.h"
53 #include "bindings/v8/ScriptValue.h" 53 #include "bindings/v8/ScriptValue.h"
54 #include "bindings/v8/SerializedScriptValue.h" 54 #include "bindings/v8/SerializedScriptValue.h"
55 #include "bindings/v8/V8AbstractEventListener.h" 55 #include "bindings/v8/V8AbstractEventListener.h"
56 #include "bindings/v8/V8DOMActivityLogger.h" 56 #include "bindings/v8/V8DOMActivityLogger.h"
57 #include "bindings/v8/V8DOMConfiguration.h" 57 #include "bindings/v8/V8DOMConfiguration.h"
58 #include "bindings/v8/V8EventListenerList.h" 58 #include "bindings/v8/V8EventListenerList.h"
59 #include "bindings/v8/V8HiddenPropertyName.h"
60 #include "bindings/v8/V8ObjectConstructor.h" 59 #include "bindings/v8/V8ObjectConstructor.h"
61 #include "bindings/v8/custom/V8Float32ArrayCustom.h" 60 #include "bindings/v8/custom/V8Float32ArrayCustom.h"
62 #include "core/css/MediaQueryListListener.h" 61 #include "core/css/MediaQueryListListener.h"
63 #include "core/dom/ContextFeatures.h" 62 #include "core/dom/ContextFeatures.h"
64 #include "core/dom/Document.h" 63 #include "core/dom/Document.h"
65 #include "core/dom/custom/CustomElementCallbackDispatcher.h" 64 #include "core/dom/custom/CustomElementCallbackDispatcher.h"
66 #include "core/frame/DOMWindow.h" 65 #include "core/frame/DOMWindow.h"
67 #include "core/frame/UseCounter.h" 66 #include "core/frame/UseCounter.h"
68 #include "platform/TraceEvent.h" 67 #include "platform/TraceEvent.h"
69 #include "wtf/GetPtr.h" 68 #include "wtf/GetPtr.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 123 }
125 124
126 static void readOnlyTestObjectAttrAttributeGetter(const v8::PropertyCallbackInfo <v8::Value>& info) 125 static void readOnlyTestObjectAttrAttributeGetter(const v8::PropertyCallbackInfo <v8::Value>& info)
127 { 126 {
128 TestObj* imp = V8TestObject::toNative(info.Holder()); 127 TestObj* imp = V8TestObject::toNative(info.Holder());
129 RefPtr<TestObj> result = imp->readOnlyTestObjectAttr(); 128 RefPtr<TestObj> result = imp->readOnlyTestObjectAttr();
130 if (result && DOMDataStore::setReturnValueFromWrapper<V8TestObject>(info.Get ReturnValue(), result.get())) 129 if (result && DOMDataStore::setReturnValueFromWrapper<V8TestObject>(info.Get ReturnValue(), result.get()))
131 return; 130 return;
132 v8::Handle<v8::Value> wrapper = toV8(result.get(), info.Holder(), info.GetIs olate()); 131 v8::Handle<v8::Value> wrapper = toV8(result.get(), info.Holder(), info.GetIs olate());
133 if (!wrapper.IsEmpty()) { 132 if (!wrapper.IsEmpty()) {
134 V8HiddenPropertyName::setNamedHiddenReference(info.Holder(), "readOnlyTe stObjectAttr", wrapper); 133 setHiddenValue(info.GetIsolate(), info.Holder(), "readOnlyTestObjectAttr ", wrapper);
135 v8SetReturnValue(info, wrapper); 134 v8SetReturnValue(info, wrapper);
136 } 135 }
137 } 136 }
138 137
139 static void readOnlyTestObjectAttrAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 138 static void readOnlyTestObjectAttrAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
140 { 139 {
141 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 140 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
142 TestObjV8Internal::readOnlyTestObjectAttrAttributeGetter(info); 141 TestObjV8Internal::readOnlyTestObjectAttrAttributeGetter(info);
143 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 142 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
144 } 143 }
(...skipping 2095 matching lines...) Expand 10 before | Expand all | Expand 10 after
2240 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2239 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
2241 TestObjV8Internal::cachedAttribute2AttributeGetter(info); 2240 TestObjV8Internal::cachedAttribute2AttributeGetter(info);
2242 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 2241 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
2243 } 2242 }
2244 2243
2245 static void cachedDirtyableAttributeAttributeGetter(const v8::PropertyCallbackIn fo<v8::Value>& info) 2244 static void cachedDirtyableAttributeAttributeGetter(const v8::PropertyCallbackIn fo<v8::Value>& info)
2246 { 2245 {
2247 v8::Handle<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "cac hedDirtyableAttribute"); 2246 v8::Handle<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "cac hedDirtyableAttribute");
2248 TestObj* imp = V8TestObject::toNative(info.Holder()); 2247 TestObj* imp = V8TestObject::toNative(info.Holder());
2249 if (!imp->isValueDirty()) { 2248 if (!imp->isValueDirty()) {
2250 v8::Handle<v8::Value> jsValue = info.Holder()->GetHiddenValue(propertyNa me); 2249 v8::Handle<v8::Value> jsValue = getHiddenValue(info.GetIsolate(), info.H older(), propertyName);
2251 if (!jsValue.IsEmpty()) { 2250 if (!jsValue.IsEmpty()) {
2252 v8SetReturnValue(info, jsValue); 2251 v8SetReturnValue(info, jsValue);
2253 return; 2252 return;
2254 } 2253 }
2255 } 2254 }
2256 ScriptValue jsValue = imp->cachedDirtyableAttribute(); 2255 ScriptValue jsValue = imp->cachedDirtyableAttribute();
2257 info.Holder()->SetHiddenValue(propertyName, jsValue.v8Value()); 2256 setHiddenValue(info.GetIsolate(), info.Holder(), propertyName, jsValue.v8Val ue());
2258 v8SetReturnValue(info, jsValue.v8Value()); 2257 v8SetReturnValue(info, jsValue.v8Value());
2259 } 2258 }
2260 2259
2261 static void cachedDirtyableAttributeAttributeGetterCallback(v8::Local<v8::String >, const v8::PropertyCallbackInfo<v8::Value>& info) 2260 static void cachedDirtyableAttributeAttributeGetterCallback(v8::Local<v8::String >, const v8::PropertyCallbackInfo<v8::Value>& info)
2262 { 2261 {
2263 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2262 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
2264 TestObjV8Internal::cachedDirtyableAttributeAttributeGetter(info); 2263 TestObjV8Internal::cachedDirtyableAttributeAttributeGetter(info);
2265 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 2264 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
2266 } 2265 }
2267 2266
2268 static void cachedDirtyableAttributeRaisesAttributeGetter(const v8::PropertyCall backInfo<v8::Value>& info) 2267 static void cachedDirtyableAttributeRaisesAttributeGetter(const v8::PropertyCall backInfo<v8::Value>& info)
2269 { 2268 {
2270 v8::Handle<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "cac hedDirtyableAttributeRaises"); 2269 v8::Handle<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "cac hedDirtyableAttributeRaises");
2271 TestObj* imp = V8TestObject::toNative(info.Holder()); 2270 TestObj* imp = V8TestObject::toNative(info.Holder());
2272 if (!imp->isValueDirty()) { 2271 if (!imp->isValueDirty()) {
2273 v8::Handle<v8::Value> jsValue = info.Holder()->GetHiddenValue(propertyNa me); 2272 v8::Handle<v8::Value> jsValue = getHiddenValue(info.GetIsolate(), info.H older(), propertyName);
2274 if (!jsValue.IsEmpty()) { 2273 if (!jsValue.IsEmpty()) {
2275 v8SetReturnValue(info, jsValue); 2274 v8SetReturnValue(info, jsValue);
2276 return; 2275 return;
2277 } 2276 }
2278 } 2277 }
2279 ExceptionState exceptionState(ExceptionState::GetterContext, "cachedDirtyabl eAttributeRaises", "TestObject", info.Holder(), info.GetIsolate()); 2278 ExceptionState exceptionState(ExceptionState::GetterContext, "cachedDirtyabl eAttributeRaises", "TestObject", info.Holder(), info.GetIsolate());
2280 ScriptValue jsValue = imp->cachedDirtyableAttributeRaises(exceptionState); 2279 ScriptValue jsValue = imp->cachedDirtyableAttributeRaises(exceptionState);
2281 if (UNLIKELY(exceptionState.throwIfNeeded())) 2280 if (UNLIKELY(exceptionState.throwIfNeeded()))
2282 return; 2281 return;
2283 info.Holder()->SetHiddenValue(propertyName, jsValue.v8Value()); 2282 setHiddenValue(info.GetIsolate(), info.Holder(), propertyName, jsValue.v8Val ue());
2284 v8SetReturnValue(info, jsValue.v8Value()); 2283 v8SetReturnValue(info, jsValue.v8Value());
2285 } 2284 }
2286 2285
2287 static void cachedDirtyableAttributeRaisesAttributeGetterCallback(v8::Local<v8:: String>, const v8::PropertyCallbackInfo<v8::Value>& info) 2286 static void cachedDirtyableAttributeRaisesAttributeGetterCallback(v8::Local<v8:: String>, const v8::PropertyCallbackInfo<v8::Value>& info)
2288 { 2287 {
2289 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2288 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
2290 TestObjV8Internal::cachedDirtyableAttributeRaisesAttributeGetter(info); 2289 TestObjV8Internal::cachedDirtyableAttributeRaisesAttributeGetter(info);
2291 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 2290 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
2292 } 2291 }
2293 2292
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
2717 } 2716 }
2718 2717
2719 static void perWorldReadOnlyAttributeAttributeGetter(const v8::PropertyCallbackI nfo<v8::Value>& info) 2718 static void perWorldReadOnlyAttributeAttributeGetter(const v8::PropertyCallbackI nfo<v8::Value>& info)
2720 { 2719 {
2721 TestObj* imp = V8TestObject::toNative(info.Holder()); 2720 TestObj* imp = V8TestObject::toNative(info.Holder());
2722 RefPtr<TestObj> result = imp->perWorldReadOnlyAttribute(); 2721 RefPtr<TestObj> result = imp->perWorldReadOnlyAttribute();
2723 if (result && DOMDataStore::setReturnValueFromWrapper<V8TestObject>(info.Get ReturnValue(), result.get())) 2722 if (result && DOMDataStore::setReturnValueFromWrapper<V8TestObject>(info.Get ReturnValue(), result.get()))
2724 return; 2723 return;
2725 v8::Handle<v8::Value> wrapper = toV8(result.get(), info.Holder(), info.GetIs olate()); 2724 v8::Handle<v8::Value> wrapper = toV8(result.get(), info.Holder(), info.GetIs olate());
2726 if (!wrapper.IsEmpty()) { 2725 if (!wrapper.IsEmpty()) {
2727 V8HiddenPropertyName::setNamedHiddenReference(info.Holder(), "perWorldRe adOnlyAttribute", wrapper); 2726 setHiddenValue(info.GetIsolate(), info.Holder(), "perWorldReadOnlyAttrib ute", wrapper);
2728 v8SetReturnValue(info, wrapper); 2727 v8SetReturnValue(info, wrapper);
2729 } 2728 }
2730 } 2729 }
2731 2730
2732 static void perWorldReadOnlyAttributeAttributeGetterCallback(v8::Local<v8::Strin g>, const v8::PropertyCallbackInfo<v8::Value>& info) 2731 static void perWorldReadOnlyAttributeAttributeGetterCallback(v8::Local<v8::Strin g>, const v8::PropertyCallbackInfo<v8::Value>& info)
2733 { 2732 {
2734 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2733 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
2735 TestObjV8Internal::perWorldReadOnlyAttributeAttributeGetter(info); 2734 TestObjV8Internal::perWorldReadOnlyAttributeAttributeGetter(info);
2736 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 2735 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
2737 } 2736 }
2738 2737
2739 static void perWorldReadOnlyAttributeAttributeGetterForMainWorld(const v8::Prope rtyCallbackInfo<v8::Value>& info) 2738 static void perWorldReadOnlyAttributeAttributeGetterForMainWorld(const v8::Prope rtyCallbackInfo<v8::Value>& info)
2740 { 2739 {
2741 TestObj* imp = V8TestObject::toNative(info.Holder()); 2740 TestObj* imp = V8TestObject::toNative(info.Holder());
2742 RefPtr<TestObj> result = imp->perWorldReadOnlyAttribute(); 2741 RefPtr<TestObj> result = imp->perWorldReadOnlyAttribute();
2743 if (result && DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestObje ct>(info.GetReturnValue(), result.get())) 2742 if (result && DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestObje ct>(info.GetReturnValue(), result.get()))
2744 return; 2743 return;
2745 v8::Handle<v8::Value> wrapper = toV8(result.get(), info.Holder(), info.GetIs olate()); 2744 v8::Handle<v8::Value> wrapper = toV8(result.get(), info.Holder(), info.GetIs olate());
2746 if (!wrapper.IsEmpty()) { 2745 if (!wrapper.IsEmpty()) {
2747 V8HiddenPropertyName::setNamedHiddenReference(info.Holder(), "perWorldRe adOnlyAttribute", wrapper); 2746 setHiddenValue(info.GetIsolate(), info.Holder(), "perWorldReadOnlyAttrib ute", wrapper);
2748 v8SetReturnValue(info, wrapper); 2747 v8SetReturnValue(info, wrapper);
2749 } 2748 }
2750 } 2749 }
2751 2750
2752 static void perWorldReadOnlyAttributeAttributeGetterCallbackForMainWorld(v8::Loc al<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 2751 static void perWorldReadOnlyAttributeAttributeGetterCallbackForMainWorld(v8::Loc al<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
2753 { 2752 {
2754 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2753 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
2755 TestObjV8Internal::perWorldReadOnlyAttributeAttributeGetterForMainWorld(info ); 2754 TestObjV8Internal::perWorldReadOnlyAttributeAttributeGetterForMainWorld(info );
2756 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 2755 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
2757 } 2756 }
(...skipping 3162 matching lines...) Expand 10 before | Expand all | Expand 10 after
5920 fromInternalPointer(object)->deref(); 5919 fromInternalPointer(object)->deref();
5921 } 5920 }
5922 5921
5923 template<> 5922 template<>
5924 v8::Handle<v8::Value> toV8NoInline(TestObj* impl, v8::Handle<v8::Object> creatio nContext, v8::Isolate* isolate) 5923 v8::Handle<v8::Value> toV8NoInline(TestObj* impl, v8::Handle<v8::Object> creatio nContext, v8::Isolate* isolate)
5925 { 5924 {
5926 return toV8(impl, creationContext, isolate); 5925 return toV8(impl, creationContext, isolate);
5927 } 5926 }
5928 5927
5929 } // namespace WebCore 5928 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698