summaryrefslogtreecommitdiff
path: root/chromium/third_party/WebKit/Source/bindings/core/v8/V8IntersectionObserverDelegate.cpp
blob: 2949a8b7bc2972468cb207bc9d5e0cedcd654d8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "bindings/core/v8/V8IntersectionObserverDelegate.h"

#include "bindings/core/v8/ScriptController.h"
#include "bindings/core/v8/V8BindingForCore.h"
#include "bindings/core/v8/v8_intersection_observer_callback.h"
#include "core/dom/ExecutionContext.h"
#include "core/intersection_observer/IntersectionObserver.h"
#include "platform/bindings/V8PrivateProperty.h"
#include "platform/wtf/Assertions.h"

namespace blink {

V8IntersectionObserverDelegate::V8IntersectionObserverDelegate(
    V8IntersectionObserverCallback* callback,
    ScriptState* script_state)
    : callback_(callback), script_state_(script_state) {}

V8IntersectionObserverDelegate::~V8IntersectionObserverDelegate() {}

void V8IntersectionObserverDelegate::Deliver(
    const HeapVector<Member<IntersectionObserverEntry>>& entries,
    IntersectionObserver& observer) {
  callback_->call(&observer, entries, &observer);
}

DEFINE_TRACE(V8IntersectionObserverDelegate) {
  visitor->Trace(callback_);
  IntersectionObserverDelegate::Trace(visitor);
}

DEFINE_TRACE_WRAPPERS(V8IntersectionObserverDelegate) {
  visitor->TraceWrappers(callback_);
  IntersectionObserverDelegate::TraceWrappers(visitor);
}

}  // namespace blink