| 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 #ifndef V8PrivateProperty_h | 5 #ifndef V8PrivateProperty_h |
| 6 #define V8PrivateProperty_h | 6 #define V8PrivateProperty_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScopedPersistent.h" | 8 #include "bindings/core/v8/ScopedPersistent.h" |
| 9 #include "bindings/core/v8/ScriptPromiseProperties.h" | 9 #include "bindings/core/v8/ScriptPromiseProperties.h" |
| 10 #include "bindings/core/v8/V8BindingMacros.h" | 10 #include "bindings/core/v8/V8BindingMacros.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 STACK_ALLOCATED(); | 75 STACK_ALLOCATED(); |
| 76 public: | 76 public: |
| 77 bool hasValue(v8::Local<v8::Context> context, v8::Local<v8::Object> obje
ct) const | 77 bool hasValue(v8::Local<v8::Context> context, v8::Local<v8::Object> obje
ct) const |
| 78 { | 78 { |
| 79 return v8CallBoolean(object->HasPrivate(context, m_privateSymbol)); | 79 return v8CallBoolean(object->HasPrivate(context, m_privateSymbol)); |
| 80 } | 80 } |
| 81 | 81 |
| 82 // Returns the value of the private property if set, or undefined. | 82 // Returns the value of the private property if set, or undefined. |
| 83 v8::Local<v8::Value> getOrUndefined(v8::Local<v8::Context> context, v8::
Local<v8::Object> object) const | 83 v8::Local<v8::Value> getOrUndefined(v8::Local<v8::Context> context, v8::
Local<v8::Object> object) const |
| 84 { | 84 { |
| 85 return v8CallOrCrash(object->GetPrivate(context, m_privateSymbol)); | 85 return object->GetPrivate(context, m_privateSymbol).ToLocalChecked()
; |
| 86 } | 86 } |
| 87 | 87 |
| 88 // Returns the value of the private property if set, or an empty handle. | 88 // Returns the value of the private property if set, or an empty handle. |
| 89 v8::Local<v8::Value> get(v8::Local<v8::Context> context, v8::Local<v8::O
bject> object) const | 89 v8::Local<v8::Value> get(v8::Local<v8::Context> context, v8::Local<v8::O
bject> object) const |
| 90 { | 90 { |
| 91 if (!v8CallBoolean(object->HasPrivate(context, m_privateSymbol))) | 91 if (!v8CallBoolean(object->HasPrivate(context, m_privateSymbol))) |
| 92 return v8::Local<v8::Value>(); | 92 return v8::Local<v8::Value>(); |
| 93 v8::Local<v8::Value> value; | 93 v8::Local<v8::Value> value; |
| 94 if (v8Call(object->GetPrivate(context, m_privateSymbol), value)) | 94 if (v8Call(object->GetPrivate(context, m_privateSymbol), value)) |
| 95 return value; | 95 return value; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 #define V8_PRIVATE_PROPERTY_DECLARE_MEMBER(InterfaceName, KeyName) \ | 152 #define V8_PRIVATE_PROPERTY_DECLARE_MEMBER(InterfaceName, KeyName) \ |
| 153 ScopedPersistent<v8::Private> V8_PRIVATE_PROPERTY_MEMBER_NAME(InterfaceName,
KeyName); // NOLINT(readability/naming/underscores) | 153 ScopedPersistent<v8::Private> V8_PRIVATE_PROPERTY_MEMBER_NAME(InterfaceName,
KeyName); // NOLINT(readability/naming/underscores) |
| 154 V8_PRIVATE_PROPERTY_FOR_EACH(V8_PRIVATE_PROPERTY_DECLARE_MEMBER) | 154 V8_PRIVATE_PROPERTY_FOR_EACH(V8_PRIVATE_PROPERTY_DECLARE_MEMBER) |
| 155 #undef V8_PRIVATE_PROPERTY_DECLARE_MEMBER | 155 #undef V8_PRIVATE_PROPERTY_DECLARE_MEMBER |
| 156 }; | 156 }; |
| 157 | 157 |
| 158 } // namespace blink | 158 } // namespace blink |
| 159 | 159 |
| 160 #endif // V8PrivateProperty_h | 160 #endif // V8PrivateProperty_h |
| OLD | NEW |