Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: Source/bindings/v8/V8PerIsolateData.cpp

Issue 29553002: Move privateTemplateUniqueKey / sharedTemplateUniqueKey to .bss section (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update sharedTemplateUniqueKey as well Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 isolate->SetData(0); 85 isolate->SetData(0);
86 } 86 }
87 87
88 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::toStringTemplate() 88 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::toStringTemplate()
89 { 89 {
90 if (m_toStringTemplate.isEmpty()) 90 if (m_toStringTemplate.isEmpty())
91 m_toStringTemplate.set(m_isolate, v8::FunctionTemplate::New(constructorO fToString)); 91 m_toStringTemplate.set(m_isolate, v8::FunctionTemplate::New(constructorO fToString));
92 return m_toStringTemplate.newLocal(m_isolate); 92 return m_toStringTemplate.newLocal(m_isolate);
93 } 93 }
94 94
95 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::privateTemplate(WrapperWorldT ype currentWorldType, void* privatePointer, v8::FunctionCallback callback, v8::H andle<v8::Value> data, v8::Handle<v8::Signature> signature, int length) 95 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::privateTemplate(WrapperWorldT ype currentWorldType, const void* privatePointer, v8::FunctionCallback callback, v8::Handle<v8::Value> data, v8::Handle<v8::Signature> signature, int length)
96 { 96 {
97 TemplateMap& templates = templateMap(currentWorldType); 97 TemplateMap& templates = templateMap(currentWorldType);
98 TemplateMap::iterator result = templates.find(privatePointer); 98 TemplateMap::iterator result = templates.find(privatePointer);
99 if (result != templates.end()) 99 if (result != templates.end())
100 return result->value.newLocal(m_isolate); 100 return result->value.newLocal(m_isolate);
101 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(callback, data, signature, length); 101 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(callback, data, signature, length);
102 templates.add(privatePointer, UnsafePersistent<v8::FunctionTemplate>(m_isola te, templ)); 102 templates.add(privatePointer, UnsafePersistent<v8::FunctionTemplate>(m_isola te, templ));
103 return templ; 103 return templ;
104 } 104 }
105 105
106 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::privateTemplateIfExists(Wrapp erWorldType currentWorldType, void* privatePointer) 106 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::privateTemplateIfExists(Wrapp erWorldType currentWorldType, const void* privatePointer)
107 { 107 {
108 TemplateMap& templates = templateMap(currentWorldType); 108 TemplateMap& templates = templateMap(currentWorldType);
109 TemplateMap::iterator result = templates.find(privatePointer); 109 TemplateMap::iterator result = templates.find(privatePointer);
110 if (result != templates.end()) 110 if (result != templates.end())
111 return result->value.newLocal(m_isolate); 111 return result->value.newLocal(m_isolate);
112 return v8::Local<v8::FunctionTemplate>(); 112 return v8::Local<v8::FunctionTemplate>();
113 } 113 }
114 114
115 void V8PerIsolateData::setPrivateTemplate(WrapperWorldType currentWorldType, voi d* privatePointer, v8::Handle<v8::FunctionTemplate> templ) 115 void V8PerIsolateData::setPrivateTemplate(WrapperWorldType currentWorldType, con st void* privatePointer, v8::Handle<v8::FunctionTemplate> templ)
116 { 116 {
117 templateMap(currentWorldType).add(privatePointer, UnsafePersistent<v8::Funct ionTemplate>(m_isolate, templ)); 117 templateMap(currentWorldType).add(privatePointer, UnsafePersistent<v8::Funct ionTemplate>(m_isolate, templ));
118 } 118 }
119 119
120 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::rawTemplate(WrapperTypeInfo* info, WrapperWorldType currentWorldType) 120 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::rawTemplate(WrapperTypeInfo* info, WrapperWorldType currentWorldType)
121 { 121 {
122 TemplateMap& templates = rawTemplateMap(currentWorldType); 122 TemplateMap& templates = rawTemplateMap(currentWorldType);
123 TemplateMap::iterator result = templates.find(info); 123 TemplateMap::iterator result = templates.find(info);
124 if (result != templates.end()) 124 if (result != templates.end())
125 return result->value.newLocal(m_isolate); 125 return result->value.newLocal(m_isolate);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // obscure and unlikely to be a problem. 161 // obscure and unlikely to be a problem.
162 v8::Handle<v8::Value> value = args.Callee()->Get(v8::String::NewSymbol("toSt ring")); 162 v8::Handle<v8::Value> value = args.Callee()->Get(v8::String::NewSymbol("toSt ring"));
163 if (!value->IsFunction()) { 163 if (!value->IsFunction()) {
164 v8SetReturnValue(args, v8::String::Empty(args.GetIsolate())); 164 v8SetReturnValue(args, v8::String::Empty(args.GetIsolate()));
165 return; 165 return;
166 } 166 }
167 v8SetReturnValue(args, V8ScriptRunner::callInternalFunction(v8::Handle<v8::F unction>::Cast(value), args.This(), 0, 0, v8::Isolate::GetCurrent())); 167 v8SetReturnValue(args, V8ScriptRunner::callInternalFunction(v8::Handle<v8::F unction>::Cast(value), args.This(), 0, 0, v8::Isolate::GetCurrent()));
168 } 168 }
169 169
170 } // namespace WebCore 170 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698