| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #include "bindings/core/v8/V8DOMConfiguration.h" | 29 #include "bindings/core/v8/V8DOMConfiguration.h" |
| 30 | 30 |
| 31 #include "bindings/core/v8/V8SnapshotCreator.h" |
| 31 #include "platform/bindings/V8ObjectConstructor.h" | 32 #include "platform/bindings/V8ObjectConstructor.h" |
| 32 #include "platform/bindings/V8PerContextData.h" | 33 #include "platform/bindings/V8PerContextData.h" |
| 33 #include "platform/instrumentation/tracing/TraceEvent.h" | 34 #include "platform/instrumentation/tracing/TraceEvent.h" |
| 34 | 35 |
| 35 namespace blink { | 36 namespace blink { |
| 36 | 37 |
| 37 namespace { | 38 namespace { |
| 38 | 39 |
| 39 template <class Configuration> | 40 template <class Configuration> |
| 40 bool WorldConfigurationApplies(const Configuration& config, | 41 bool WorldConfigurationApplies(const Configuration& config, |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 prototype_template->SetInternalFieldCount(kV8PrototypeInternalFieldcount); | 672 prototype_template->SetInternalFieldCount(kV8PrototypeInternalFieldcount); |
| 672 } | 673 } |
| 673 } | 674 } |
| 674 | 675 |
| 675 v8::Local<v8::FunctionTemplate> V8DOMConfiguration::DomClassTemplate( | 676 v8::Local<v8::FunctionTemplate> V8DOMConfiguration::DomClassTemplate( |
| 676 v8::Isolate* isolate, | 677 v8::Isolate* isolate, |
| 677 const DOMWrapperWorld& world, | 678 const DOMWrapperWorld& world, |
| 678 WrapperTypeInfo* wrapper_type_info, | 679 WrapperTypeInfo* wrapper_type_info, |
| 679 InstallTemplateFunction configure_dom_class_template) { | 680 InstallTemplateFunction configure_dom_class_template) { |
| 680 V8PerIsolateData* data = V8PerIsolateData::From(isolate); | 681 V8PerIsolateData* data = V8PerIsolateData::From(isolate); |
| 681 v8::Local<v8::FunctionTemplate> result = | 682 v8::Local<v8::FunctionTemplate> interface_template = |
| 682 data->FindInterfaceTemplate(world, wrapper_type_info); | 683 data->FindInterfaceTemplate(world, wrapper_type_info); |
| 683 if (!result.IsEmpty()) | 684 if (!interface_template.IsEmpty()) |
| 684 return result; | 685 return interface_template; |
| 685 | 686 |
| 686 result = v8::FunctionTemplate::New( | 687 interface_template = V8SnapshotCreator::CreateInterfaceTemplate( |
| 687 isolate, V8ObjectConstructor::IsValidConstructorMode); | 688 isolate, world, wrapper_type_info); |
| 688 configure_dom_class_template(isolate, world, result); | 689 |
| 689 data->SetInterfaceTemplate(world, wrapper_type_info, result); | 690 if (interface_template.IsEmpty()) { |
| 690 return result; | 691 interface_template = v8::FunctionTemplate::New( |
| 692 isolate, V8ObjectConstructor::IsValidConstructorMode); |
| 693 configure_dom_class_template(isolate, world, interface_template); |
| 694 } |
| 695 data->SetInterfaceTemplate(world, wrapper_type_info, interface_template); |
| 696 return interface_template; |
| 691 } | 697 } |
| 692 | 698 |
| 693 void V8DOMConfiguration::SetClassString( | 699 void V8DOMConfiguration::SetClassString( |
| 694 v8::Isolate* isolate, | 700 v8::Isolate* isolate, |
| 695 v8::Local<v8::ObjectTemplate> object_template, | 701 v8::Local<v8::ObjectTemplate> object_template, |
| 696 const char* class_string) { | 702 const char* class_string) { |
| 697 object_template->Set( | 703 object_template->Set( |
| 698 v8::Symbol::GetToStringTag(isolate), | 704 v8::Symbol::GetToStringTag(isolate), |
| 699 V8AtomicString(isolate, class_string), | 705 V8AtomicString(isolate, class_string), |
| 700 static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); | 706 static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); |
| 701 } | 707 } |
| 702 | 708 |
| 703 } // namespace blink | 709 } // namespace blink |
| OLD | NEW |