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

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

Issue 1111163003: Replace v8::Handle<> with v8::Local<> in bindings/core/v8/* (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « Source/bindings/core/v8/V8PerIsolateData.h ('k') | Source/bindings/core/v8/V8StringResource.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 delete data; 154 delete data;
155 } 155 }
156 156
157 V8PerIsolateData::DOMTemplateMap& V8PerIsolateData::currentDOMTemplateMap() 157 V8PerIsolateData::DOMTemplateMap& V8PerIsolateData::currentDOMTemplateMap()
158 { 158 {
159 if (DOMWrapperWorld::current(isolate()).isMainWorld()) 159 if (DOMWrapperWorld::current(isolate()).isMainWorld())
160 return m_domTemplateMapForMainWorld; 160 return m_domTemplateMapForMainWorld;
161 return m_domTemplateMapForNonMainWorld; 161 return m_domTemplateMapForNonMainWorld;
162 } 162 }
163 163
164 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::domTemplate(const void* domTe mplateKey, v8::FunctionCallback callback, v8::Handle<v8::Value> data, v8::Handle <v8::Signature> signature, int length) 164 v8::Local<v8::FunctionTemplate> V8PerIsolateData::domTemplate(const void* domTem plateKey, v8::FunctionCallback callback, v8::Local<v8::Value> data, v8::Local<v8 ::Signature> signature, int length)
165 { 165 {
166 DOMTemplateMap& domTemplateMap = currentDOMTemplateMap(); 166 DOMTemplateMap& domTemplateMap = currentDOMTemplateMap();
167 DOMTemplateMap::iterator result = domTemplateMap.find(domTemplateKey); 167 DOMTemplateMap::iterator result = domTemplateMap.find(domTemplateKey);
168 if (result != domTemplateMap.end()) 168 if (result != domTemplateMap.end())
169 return result->value.Get(isolate()); 169 return result->value.Get(isolate());
170 170
171 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate(), callback, data, signature, length); 171 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate(), callback, data, signature, length);
172 domTemplateMap.add(domTemplateKey, v8::Eternal<v8::FunctionTemplate>(isolate (), templ)); 172 domTemplateMap.add(domTemplateKey, v8::Eternal<v8::FunctionTemplate>(isolate (), templ));
173 return templ; 173 return templ;
174 } 174 }
175 175
176 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::existingDOMTemplate(const voi d* domTemplateKey) 176 v8::Local<v8::FunctionTemplate> V8PerIsolateData::existingDOMTemplate(const void * domTemplateKey)
177 { 177 {
178 DOMTemplateMap& domTemplateMap = currentDOMTemplateMap(); 178 DOMTemplateMap& domTemplateMap = currentDOMTemplateMap();
179 DOMTemplateMap::iterator result = domTemplateMap.find(domTemplateKey); 179 DOMTemplateMap::iterator result = domTemplateMap.find(domTemplateKey);
180 if (result != domTemplateMap.end()) 180 if (result != domTemplateMap.end())
181 return result->value.Get(isolate()); 181 return result->value.Get(isolate());
182 return v8::Local<v8::FunctionTemplate>(); 182 return v8::Local<v8::FunctionTemplate>();
183 } 183 }
184 184
185 void V8PerIsolateData::setDOMTemplate(const void* domTemplateKey, v8::Handle<v8: :FunctionTemplate> templ) 185 void V8PerIsolateData::setDOMTemplate(const void* domTemplateKey, v8::Local<v8:: FunctionTemplate> templ)
186 { 186 {
187 currentDOMTemplateMap().add(domTemplateKey, v8::Eternal<v8::FunctionTemplate >(isolate(), v8::Local<v8::FunctionTemplate>(templ))); 187 currentDOMTemplateMap().add(domTemplateKey, v8::Eternal<v8::FunctionTemplate >(isolate(), v8::Local<v8::FunctionTemplate>(templ)));
188 } 188 }
189 189
190 v8::Local<v8::Context> V8PerIsolateData::ensureScriptRegexpContext() 190 v8::Local<v8::Context> V8PerIsolateData::ensureScriptRegexpContext()
191 { 191 {
192 if (!m_scriptRegexpScriptState) { 192 if (!m_scriptRegexpScriptState) {
193 v8::Local<v8::Context> context(v8::Context::New(isolate())); 193 v8::Local<v8::Context> context(v8::Context::New(isolate()));
194 m_scriptRegexpScriptState = ScriptState::create(context, DOMWrapperWorld ::create(isolate())); 194 m_scriptRegexpScriptState = ScriptState::create(context, DOMWrapperWorld ::create(isolate()));
195 } 195 }
196 return m_scriptRegexpScriptState->context(); 196 return m_scriptRegexpScriptState->context();
197 } 197 }
198 198
199 bool V8PerIsolateData::hasInstance(const WrapperTypeInfo* untrustedWrapperTypeIn fo, v8::Handle<v8::Value> value) 199 bool V8PerIsolateData::hasInstance(const WrapperTypeInfo* untrustedWrapperTypeIn fo, v8::Local<v8::Value> value)
200 { 200 {
201 return hasInstance(untrustedWrapperTypeInfo, value, m_domTemplateMapForMainW orld) 201 return hasInstance(untrustedWrapperTypeInfo, value, m_domTemplateMapForMainW orld)
202 || hasInstance(untrustedWrapperTypeInfo, value, m_domTemplateMapForNonMa inWorld); 202 || hasInstance(untrustedWrapperTypeInfo, value, m_domTemplateMapForNonMa inWorld);
203 } 203 }
204 204
205 bool V8PerIsolateData::hasInstance(const WrapperTypeInfo* untrustedWrapperTypeIn fo, v8::Handle<v8::Value> value, DOMTemplateMap& domTemplateMap) 205 bool V8PerIsolateData::hasInstance(const WrapperTypeInfo* untrustedWrapperTypeIn fo, v8::Local<v8::Value> value, DOMTemplateMap& domTemplateMap)
206 { 206 {
207 DOMTemplateMap::iterator result = domTemplateMap.find(untrustedWrapperTypeIn fo); 207 DOMTemplateMap::iterator result = domTemplateMap.find(untrustedWrapperTypeIn fo);
208 if (result == domTemplateMap.end()) 208 if (result == domTemplateMap.end())
209 return false; 209 return false;
210 v8::Handle<v8::FunctionTemplate> templ = result->value.Get(isolate()); 210 v8::Local<v8::FunctionTemplate> templ = result->value.Get(isolate());
211 return templ->HasInstance(value); 211 return templ->HasInstance(value);
212 } 212 }
213 213
214 v8::Local<v8::Object> V8PerIsolateData::findInstanceInPrototypeChain(const Wrapp erTypeInfo* info, v8::Local<v8::Value> value) 214 v8::Local<v8::Object> V8PerIsolateData::findInstanceInPrototypeChain(const Wrapp erTypeInfo* info, v8::Local<v8::Value> value)
215 { 215 {
216 v8::Local<v8::Object> wrapper = findInstanceInPrototypeChain(info, value, m_ domTemplateMapForMainWorld); 216 v8::Local<v8::Object> wrapper = findInstanceInPrototypeChain(info, value, m_ domTemplateMapForMainWorld);
217 if (!wrapper.IsEmpty()) 217 if (!wrapper.IsEmpty())
218 return wrapper; 218 return wrapper;
219 return findInstanceInPrototypeChain(info, value, m_domTemplateMapForNonMainW orld); 219 return findInstanceInPrototypeChain(info, value, m_domTemplateMapForNonMainW orld);
220 } 220 }
(...skipping 19 matching lines...) Expand all
240 // changes to a DOM constructor's toString's toString will cause the 240 // changes to a DOM constructor's toString's toString will cause the
241 // toString of the DOM constructor itself to change. This is extremely 241 // toString of the DOM constructor itself to change. This is extremely
242 // obscure and unlikely to be a problem. 242 // obscure and unlikely to be a problem.
243 v8::Isolate* isolate = info.GetIsolate(); 243 v8::Isolate* isolate = info.GetIsolate();
244 v8::Local<v8::Value> value; 244 v8::Local<v8::Value> value;
245 if (!info.Callee()->Get(isolate->GetCurrentContext(), v8AtomicString(isolate , "toString")).ToLocal(&value) || !value->IsFunction()) { 245 if (!info.Callee()->Get(isolate->GetCurrentContext(), v8AtomicString(isolate , "toString")).ToLocal(&value) || !value->IsFunction()) {
246 v8SetReturnValue(info, v8::String::Empty(isolate)); 246 v8SetReturnValue(info, v8::String::Empty(isolate));
247 return; 247 return;
248 } 248 }
249 v8::Local<v8::Value> result; 249 v8::Local<v8::Value> result;
250 if (V8ScriptRunner::callInternalFunction(v8::Handle<v8::Function>::Cast(valu e), info.This(), 0, 0, isolate).ToLocal(&result)) 250 if (V8ScriptRunner::callInternalFunction(v8::Local<v8::Function>::Cast(value ), info.This(), 0, 0, isolate).ToLocal(&result))
251 v8SetReturnValue(info, result); 251 v8SetReturnValue(info, result);
252 } 252 }
253 253
254 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::toStringTemplate() 254 v8::Local<v8::FunctionTemplate> V8PerIsolateData::toStringTemplate()
255 { 255 {
256 if (m_toStringTemplate.isEmpty()) 256 if (m_toStringTemplate.isEmpty())
257 m_toStringTemplate.set(isolate(), v8::FunctionTemplate::New(isolate(), c onstructorOfToString)); 257 m_toStringTemplate.set(isolate(), v8::FunctionTemplate::New(isolate(), c onstructorOfToString));
258 return m_toStringTemplate.newLocal(isolate()); 258 return m_toStringTemplate.newLocal(isolate());
259 } 259 }
260 260
261 void V8PerIsolateData::addEndOfScopeTask(PassOwnPtr<EndOfScopeTask> task) 261 void V8PerIsolateData::addEndOfScopeTask(PassOwnPtr<EndOfScopeTask> task)
262 { 262 {
263 m_endOfScopeTasks.append(task); 263 m_endOfScopeTasks.append(task);
264 } 264 }
(...skipping 12 matching lines...) Expand all
277 m_endOfScopeTasks.clear(); 277 m_endOfScopeTasks.clear();
278 } 278 }
279 279
280 void V8PerIsolateData::setScriptDebugServer(PassOwnPtrWillBeRawPtr<ScriptDebugSe rver> server) 280 void V8PerIsolateData::setScriptDebugServer(PassOwnPtrWillBeRawPtr<ScriptDebugSe rver> server)
281 { 281 {
282 ASSERT(!m_debugServer); 282 ASSERT(!m_debugServer);
283 m_debugServer = server; 283 m_debugServer = server;
284 } 284 }
285 285
286 } // namespace blink 286 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8PerIsolateData.h ('k') | Source/bindings/core/v8/V8StringResource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698