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 "bindings/core/v8/V8PrivateProperty.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptState.h" | 7 #include "bindings/core/v8/ScriptState.h" |
8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
9 #include "bindings/core/v8/V8Binding.h" | 9 #include "bindings/core/v8/V8Binding.h" |
10 #include "bindings/core/v8/V8BindingMacros.h" | 10 #include "bindings/core/v8/V8BindingMacros.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 v8::Local<v8::Value> V8PrivateProperty::Symbol::getFromMainWorld(ScriptState* sc
riptState, ScriptWrappable* scriptWrappable) | 14 v8::Local<v8::Value> V8PrivateProperty::Symbol::getFromMainWorld(ScriptState* sc
riptState, ScriptWrappable* scriptWrappable) |
15 { | 15 { |
16 v8::Local<v8::Object> wrapper = scriptWrappable->newLocalWrapper(scriptState
->isolate()); | 16 v8::Local<v8::Object> wrapper = scriptWrappable->mainWorldWrapper(scriptStat
e->isolate()); |
17 return wrapper.IsEmpty() ? v8::Local<v8::Value>() : get(scriptState->context
(), wrapper); | 17 return wrapper.IsEmpty() ? v8::Local<v8::Value>() : get(scriptState->context
(), wrapper); |
18 } | 18 } |
19 | 19 |
20 v8::Local<v8::Private> V8PrivateProperty::createV8Private(v8::Isolate* isolate,
const char* symbol, size_t length) | 20 v8::Local<v8::Private> V8PrivateProperty::createV8Private(v8::Isolate* isolate,
const char* symbol, size_t length) |
21 { | 21 { |
22 v8::Local<v8::String> str = v8CallOrCrash(v8::String::NewFromOneByte(isolate
, reinterpret_cast<const uint8_t*>(symbol), v8::NewStringType::kNormal, static_c
ast<int>(length))); | 22 v8::Local<v8::String> str = v8CallOrCrash(v8::String::NewFromOneByte(isolate
, reinterpret_cast<const uint8_t*>(symbol), v8::NewStringType::kNormal, static_c
ast<int>(length))); |
23 return v8::Private::ForApi(isolate, str); | 23 return v8::Private::ForApi(isolate, str); |
24 } | 24 } |
25 | 25 |
26 } // namespace blink | 26 } // namespace blink |
OLD | NEW |