Skip to content

Commit

Permalink
ElementVisibilityObserver: get rid of reference cycle.
Browse files Browse the repository at this point in the history
BUG=627539
R=mlamouri@chromium.org,zqzhang@chromium.org

Review-Url: https://codereview.chromium.org/2146383002
Cr-Commit-Position: refs/heads/master@{#405619}
  • Loading branch information
szager-chromium authored and Commit bot committed Jul 14, 2016
1 parent eb0a50c commit 0adb974
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ void ElementVisibilityObserver::start()
Vector<Length>(), Vector<float>({std::numeric_limits<float>::min()}), &m_element->document(),
WTF::bind(&ElementVisibilityObserver::onVisibilityChanged, wrapWeakPersistent(this)));
DCHECK(m_intersectionObserver);
m_intersectionObserver->observe(m_element);
m_intersectionObserver->observe(m_element.release());
}

void ElementVisibilityObserver::stop()
{
DCHECK(m_intersectionObserver);

m_intersectionObserver->unobserve(m_element);
m_intersectionObserver->disconnect();
m_intersectionObserver = nullptr;
}

Expand Down
2 changes: 1 addition & 1 deletion third_party/WebKit/Source/core/dom/IntersectionObserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class CORE_EXPORT IntersectionObserver final : public GarbageCollectedFinalized<
// API methods.
void observe(Element*, ExceptionState& = ASSERT_NO_EXCEPTION);
void unobserve(Element*, ExceptionState& = ASSERT_NO_EXCEPTION);
void disconnect(ExceptionState&);
void disconnect(ExceptionState& = ASSERT_NO_EXCEPTION);
HeapVector<Member<IntersectionObserverEntry>> takeRecords(ExceptionState&);

// API attributes.
Expand Down

0 comments on commit 0adb974

Please sign in to comment.