| 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/ScriptCustomElementDefinitionBuilder.h" | 5 #include "bindings/core/v8/ScriptCustomElementDefinitionBuilder.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/DOMWrapperWorld.h" | 7 #include "bindings/core/v8/DOMWrapperWorld.h" |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "bindings/core/v8/IDLTypes.h" | 9 #include "bindings/core/v8/IDLTypes.h" |
| 10 #include "bindings/core/v8/NativeValueTraitsImpl.h" | 10 #include "bindings/core/v8/NativeValueTraitsImpl.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 } | 77 } |
| 78 | 78 |
| 79 bool ScriptCustomElementDefinitionBuilder::ValueForName( | 79 bool ScriptCustomElementDefinitionBuilder::ValueForName( |
| 80 const v8::Local<v8::Object>& object, | 80 const v8::Local<v8::Object>& object, |
| 81 const StringView& name, | 81 const StringView& name, |
| 82 v8::Local<v8::Value>& value) const { | 82 v8::Local<v8::Value>& value) const { |
| 83 v8::Isolate* isolate = script_state_->GetIsolate(); | 83 v8::Isolate* isolate = script_state_->GetIsolate(); |
| 84 v8::Local<v8::Context> context = script_state_->GetContext(); | 84 v8::Local<v8::Context> context = script_state_->GetContext(); |
| 85 v8::Local<v8::String> name_string = V8AtomicString(isolate, name); | 85 v8::Local<v8::String> name_string = V8AtomicString(isolate, name); |
| 86 v8::TryCatch try_catch(isolate); | 86 v8::TryCatch try_catch(isolate); |
| 87 if (!V8Call(object->Get(context, name_string), value, try_catch)) { | 87 if (!object->Get(context, name_string).ToLocal(&value)) { |
| 88 exception_state_.RethrowV8Exception(try_catch.Exception()); | 88 exception_state_.RethrowV8Exception(try_catch.Exception()); |
| 89 return false; | 89 return false; |
| 90 } | 90 } |
| 91 return true; | 91 return true; |
| 92 } | 92 } |
| 93 | 93 |
| 94 bool ScriptCustomElementDefinitionBuilder::CheckPrototype() { | 94 bool ScriptCustomElementDefinitionBuilder::CheckPrototype() { |
| 95 v8::Local<v8::Value> prototype_value; | 95 v8::Local<v8::Value> prototype_value; |
| 96 if (!ValueForName(constructor_, "prototype", prototype_value)) | 96 if (!ValueForName(constructor_, "prototype", prototype_value)) |
| 97 return false; | 97 return false; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 156 |
| 157 CustomElementDefinition* ScriptCustomElementDefinitionBuilder::Build( | 157 CustomElementDefinition* ScriptCustomElementDefinitionBuilder::Build( |
| 158 const CustomElementDescriptor& descriptor) { | 158 const CustomElementDescriptor& descriptor) { |
| 159 return ScriptCustomElementDefinition::Create( | 159 return ScriptCustomElementDefinition::Create( |
| 160 script_state_.Get(), registry_, descriptor, constructor_, | 160 script_state_.Get(), registry_, descriptor, constructor_, |
| 161 connected_callback_, disconnected_callback_, adopted_callback_, | 161 connected_callback_, disconnected_callback_, adopted_callback_, |
| 162 attribute_changed_callback_, observed_attributes_); | 162 attribute_changed_callback_, observed_attributes_); |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace blink | 165 } // namespace blink |
| OLD | NEW |