Commit b5839a5a authored by Vladimir Levin's avatar Vladimir Levin Committed by Commit Bot

[DL] Add lockedElement attribute to DisplayLockContext.

The locked element attribute is useful on the context since it creates
an easy access point to add elements into.

R=chrishtr@chromium.org

Bug: https://github.com/chrishtr/display-locking/issues/30
Change-Id: I726a1db72373bdde261a808b38ccb17424a21348
Reviewed-on: https://chromium-review.googlesource.com/c/1336507Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Commit-Queue: vmpstr <vmpstr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608792}
parent 082717b5
...@@ -164,6 +164,10 @@ DisplayLockSuspendedHandle* DisplayLockContext::suspend() { ...@@ -164,6 +164,10 @@ DisplayLockSuspendedHandle* DisplayLockContext::suspend() {
return new DisplayLockSuspendedHandle(this); return new DisplayLockSuspendedHandle(this);
} }
Element* DisplayLockContext::lockedElement() const {
return element_;
}
void DisplayLockContext::ProcessQueue() { void DisplayLockContext::ProcessQueue() {
SCOPED_LOGGER(__PRETTY_FUNCTION__); SCOPED_LOGGER(__PRETTY_FUNCTION__);
// It's important to clear this before running the tasks, since the tasks can // It's important to clear this before running the tasks, since the tasks can
......
...@@ -80,6 +80,7 @@ class CORE_EXPORT DisplayLockContext final ...@@ -80,6 +80,7 @@ class CORE_EXPORT DisplayLockContext final
// JavaScript interface implementation. // JavaScript interface implementation.
void schedule(V8DisplayLockCallback*); void schedule(V8DisplayLockCallback*);
DisplayLockSuspendedHandle* suspend(); DisplayLockSuspendedHandle* suspend();
Element* lockedElement() const;
// Lifecycle observation / state functions. // Lifecycle observation / state functions.
bool ShouldLayout() const; bool ShouldLayout() const;
......
...@@ -15,4 +15,7 @@ interface DisplayLockContext { ...@@ -15,4 +15,7 @@ interface DisplayLockContext {
// calls to suspend are allowed: in order to resume the context, resume() must // calls to suspend are allowed: in order to resume the context, resume() must
// be called on each of the returned DisplayLockSuspendedHandles. // be called on each of the returned DisplayLockSuspendedHandles.
DisplayLockSuspendedHandle suspend(); DisplayLockSuspendedHandle suspend();
// Represents the element on which this locked has been acquired.
[SameObject, Affects=Nothing] readonly attribute Element lockedElement;
}; };
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