Bug 1118978 part 3. Add support for DependsOn=DeviceState. r=peterv

This commit is contained in:
Boris Zbarsky 2015-01-15 17:39:01 -05:00
Родитель 01f8cea46f
Коммит 0221e36996
6 изменённых файлов: 26 добавлений и 6 удалений

Просмотреть файл

@ -8177,7 +8177,12 @@ class CGMemberJITInfo(CGThing):
dependsOn = self.member.dependsOn
assert affects in IDLInterfaceMember.AffectsValues
assert dependsOn in IDLInterfaceMember.DependsOnValues
return affects == "Nothing" and dependsOn != "Everything"
# Things that are DependsOn=DeviceState are not movable, because we
# don't want them coalesced with each other or loop-hoisted, since
# their return value can change even if nothing is going on from our
# point of view.
return (affects == "Nothing" and
(dependsOn != "Everything" and dependsOn != "DeviceState"))
def aliasSet(self):
"""Returns the alias set to store in the jitinfo. This may not be the
@ -8189,7 +8194,7 @@ class CGMemberJITInfo(CGThing):
dependsOn = self.member.dependsOn
assert dependsOn in IDLInterfaceMember.DependsOnValues
if dependsOn == "Nothing":
if dependsOn == "Nothing" or dependsOn == "DeviceState":
assert self.member.affects == "Nothing"
return "AliasNone"

Просмотреть файл

@ -3044,7 +3044,7 @@ class IDLInterfaceMember(IDLObjectWithIdentifier):
)
AffectsValues = ("Nothing", "Everything")
DependsOnValues = ("Nothing", "DOMState", "Everything")
DependsOnValues = ("Nothing", "DOMState", "DeviceState", "Everything")
def __init__(self, location, identifier, tag):
IDLObjectWithIdentifier.__init__(self, location, None, identifier)
@ -3425,9 +3425,10 @@ class IDLAttribute(IDLInterfaceMember):
if not attr.hasValue():
raise WebIDLError("[DependsOn] takes an identifier",
[attr.location])
if attr.value() == "Nothing" and not self.readonly:
raise WebIDLError("[DependsOn=Nothing] only allowed on "
"readonly attributes",
if (attr.value() != "Everything" and attr.value() != "DOMState" and
not self.readonly):
raise WebIDLError("[DependsOn=%s] only allowed on "
"readonly attributes" % attr.value(),
[attr.location, self.location])
self._setDependsOn(attr.value())
elif (identifier == "Pref" or

Просмотреть файл

@ -187,9 +187,11 @@ public:
int8_t DomDependentByte();
int8_t SetDomDependentByte(int8_t);
int8_t ConstantByte();
int8_t DeviceStateDependentByte();
int8_t ReturnByteSideEffectFree();
int8_t ReturnDOMDependentByte();
int8_t ReturnConstantByte();
int8_t ReturnDeviceStateDependentByte();
void UnsafePrerenderMethod();
int32_t UnsafePrerenderWritable();

Просмотреть файл

@ -163,12 +163,16 @@ interface TestInterface {
attribute byte domDependentByte;
[Affects=Nothing, DependsOn=Nothing]
readonly attribute byte constantByte;
[DependsOn=DeviceState, Affects=Nothing]
readonly attribute byte deviceStateDependentByte;
[Affects=Nothing]
byte returnByteSideEffectFree();
[Affects=Nothing, DependsOn=DOMState]
byte returnDOMDependentByte();
[Affects=Nothing, DependsOn=Nothing]
byte returnConstantByte();
[DependsOn=DeviceState, Affects=Nothing]
byte returnDeviceStateDependentByte();
[UnsafeInPrerendering]
void unsafePrerenderMethod();

Просмотреть файл

@ -42,12 +42,16 @@ interface TestExampleInterface {
attribute byte domDependentByte;
[Affects=Nothing, DependsOn=Nothing]
readonly attribute byte constantByte;
[DependsOn=DeviceState, Affects=Nothing]
readonly attribute byte deviceStateDependentByte;
[Affects=Nothing]
byte returnByteSideEffectFree();
[Affects=Nothing, DependsOn=DOMState]
byte returnDOMDependentByte();
[Affects=Nothing, DependsOn=Nothing]
byte returnConstantByte();
[DependsOn=DeviceState, Affects=Nothing]
byte returnDeviceStateDependentByte();
readonly attribute short readonlyShort;
attribute short writableShort;

Просмотреть файл

@ -51,12 +51,16 @@ interface TestJSImplInterface {
attribute byte domDependentByte;
[Affects=Nothing, DependsOn=Nothing]
readonly attribute byte constantByte;
[DependsOn=DeviceState, Affects=Nothing]
readonly attribute byte deviceStateDependentByte;
[Affects=Nothing]
byte returnByteSideEffectFree();
[Affects=Nothing, DependsOn=DOMState]
byte returnDOMDependentByte();
[Affects=Nothing, DependsOn=Nothing]
byte returnConstantByte();
[DependsOn=DeviceState, Affects=Nothing]
byte returnDeviceStateDependentByte();
readonly attribute short readonlyShort;
attribute short writableShort;