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 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 } | 43 } |
44 | 44 |
45 bool V8HiddenValue::deleteHiddenValue(ScriptState* scriptState, v8::Local<v8::Ob
ject> object, v8::Local<v8::String> key) | 45 bool V8HiddenValue::deleteHiddenValue(ScriptState* scriptState, v8::Local<v8::Ob
ject> object, v8::Local<v8::String> key) |
46 { | 46 { |
47 // Actually deleting the value would make force the object into dictionary m
ode which is unnecessarily slow. Instead, we replace the hidden value with "unde
fined". | 47 // Actually deleting the value would make force the object into dictionary m
ode which is unnecessarily slow. Instead, we replace the hidden value with "unde
fined". |
48 return v8CallBoolean(object->SetPrivate(scriptState->context(), v8::Private:
:ForApi(scriptState->isolate(), key), v8::Undefined(scriptState->isolate()))); | 48 return v8CallBoolean(object->SetPrivate(scriptState->context(), v8::Private:
:ForApi(scriptState->isolate(), key), v8::Undefined(scriptState->isolate()))); |
49 } | 49 } |
50 | 50 |
51 v8::Local<v8::Value> V8HiddenValue::getHiddenValueFromMainWorldWrapper(ScriptSta
te* scriptState, ScriptWrappable* wrappable, v8::Local<v8::String> key) | 51 v8::Local<v8::Value> V8HiddenValue::getHiddenValueFromMainWorldWrapper(ScriptSta
te* scriptState, ScriptWrappable* wrappable, v8::Local<v8::String> key) |
52 { | 52 { |
53 v8::Local<v8::Object> wrapper = wrappable->newLocalWrapper(scriptState->isol
ate()); | 53 v8::Local<v8::Object> wrapper = wrappable->mainWorldWrapper(scriptState->iso
late()); |
54 return wrapper.IsEmpty() ? v8::Local<v8::Value>() : getHiddenValue(scriptSta
te, wrapper, key); | 54 return wrapper.IsEmpty() ? v8::Local<v8::Value>() : getHiddenValue(scriptSta
te, wrapper, key); |
55 } | 55 } |
56 | 56 |
57 } // namespace blink | 57 } // namespace blink |
OLD | NEW |