Commit 91877a50 authored by sigbjornf@opera.com's avatar sigbjornf@opera.com

Oilpan: move Location to the oilpan heap.

Also add missing transition type handling for [PutForwards] over
garbage collected interface types.

R=haraken@chromium.org
BUG=340522

Review URL: https://codereview.chromium.org/196133029

git-svn-id: svn://svn.chromium.org/blink/trunk@169538 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 8e272941
...@@ -123,6 +123,7 @@ def generate_attribute(interface, attribute): ...@@ -123,6 +123,7 @@ def generate_attribute(interface, attribute):
'per_context_enabled_function': v8_utilities.per_context_enabled_function_name(attribute), # [PerContextEnabled] 'per_context_enabled_function': v8_utilities.per_context_enabled_function_name(attribute), # [PerContextEnabled]
'property_attributes': property_attributes(attribute), 'property_attributes': property_attributes(attribute),
'put_forwards': 'PutForwards' in extended_attributes, 'put_forwards': 'PutForwards' in extended_attributes,
'ref_ptr': 'RefPtrWillBeRawPtr' if idl_type.is_will_be_garbage_collected else 'RefPtr',
'reflect_empty': extended_attributes.get('ReflectEmpty'), 'reflect_empty': extended_attributes.get('ReflectEmpty'),
'reflect_invalid': extended_attributes.get('ReflectInvalid', ''), 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''),
'reflect_missing': extended_attributes.get('ReflectMissing'), 'reflect_missing': extended_attributes.get('ReflectMissing'),
......
...@@ -227,7 +227,7 @@ v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info ...@@ -227,7 +227,7 @@ v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info
{# impl #} {# impl #}
{% if attribute.put_forwards %} {% if attribute.put_forwards %}
{{cpp_class}}* proxyImpl = {{v8_class}}::toNative(info.Holder()); {{cpp_class}}* proxyImpl = {{v8_class}}::toNative(info.Holder());
RefPtr<{{attribute.idl_type}}> impl = WTF::getPtr(proxyImpl->{{attribute.name}}()); {{attribute.ref_ptr}}<{{attribute.idl_type}}> impl = WTF::getPtr(proxyImpl->{{attribute.name}}());
if (!impl) if (!impl)
return; return;
{% elif not attribute.is_static %} {% elif not attribute.is_static %}
......
...@@ -181,6 +181,7 @@ interface TestObjectPython { ...@@ -181,6 +181,7 @@ interface TestObjectPython {
[PutForwards=hrefThrows] readonly attribute TestNode locationWithException; [PutForwards=hrefThrows] readonly attribute TestNode locationWithException;
[PutForwards=hrefCallWith] readonly attribute TestNode locationWithCallWith; [PutForwards=hrefCallWith] readonly attribute TestNode locationWithCallWith;
[PerWorldBindings, PutForwards=href] readonly attribute TestNode locationWithPerWorldBindings; [PerWorldBindings, PutForwards=href] readonly attribute TestNode locationWithPerWorldBindings;
[PutForwards=attr1] readonly attribute TestInterfaceWillBeGarbageCollected locationWillBeGarbageCollected;
[RaisesException] attribute long raisesExceptionLongAttribute; [RaisesException] attribute long raisesExceptionLongAttribute;
[RaisesException=Getter] attribute long raisesExceptionGetterLongAttribute; [RaisesException=Getter] attribute long raisesExceptionGetterLongAttribute;
[RaisesException=Setter] attribute long setterRaisesExceptionLongAttribute; [RaisesException=Setter] attribute long setterRaisesExceptionLongAttribute;
......
...@@ -2676,6 +2676,43 @@ static void locationWithPerWorldBindingsAttributeSetterCallbackForMainWorld(v8:: ...@@ -2676,6 +2676,43 @@ static void locationWithPerWorldBindingsAttributeSetterCallbackForMainWorld(v8::
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
} }
static void locationWillBeGarbageCollectedAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
TestObjectPython* impl = V8TestObjectPython::toNative(info.Holder());
RefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> result(impl->locationWillBeGarbageCollected());
if (result && DOMDataStore::setReturnValueFromWrapper<V8TestInterfaceWillBeGarbageCollected>(info.GetReturnValue(), result.get()))
return;
v8::Handle<v8::Value> wrapper = toV8(result.get(), info.Holder(), info.GetIsolate());
if (!wrapper.IsEmpty()) {
V8HiddenValue::setHiddenValue(info.GetIsolate(), info.Holder(), v8AtomicString(info.GetIsolate(), "locationWillBeGarbageCollected"), wrapper);
v8SetReturnValue(info, wrapper);
}
}
static void locationWillBeGarbageCollectedAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
TestObjectPythonV8Internal::locationWillBeGarbageCollectedAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
static void locationWillBeGarbageCollectedAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
TestObjectPython* proxyImpl = V8TestObjectPython::toNative(info.Holder());
RefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl = WTF::getPtr(proxyImpl->locationWillBeGarbageCollected());
if (!impl)
return;
V8TRYCATCH_VOID(TestInterfaceWillBeGarbageCollected*, cppValue, V8TestInterfaceWillBeGarbageCollected::toNativeWithTypeCheck(info.GetIsolate(), jsValue));
impl->setAttr1(WTF::getPtr(cppValue));
}
static void locationWillBeGarbageCollectedAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
TestObjectPythonV8Internal::locationWillBeGarbageCollectedAttributeSetter(jsValue, info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
static void raisesExceptionLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) static void raisesExceptionLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{ {
TestObjectPython* impl = V8TestObjectPython::toNative(info.Holder()); TestObjectPython* impl = V8TestObjectPython::toNative(info.Holder());
...@@ -7377,6 +7414,7 @@ static const V8DOMConfiguration::AttributeConfiguration V8TestObjectPythonAttrib ...@@ -7377,6 +7414,7 @@ static const V8DOMConfiguration::AttributeConfiguration V8TestObjectPythonAttrib
{"locationWithException", TestObjectPythonV8Internal::locationWithExceptionAttributeGetterCallback, TestObjectPythonV8Internal::locationWithExceptionAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, {"locationWithException", TestObjectPythonV8Internal::locationWithExceptionAttributeGetterCallback, TestObjectPythonV8Internal::locationWithExceptionAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
{"locationWithCallWith", TestObjectPythonV8Internal::locationWithCallWithAttributeGetterCallback, TestObjectPythonV8Internal::locationWithCallWithAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, {"locationWithCallWith", TestObjectPythonV8Internal::locationWithCallWithAttributeGetterCallback, TestObjectPythonV8Internal::locationWithCallWithAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
{"locationWithPerWorldBindings", TestObjectPythonV8Internal::locationWithPerWorldBindingsAttributeGetterCallback, TestObjectPythonV8Internal::locationWithPerWorldBindingsAttributeSetterCallback, TestObjectPythonV8Internal::locationWithPerWorldBindingsAttributeGetterCallbackForMainWorld, TestObjectPythonV8Internal::locationWithPerWorldBindingsAttributeSetterCallbackForMainWorld, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, {"locationWithPerWorldBindings", TestObjectPythonV8Internal::locationWithPerWorldBindingsAttributeGetterCallback, TestObjectPythonV8Internal::locationWithPerWorldBindingsAttributeSetterCallback, TestObjectPythonV8Internal::locationWithPerWorldBindingsAttributeGetterCallbackForMainWorld, TestObjectPythonV8Internal::locationWithPerWorldBindingsAttributeSetterCallbackForMainWorld, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
{"locationWillBeGarbageCollected", TestObjectPythonV8Internal::locationWillBeGarbageCollectedAttributeGetterCallback, TestObjectPythonV8Internal::locationWillBeGarbageCollectedAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
{"raisesExceptionLongAttribute", TestObjectPythonV8Internal::raisesExceptionLongAttributeAttributeGetterCallback, TestObjectPythonV8Internal::raisesExceptionLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, {"raisesExceptionLongAttribute", TestObjectPythonV8Internal::raisesExceptionLongAttributeAttributeGetterCallback, TestObjectPythonV8Internal::raisesExceptionLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
{"raisesExceptionGetterLongAttribute", TestObjectPythonV8Internal::raisesExceptionGetterLongAttributeAttributeGetterCallback, TestObjectPythonV8Internal::raisesExceptionGetterLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, {"raisesExceptionGetterLongAttribute", TestObjectPythonV8Internal::raisesExceptionGetterLongAttributeAttributeGetterCallback, TestObjectPythonV8Internal::raisesExceptionGetterLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
{"setterRaisesExceptionLongAttribute", TestObjectPythonV8Internal::setterRaisesExceptionLongAttributeAttributeGetterCallback, TestObjectPythonV8Internal::setterRaisesExceptionLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, {"setterRaisesExceptionLongAttribute", TestObjectPythonV8Internal::setterRaisesExceptionLongAttributeAttributeGetterCallback, TestObjectPythonV8Internal::setterRaisesExceptionLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
......
...@@ -353,7 +353,7 @@ enum PageshowEventPersistence { ...@@ -353,7 +353,7 @@ enum PageshowEventPersistence {
mutable RefPtr<BarProp> m_toolbar; mutable RefPtr<BarProp> m_toolbar;
mutable RefPtr<Console> m_console; mutable RefPtr<Console> m_console;
mutable RefPtrWillBePersistent<Navigator> m_navigator; mutable RefPtrWillBePersistent<Navigator> m_navigator;
mutable RefPtr<Location> m_location; mutable RefPtrWillBePersistent<Location> m_location;
mutable RefPtr<StyleMedia> m_media; mutable RefPtr<StyleMedia> m_media;
String m_status; String m_status;
......
...@@ -43,9 +43,12 @@ class ExceptionState; ...@@ -43,9 +43,12 @@ class ExceptionState;
class LocalFrame; class LocalFrame;
class KURL; class KURL;
class Location FINAL : public ScriptWrappable, public RefCounted<Location>, public DOMWindowProperty { class Location FINAL : public RefCountedWillBeGarbageCollectedFinalized<Location>, public ScriptWrappable, public DOMWindowProperty {
public: public:
static PassRefPtr<Location> create(LocalFrame* frame) { return adoptRef(new Location(frame)); } static PassRefPtrWillBeRawPtr<Location> create(LocalFrame* frame)
{
return adoptRefWillBeNoop(new Location(frame));
}
void setHref(DOMWindow* callingWindow, DOMWindow* enteredWindow, const String&); void setHref(DOMWindow* callingWindow, DOMWindow* enteredWindow, const String&);
String href() const; String href() const;
...@@ -72,6 +75,8 @@ public: ...@@ -72,6 +75,8 @@ public:
PassRefPtr<DOMStringList> ancestorOrigins() const; PassRefPtr<DOMStringList> ancestorOrigins() const;
void trace(Visitor*) { }
private: private:
explicit Location(LocalFrame*); explicit Location(LocalFrame*);
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
[ [
CheckSecurity=Frame, CheckSecurity=Frame,
WillBeGarbageCollected,
] interface Location { ] interface Location {
// |assign|, |replace|, and *writing* |href| do not require a security // |assign|, |replace|, and *writing* |href| do not require a security
// check, as they *change* the page, and thus these do not change any // check, as they *change* the page, and thus these do not change any
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment