| Index: src/extensions/i18n/i18n-utils.cc
|
| diff --git a/src/extensions/i18n/i18n-utils.cc b/src/extensions/i18n/i18n-utils.cc
|
| index b720329f8b6f2446cd0e9b4f3171bfbfd89b0f80..eac11669047ec407e57c78d4038716a0a7bc18ee 100644
|
| --- a/src/extensions/i18n/i18n-utils.cc
|
| +++ b/src/extensions/i18n/i18n-utils.cc
|
| @@ -142,40 +142,34 @@ void Utils::AsciiToUChar(const char* source,
|
|
|
|
|
| // static
|
| -// Chrome Linux doesn't like static initializers in class, so we create
|
| -// template on demand.
|
| v8::Local<v8::ObjectTemplate> Utils::GetTemplate(v8::Isolate* isolate) {
|
| - static v8::Persistent<v8::ObjectTemplate> icu_template;
|
| -
|
| - if (icu_template.IsEmpty()) {
|
| + i::Isolate* internal = reinterpret_cast<i::Isolate*>(isolate);
|
| + if (internal->heap()->i18n_template_one() ==
|
| + internal->heap()->the_hole_value()) {
|
| v8::Local<v8::ObjectTemplate> raw_template(v8::ObjectTemplate::New());
|
| -
|
| - // Set aside internal field for ICU class.
|
| raw_template->SetInternalFieldCount(1);
|
| -
|
| - icu_template.Reset(isolate, raw_template);
|
| + internal->heap()
|
| + ->SetI18nTemplateOne(*v8::Utils::OpenHandle(*raw_template));
|
| }
|
|
|
| - return v8::Local<v8::ObjectTemplate>::New(isolate, icu_template);
|
| + return v8::Utils::ToLocal(i::Handle<i::ObjectTemplateInfo>::cast(
|
| + internal->factory()->i18n_template_one()));
|
| }
|
|
|
|
|
| // static
|
| -// Chrome Linux doesn't like static initializers in class, so we create
|
| -// template on demand. This one has 2 internal fields.
|
| v8::Local<v8::ObjectTemplate> Utils::GetTemplate2(v8::Isolate* isolate) {
|
| - static v8::Persistent<v8::ObjectTemplate> icu_template_2;
|
| -
|
| - if (icu_template_2.IsEmpty()) {
|
| + i::Isolate* internal = reinterpret_cast<i::Isolate*>(isolate);
|
| + if (internal->heap()->i18n_template_two() ==
|
| + internal->heap()->the_hole_value()) {
|
| v8::Local<v8::ObjectTemplate> raw_template(v8::ObjectTemplate::New());
|
| -
|
| - // Set aside internal field for ICU class and additional data.
|
| raw_template->SetInternalFieldCount(2);
|
| -
|
| - icu_template_2.Reset(isolate, raw_template);
|
| + internal->heap()
|
| + ->SetI18nTemplateTwo(*v8::Utils::OpenHandle(*raw_template));
|
| }
|
|
|
| - return v8::Local<v8::ObjectTemplate>::New(isolate, icu_template_2);
|
| + return v8::Utils::ToLocal(i::Handle<i::ObjectTemplateInfo>::cast(
|
| + internal->factory()->i18n_template_two()));
|
| }
|
|
|
| } // namespace v8_i18n
|
|
|