| 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/ScriptCustomElementDefinition.h" | 5 #include "bindings/core/v8/ScriptCustomElementDefinition.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptState.h" | 7 #include "bindings/core/v8/ScriptState.h" |
| 8 #include "bindings/core/v8/V8BindingForCore.h" | 8 #include "bindings/core/v8/V8BindingForCore.h" |
| 9 #include "bindings/core/v8/V8BindingMacros.h" | 9 #include "bindings/core/v8/V8BindingMacros.h" |
| 10 #include "bindings/core/v8/V8CustomElementRegistry.h" | 10 #include "bindings/core/v8/V8CustomElementRegistry.h" |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 | 267 |
| 268 return true; | 268 return true; |
| 269 } | 269 } |
| 270 | 270 |
| 271 Element* ScriptCustomElementDefinition::CallConstructor() { | 271 Element* ScriptCustomElementDefinition::CallConstructor() { |
| 272 v8::Isolate* isolate = script_state_->GetIsolate(); | 272 v8::Isolate* isolate = script_state_->GetIsolate(); |
| 273 DCHECK(ScriptState::Current(isolate) == script_state_); | 273 DCHECK(ScriptState::Current(isolate) == script_state_); |
| 274 ExecutionContext* execution_context = | 274 ExecutionContext* execution_context = |
| 275 ExecutionContext::From(script_state_.Get()); | 275 ExecutionContext::From(script_state_.Get()); |
| 276 v8::Local<v8::Value> result; | 276 v8::Local<v8::Value> result; |
| 277 if (!V8Call(V8ScriptRunner::CallAsConstructor(isolate, Constructor(), | 277 if (!V8ScriptRunner::CallAsConstructor(isolate, Constructor(), |
| 278 execution_context, 0, nullptr), | 278 execution_context, 0, nullptr) |
| 279 result)) { | 279 .ToLocal(&result)) { |
| 280 return nullptr; | 280 return nullptr; |
| 281 } | 281 } |
| 282 return V8Element::toImplWithTypeCheck(isolate, result); | 282 return V8Element::toImplWithTypeCheck(isolate, result); |
| 283 } | 283 } |
| 284 | 284 |
| 285 v8::Local<v8::Object> ScriptCustomElementDefinition::Constructor() const { | 285 v8::Local<v8::Object> ScriptCustomElementDefinition::Constructor() const { |
| 286 DCHECK(!constructor_.IsEmpty()); | 286 DCHECK(!constructor_.IsEmpty()); |
| 287 return constructor_.NewLocal(script_state_->GetIsolate()); | 287 return constructor_.NewLocal(script_state_->GetIsolate()); |
| 288 } | 288 } |
| 289 | 289 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 v8::Local<v8::Value> argv[] = { | 368 v8::Local<v8::Value> argv[] = { |
| 369 V8String(isolate, name.LocalName()), V8StringOrNull(isolate, old_value), | 369 V8String(isolate, name.LocalName()), V8StringOrNull(isolate, old_value), |
| 370 V8StringOrNull(isolate, new_value), | 370 V8StringOrNull(isolate, new_value), |
| 371 V8StringOrNull(isolate, name.NamespaceURI()), | 371 V8StringOrNull(isolate, name.NamespaceURI()), |
| 372 }; | 372 }; |
| 373 RunCallback(attribute_changed_callback_.NewLocal(isolate), element, | 373 RunCallback(attribute_changed_callback_.NewLocal(isolate), element, |
| 374 WTF_ARRAY_LENGTH(argv), argv); | 374 WTF_ARRAY_LENGTH(argv), argv); |
| 375 } | 375 } |
| 376 | 376 |
| 377 } // namespace blink | 377 } // namespace blink |
| OLD | NEW |