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

Issue 2173353002: Simplify ElementVisibilityObserver implementation. (Closed)

Created:
4 years, 5 months ago by sof
Modified:
4 years, 4 months ago
CC:
blink-reviews, blink-reviews-dom_chromium.org, blink-reviews-html_chromium.org, chromium-reviews, dglazkov+blink, eae+blinkwatch, eric.carlson_apple.com, feature-media-reviews_chromium.org, fs, gasubic, mlamouri+watch-blink_chromium.org, rwlbuis, nessy, vcarbune.chromium
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Simplify ElementVisibilityObserver implementation. Recast ElementVisibilityObserver's VisibilityCallback in a more Blink-like manner by way of a Client interface. Thereby also addressing on-off-heap cycle, a leak source. Similarly, simplify the connection between ElementVisibilityObserver and IntersectionObserver -- have the former directly implement the IntersectionObserverCallback instead of indirectly using closure callbacks. R= BUG=627539 Committed: https://crrev.com/baf0ff22e47eb51e6cd4b0764d771151f7e0500b Cr-Commit-Position: refs/heads/master@{#407450}

Patch Set 1 #

Patch Set 2 : add reqd CORE_EXPORT #

Patch Set 3 : simplify finalization + sync class comment #

Total comments: 2

Patch Set 4 : switch to IntersectionObserverCallback #

Patch Set 5 : adjust visibility #

Unified diffs Side-by-side diffs Delta from patch set Stats (+78 lines, -44 lines) Patch
M third_party/WebKit/Source/core/dom/ElementVisibilityObserver.h View 1 2 3 4 1 chunk +29 lines, -22 lines 0 comments Download
M third_party/WebKit/Source/core/dom/ElementVisibilityObserver.cpp View 1 2 3 2 chunks +39 lines, -14 lines 0 comments Download
M third_party/WebKit/Source/core/dom/IntersectionObserver.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLMediaElement.h View 1 2 3 3 chunks +5 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLMediaElement.cpp View 1 3 chunks +4 lines, -6 lines 0 comments Download

Messages

