OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef V8CrossOriginSetterInfo_h | |
6 #define V8CrossOriginSetterInfo_h | |
7 | |
8 #include "wtf/Allocator.h" | |
9 #include <v8.h> | |
10 | |
11 namespace blink { | |
12 | |
13 // Simple adapter that is used in place of v8::PropertyCallbackInfo for setters | |
14 // that are accessible cross-origin. This is needed because a named access check | |
15 // interceptor takes a v8::PropertyCallbackInfo<v8::Value> argument, while a | |
16 // normal setter interceptor takes a v8::PropertyCallbackInfo<void> argument. | |
haraken
2016/12/08 08:21:02
Hmm, this looks nasty. Can we fix it in a follow-u
dcheng
2016/12/08 09:04:10
I don't see an easy way to fix it without changing
| |
17 // | |
18 // Since the generated bindings only care about two fields (the isolate and the | |
19 // holder), the generated bindings just substitutes this for the normal | |
20 // v8::PropertyCallbackInfo argument, so the same generated function can be used | |
21 // to handle intercepted cross-origin sets and normal sets. | |
22 class V8CrossOriginSetterInfo { | |
23 STACK_ALLOCATED(); | |
24 | |
25 public: | |
26 V8CrossOriginSetterInfo(v8::Isolate* isolate, v8::Local<v8::Object> holder) | |
27 : m_isolate(isolate), m_holder(holder) {} | |
28 | |
29 v8::Isolate* GetIsolate() const { return m_isolate; } | |
30 v8::Local<v8::Object> Holder() const { return m_holder; } | |
31 | |
32 private: | |
33 v8::Isolate* m_isolate; | |
34 v8::Local<v8::Object> m_holder; | |
35 }; | |
36 | |
37 } // namespace blink | |
38 | |
39 #endif // V8CrossOriginSetterInfo_h | |
OLD | NEW |