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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
695 prototype_template->SetInternalFieldCount(kV8PrototypeInternalFieldcount); | 696 prototype_template->SetInternalFieldCount(kV8PrototypeInternalFieldcount); |
696 } | 697 } |
697 } | 698 } |
698 | 699 |
699 v8::Local<v8::FunctionTemplate> V8DOMConfiguration::DomClassTemplate( | 700 v8::Local<v8::FunctionTemplate> V8DOMConfiguration::DomClassTemplate( |
700 v8::Isolate* isolate, | 701 v8::Isolate* isolate, |
701 const DOMWrapperWorld& world, | 702 const DOMWrapperWorld& world, |
702 WrapperTypeInfo* wrapper_type_info, | 703 WrapperTypeInfo* wrapper_type_info, |
703 InstallTemplateFunction configure_dom_class_template) { | 704 InstallTemplateFunction configure_dom_class_template) { |
704 V8PerIsolateData* data = V8PerIsolateData::From(isolate); | 705 V8PerIsolateData* data = V8PerIsolateData::From(isolate); |
705 v8::Local<v8::FunctionTemplate> result = | 706 v8::Local<v8::FunctionTemplate> interface_template = |
706 data->FindInterfaceTemplate(world, wrapper_type_info); | 707 data->FindInterfaceTemplate(world, wrapper_type_info); |
707 if (!result.IsEmpty()) | 708 if (!interface_template.IsEmpty()) |
708 return result; | 709 return interface_template; |
709 | 710 |
710 result = v8::FunctionTemplate::New( | 711 interface_template = V8SnapshotCreator::CreateInterfaceTemplate( |
Yuki
2017/05/30 14:35:56
nit: This seems not creating an interface template
peria
2017/06/01 08:33:33
Done.
| |
711 isolate, V8ObjectConstructor::IsValidConstructorMode); | 712 isolate, world, wrapper_type_info); |
712 configure_dom_class_template(isolate, world, result); | 713 |
713 data->SetInterfaceTemplate(world, wrapper_type_info, result); | 714 if (interface_template.IsEmpty()) { |
714 return result; | 715 interface_template = v8::FunctionTemplate::New( |
716 isolate, V8ObjectConstructor::IsValidConstructorMode); | |
717 configure_dom_class_template(isolate, world, interface_template); | |
718 } | |
719 data->SetInterfaceTemplate(world, wrapper_type_info, interface_template); | |
720 return interface_template; | |
715 } | 721 } |
716 | 722 |
717 void V8DOMConfiguration::SetClassString( | 723 void V8DOMConfiguration::SetClassString( |
718 v8::Isolate* isolate, | 724 v8::Isolate* isolate, |
719 v8::Local<v8::ObjectTemplate> object_template, | 725 v8::Local<v8::ObjectTemplate> object_template, |
720 const char* class_string) { | 726 const char* class_string) { |
721 object_template->Set( | 727 object_template->Set( |
722 v8::Symbol::GetToStringTag(isolate), | 728 v8::Symbol::GetToStringTag(isolate), |
723 V8AtomicString(isolate, class_string), | 729 V8AtomicString(isolate, class_string), |
724 static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); | 730 static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); |
725 } | 731 } |
726 | 732 |
727 } // namespace blink | 733 } // namespace blink |
OLD | NEW |