Total messages: 48 (25 generated)
sof
please take a look.
4 years, 5 months ago (2016-07-24 19:00:43 UTC) #11
haraken
LGTM
4 years, 5 months ago (2016-07-24 22:20:46 UTC) #15
Zhiqiang Zhang (Slow)
LGTM. However I tried your patch locally, the flaky leak still exists if ElementVisibilityObserver.stop() is ...
4 years, 5 months ago (2016-07-25 03:28:33 UTC) #16
sof
https://codereview.chromium.org/2173353002/diff/40001/third_party/WebKit/Source/core/dom/ElementVisibilityObserver.cpp File third_party/WebKit/Source/core/dom/ElementVisibilityObserver.cpp (left): https://codereview.chromium.org/2173353002/diff/40001/third_party/WebKit/Source/core/dom/ElementVisibilityObserver.cpp#oldcode26 third_party/WebKit/Source/core/dom/ElementVisibilityObserver.cpp:26: WTF::bind(&ElementVisibilityObserver::onVisibilityChanged, wrapWeakPersistent(this))); I'd prefer not using a WeakPersistent<> here ...
4 years, 5 months ago (2016-07-25 05:16:26 UTC) #17
sof
https://codereview.chromium.org/2173353002/diff/40001/third_party/WebKit/Source/core/dom/ElementVisibilityObserver.cpp File third_party/WebKit/Source/core/dom/ElementVisibilityObserver.cpp (left): https://codereview.chromium.org/2173353002/diff/40001/third_party/WebKit/Source/core/dom/ElementVisibilityObserver.cpp#oldcode26 third_party/WebKit/Source/core/dom/ElementVisibilityObserver.cpp:26: WTF::bind(&ElementVisibilityObserver::onVisibilityChanged, wrapWeakPersistent(this))); On 2016/07/25 05:16:26, sof wrote: > I'd ...
4 years, 5 months ago (2016-07-25 08:16:33 UTC) #22
haraken
LGTM
4 years, 5 months ago (2016-07-25 08:17:14 UTC) #23
sof
On 2016/07/25 03:28:33, Zhiqiang Zhang (slow or OOO) wrote: > LGTM. > > However I ...
4 years, 5 months ago (2016-07-25 08:20:11 UTC) #24
Zhiqiang Zhang (Slow)
On 2016/07/25 08:20:11, sof wrote: > On 2016/07/25 03:28:33, Zhiqiang Zhang (slow or OOO) wrote: ...
4 years, 5 months ago (2016-07-25 08:52:40 UTC) #25
Zhiqiang Zhang (Slow)
On 2016/07/25 08:52:40, Zhiqiang Zhang (slow or OOO) wrote: > On 2016/07/25 08:20:11, sof wrote: ...
4 years, 5 months ago (2016-07-25 09:02:24 UTC) #26
mlamouri (slow - plz ping)
I find this change a bit unfortunate. It's easier for developers to use callbacks than ...
4 years, 5 months ago (2016-07-25 10:43:02 UTC) #30
sof
On 2016/07/25 10:43:02, Mounir Lamouri wrote: > I find this change a bit unfortunate. It's ...
4 years, 5 months ago (2016-07-25 10:52:36 UTC) #31
sof
On 2016/07/25 09:02:24, Zhiqiang Zhang (slow or OOO) wrote: > On 2016/07/25 08:52:40, Zhiqiang Zhang ...
4 years, 5 months ago (2016-07-25 11:31:31 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2173353002/80001
4 years, 5 months ago (2016-07-25 11:42:13 UTC) #36
commit-bot: I haz the power
Committed patchset #5 (id:80001)
4 years, 5 months ago (2016-07-25 11:45:16 UTC) #38
commit-bot: I haz the power
Patchset 5 (id:??) landed as https://crrev.com/baf0ff22e47eb51e6cd4b0764d771151f7e0500b Cr-Commit-Position: refs/heads/master@{#407450}
4 years, 5 months ago (2016-07-25 11:46:59 UTC) #40
mlamouri (slow - plz ping)
On 2016/07/25 at 10:52:36, sigbjornf wrote: > On 2016/07/25 10:43:02, Mounir Lamouri wrote: > > ...
4 years, 5 months ago (2016-07-25 15:49:05 UTC) #41
haraken
On 2016/07/25 15:49:05, Mounir Lamouri wrote: > On 2016/07/25 at 10:52:36, sigbjornf wrote: > > ...
4 years, 4 months ago (2016-07-29 11:21:47 UTC) #42
sof
On 2016/07/29 11:21:47, haraken wrote: > On 2016/07/25 15:49:05, Mounir Lamouri wrote: > > On ...
4 years, 4 months ago (2016-07-29 11:32:39 UTC) #43
mlamouri (slow - plz ping)
On 2016/07/29 at 11:32:39, sigbjornf wrote: > On 2016/07/29 11:21:47, haraken wrote: > > On ...
4 years, 4 months ago (2016-07-29 14:05:23 UTC) #44
haraken
On 2016/07/29 14:05:23, Mounir Lamouri wrote: > On 2016/07/29 at 11:32:39, sigbjornf wrote: > > ...
4 years, 4 months ago (2016-07-29 14:09:18 UTC) #45
mlamouri (slow - plz ping)
On 2016/07/29 at 14:09:18, haraken wrote: > On 2016/07/29 14:05:23, Mounir Lamouri wrote: > > ...
4 years, 4 months ago (2016-08-02 13:40:50 UTC) #46
sof
On 2016/08/02 13:40:50, Mounir Lamouri wrote: > On 2016/07/29 at 14:09:18, haraken wrote: > > ...
4 years, 4 months ago (2016-08-02 15:28:02 UTC) #47
esprehn
4 years, 4 months ago (2016-08-05 16:46:13 UTC) #48
Message was sent while issue was closed.
Hmm, I think we should revert this. This was done very intentionally because the
API ergonomics are supposed to use callbacks and model JS.

ex.

addEventListener("foo", this.foo.bind(this))

historically in blink you'd need to write a CppEventHandler which is super
verbose and painful. Instead we're trying to modernize these interfaces as wee
use them from C++ so that they can be much closer to this.

addEventListener(EvenTypeNames::foo, bind(this, foo))

and so on. IntersectionObserver was done this way for that reason. It's fine if
you want to just vend an IntersectionObserverCallback to share the code paths,
but we need to preserve the Callback like interface.

The hope is to do this all over the API, ex. instead of having a delegate
interface for cc/ we're using base::Callbacks there too.

https://cs.chromium.org/chromium/src/cc/trees/proxy_main.cc?q=ThreadProxy&sq=...

and I hope we can generalize this to invert a bunch of responsibity and reduce
the boilerplate that's hurting us. :)

Powered by Google App Engine
This is Rietveld 408576698