| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/V8HiddenValue.h" | 5 #include "bindings/core/v8/V8HiddenValue.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 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 #define V8_DEFINE_METHOD(name) \ | 13 #define V8_DEFINE_METHOD(name) \ |
| 14 v8::Local<v8::String> V8HiddenValue::name(v8::Isolate* isolate) { \ | 14 v8::Local<v8::String> V8HiddenValue::name(v8::Isolate* isolate) { \ |
| 15 V8HiddenValue* hiddenValue = \ | 15 V8HiddenValue* hiddenValue = from(isolate); \ |
| 16 V8PerIsolateData::from(isolate)->hiddenValue(); \ | |
| 17 if (hiddenValue->m_##name.isEmpty()) { \ | 16 if (hiddenValue->m_##name.isEmpty()) { \ |
| 18 hiddenValue->m_##name.set(isolate, v8AtomicString(isolate, #name)); \ | 17 hiddenValue->m_##name.set(isolate, v8AtomicString(isolate, #name)); \ |
| 19 } \ | 18 } \ |
| 20 return hiddenValue->m_##name.newLocal(isolate); \ | 19 return hiddenValue->m_##name.newLocal(isolate); \ |
| 21 } | 20 } |
| 22 | 21 |
| 23 V8_HIDDEN_VALUES(V8_DEFINE_METHOD); | 22 V8_HIDDEN_VALUES(V8_DEFINE_METHOD); |
| 24 | 23 |
| 25 v8::Local<v8::Value> V8HiddenValue::getHiddenValue(ScriptState* scriptState, | 24 v8::Local<v8::Value> V8HiddenValue::getHiddenValue(ScriptState* scriptState, |
| 26 v8::Local<v8::Object> object, | 25 v8::Local<v8::Object> object, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 ScriptState* scriptState, | 62 ScriptState* scriptState, |
| 64 ScriptWrappable* wrappable, | 63 ScriptWrappable* wrappable, |
| 65 v8::Local<v8::String> key) { | 64 v8::Local<v8::String> key) { |
| 66 v8::Local<v8::Object> wrapper = | 65 v8::Local<v8::Object> wrapper = |
| 67 wrappable->mainWorldWrapper(scriptState->isolate()); | 66 wrappable->mainWorldWrapper(scriptState->isolate()); |
| 68 return wrapper.IsEmpty() ? v8::Local<v8::Value>() | 67 return wrapper.IsEmpty() ? v8::Local<v8::Value>() |
| 69 : getHiddenValue(scriptState, wrapper, key); | 68 : getHiddenValue(scriptState, wrapper, key); |
| 70 } | 69 } |
| 71 | 70 |
| 72 } // namespace blink | 71 } // namespace blink |
| OLD | NEW |