[go: nahoru, domu]

blob: e877a2519937a2a359d59700565a71b225ac8b75 [file] [log] [blame]
Avi Drissman468e51b62022-09-13 20:47:011// Copyright 2014 The Chromium Authors
jochen@chromium.org5c969b82014-03-12 04:59:052// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "gin/interceptor.h"
6
avi90e658dd2015-12-21 07:16:197#include <stdint.h>
8
jochen@chromium.org5c969b82014-03-12 04:59:059#include <map>
10
11#include "gin/per_isolate_data.h"
12
13namespace gin {
14
15NamedPropertyInterceptor::NamedPropertyInterceptor(v8::Isolate* isolate,
16 WrappableBase* base)
17 : isolate_(isolate), base_(base) {
18 PerIsolateData::From(isolate_)->SetNamedPropertyInterceptor(base_, this);
19}
20
21NamedPropertyInterceptor::~NamedPropertyInterceptor() {
22 PerIsolateData::From(isolate_)->ClearNamedPropertyInterceptor(base_, this);
23}
24
25v8::Local<v8::Value> NamedPropertyInterceptor::GetNamedProperty(
26 v8::Isolate* isolate,
27 const std::string& property) {
28 return v8::Local<v8::Value>();
29}
30
jochen@chromium.orgd656f872014-08-13 17:12:5531bool NamedPropertyInterceptor::SetNamedProperty(v8::Isolate* isolate,
jochen@chromium.org5c969b82014-03-12 04:59:0532 const std::string& property,
jochen@chromium.orgd656f872014-08-13 17:12:5533 v8::Local<v8::Value> value) {
34 return false;
35}
jochen@chromium.org5c969b82014-03-12 04:59:0536
37std::vector<std::string> NamedPropertyInterceptor::EnumerateNamedProperties(
38 v8::Isolate* isolate) {
39 return std::vector<std::string>();
40}
41
Hyowon Kim0e7a84f2023-11-24 00:32:0142void NamedPropertyInterceptor::ClearForTesting() {
43 PerIsolateData::From(isolate_)->ClearNamedPropertyInterceptor(base_, this);
44 isolate_ = nullptr;
45}
46
jochen@chromium.org5c969b82014-03-12 04:59:0547IndexedPropertyInterceptor::IndexedPropertyInterceptor(v8::Isolate* isolate,
48 WrappableBase* base)
49 : isolate_(isolate), base_(base) {
50 PerIsolateData::From(isolate_)->SetIndexedPropertyInterceptor(base_, this);
51}
52
53IndexedPropertyInterceptor::~IndexedPropertyInterceptor() {
54 PerIsolateData::From(isolate_)->ClearIndexedPropertyInterceptor(base_, this);
55}
56
57v8::Local<v8::Value> IndexedPropertyInterceptor::GetIndexedProperty(
58 v8::Isolate* isolate,
59 uint32_t index) {
60 return v8::Local<v8::Value>();
61}
62
jochen@chromium.orgd656f872014-08-13 17:12:5563bool IndexedPropertyInterceptor::SetIndexedProperty(
jochen@chromium.org5c969b82014-03-12 04:59:0564 v8::Isolate* isolate,
65 uint32_t index,
jochen@chromium.orgd656f872014-08-13 17:12:5566 v8::Local<v8::Value> value) {
67 return false;
68}
jochen@chromium.org5c969b82014-03-12 04:59:0569
70std::vector<uint32_t> IndexedPropertyInterceptor::EnumerateIndexedProperties(
71 v8::Isolate* isolate) {
72 return std::vector<uint32_t>();
73}
74
Hyowon Kim0e7a84f2023-11-24 00:32:0175void IndexedPropertyInterceptor::ClearForTesting() {
76 PerIsolateData::From(isolate_)->ClearIndexedPropertyInterceptor(base_, this);
77 isolate_ = nullptr;
78}
79
jochen@chromium.org5c969b82014-03-12 04:59:0580} // namespace gin