OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "bindings/core/v8/V8PrivateProperty.h" | 5 #include "platform/bindings/V8PrivateProperty.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptState.h" | 7 #include "platform/bindings/ScriptState.h" |
8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "platform/bindings/ScriptWrappable.h" |
9 #include "bindings/core/v8/V8Binding.h" | 9 #include "platform/bindings/V8Binding.h" |
10 #include "bindings/core/v8/V8BindingMacros.h" | 10 #include "platform/bindings/V8BindingMacros.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 v8::Local<v8::Value> V8PrivateProperty::Symbol::GetFromMainWorld( | 14 v8::Local<v8::Value> V8PrivateProperty::Symbol::GetFromMainWorld( |
15 ScriptWrappable* script_wrappable) { | 15 ScriptWrappable* script_wrappable) { |
16 v8::Local<v8::Object> wrapper = script_wrappable->MainWorldWrapper(isolate_); | 16 v8::Local<v8::Object> wrapper = script_wrappable->MainWorldWrapper(isolate_); |
17 return wrapper.IsEmpty() ? v8::Local<v8::Value>() : GetOrEmpty(wrapper); | 17 return wrapper.IsEmpty() ? v8::Local<v8::Value>() : GetOrEmpty(wrapper); |
18 } | 18 } |
19 | 19 |
20 v8::Local<v8::Private> V8PrivateProperty::CreateV8Private(v8::Isolate* isolate, | 20 v8::Local<v8::Private> V8PrivateProperty::CreateV8Private(v8::Isolate* isolate, |
21 const char* symbol) { | 21 const char* symbol) { |
22 return v8::Private::New(isolate, V8String(isolate, symbol)); | 22 return v8::Private::New(isolate, V8String(isolate, symbol)); |
23 } | 23 } |
24 | 24 |
25 v8::Local<v8::Private> V8PrivateProperty::CreateCachedV8Private( | 25 v8::Local<v8::Private> V8PrivateProperty::CreateCachedV8Private( |
26 v8::Isolate* isolate, | 26 v8::Isolate* isolate, |
27 const char* symbol) { | 27 const char* symbol) { |
28 // Use ForApi() to get the same Private symbol which is not cached in Chrome. | 28 // Use ForApi() to get the same Private symbol which is not cached in Chrome. |
29 return v8::Private::ForApi(isolate, V8String(isolate, symbol)); | 29 return v8::Private::ForApi(isolate, V8String(isolate, symbol)); |
30 } | 30 } |
31 | 31 |
32 } // namespace blink | 32 } // namespace blink |
OLD | NEW |