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

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

Issue 16226011: Fix r151732. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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
« no previous file with comments | « no previous file | no next file » | 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) 2011, Google Inc. All rights reserved. 2 * Copyright (c) 2011, 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 v8::HandleScope handleScope(isolate); 272 v8::HandleScope handleScope(isolate);
273 273
274 class DOMNodeWrapperVisitor : public v8::PersistentHandleVisitor { 274 class DOMNodeWrapperVisitor : public v8::PersistentHandleVisitor {
275 public: 275 public:
276 DOMNodeWrapperVisitor(WrappedNodeVisitor* visitor, v8::Isolate* isolate) 276 DOMNodeWrapperVisitor(WrappedNodeVisitor* visitor, v8::Isolate* isolate)
277 : m_visitor(visitor) 277 : m_visitor(visitor)
278 , m_isolate(isolate) 278 , m_isolate(isolate)
279 { 279 {
280 } 280 }
281 281
282 #ifdef V8_USE_OLD_STYLE_PERSISTENT_HANDLE_VISITORS
282 virtual void VisitPersistentHandle(v8::Persistent<v8::Value> value, uint 16_t classId) OVERRIDE 283 virtual void VisitPersistentHandle(v8::Persistent<v8::Value> value, uint 16_t classId) OVERRIDE
283 { 284 {
285 VisitPersistentHandle(&value, classId);
286 }
287
288 virtual void VisitPersistentHandle(v8::Persistent<v8::Value>* value, uin t16_t classId)
289 #else
290 virtual void VisitPersistentHandle(v8::Persistent<v8::Value>* value, uin t16_t classId) OVERRIDE
291 #endif
292 {
284 if (classId != v8DOMNodeClassId) 293 if (classId != v8DOMNodeClassId)
285 return; 294 return;
286 UNUSED_PARAM(m_isolate); 295 UNUSED_PARAM(m_isolate);
287 ASSERT(V8Node::HasInstance(value, m_isolate, worldType(m_isolate))); 296 ASSERT(V8Node::HasInstance(*value, m_isolate, worldType(m_isolate))) ;
288 ASSERT(value->IsObject()); 297 ASSERT((*value)->IsObject());
289 #ifdef V8_USE_UNSAFE_HANDLES 298 #ifdef V8_USE_UNSAFE_HANDLES
290 v8::Persistent<v8::Object> wrapper = v8::Persistent<v8::Object>::Cas t(value); 299 v8::Persistent<v8::Object> wrapper = v8::Persistent<v8::Object>::Cas t(*value);
291 #else 300 #else
292 v8::Persistent<v8::Object>& wrapper = v8::Persistent<v8::Object>::Ca st(value); 301 v8::Persistent<v8::Object>& wrapper = v8::Persistent<v8::Object>::Ca st(*value);
293 #endif 302 #endif
294 m_visitor->visitNode(V8Node::toNative(wrapper)); 303 m_visitor->visitNode(V8Node::toNative(wrapper));
295 } 304 }
296 305
297 private: 306 private:
298 WrappedNodeVisitor* m_visitor; 307 WrappedNodeVisitor* m_visitor;
299 v8::Isolate* m_isolate; 308 v8::Isolate* m_isolate;
300 } wrapperVisitor(visitor, isolate); 309 } wrapperVisitor(visitor, isolate);
301 310
302 v8::V8::VisitHandlesWithClassIds(&wrapperVisitor); 311 v8::V8::VisitHandlesWithClassIds(&wrapperVisitor);
303 } 312 }
304 313
305 void ScriptProfiler::visitExternalStrings(ExternalStringVisitor* visitor) 314 void ScriptProfiler::visitExternalStrings(ExternalStringVisitor* visitor)
306 { 315 {
307 V8PerIsolateData::current()->visitExternalStrings(visitor); 316 V8PerIsolateData::current()->visitExternalStrings(visitor);
308 } 317 }
309 318
310 void ScriptProfiler::visitExternalArrays(ExternalArrayVisitor* visitor) 319 void ScriptProfiler::visitExternalArrays(ExternalArrayVisitor* visitor)
311 { 320 {
312 class DOMObjectWrapperVisitor : public v8::PersistentHandleVisitor { 321 class DOMObjectWrapperVisitor : public v8::PersistentHandleVisitor {
313 public: 322 public:
314 explicit DOMObjectWrapperVisitor(ExternalArrayVisitor* visitor) 323 explicit DOMObjectWrapperVisitor(ExternalArrayVisitor* visitor)
315 : m_visitor(visitor) 324 : m_visitor(visitor)
316 { 325 {
317 } 326 }
318 327
328 #ifdef V8_USE_OLD_STYLE_PERSISTENT_HANDLE_VISITORS
319 virtual void VisitPersistentHandle(v8::Persistent<v8::Value> value, uint 16_t classId) OVERRIDE 329 virtual void VisitPersistentHandle(v8::Persistent<v8::Value> value, uint 16_t classId) OVERRIDE
320 { 330 {
331 VisitPersistentHandle(&value, classId);
332 }
333
334 virtual void VisitPersistentHandle(v8::Persistent<v8::Value>* value, uin t16_t classId)
335 #else
336 virtual void VisitPersistentHandle(v8::Persistent<v8::Value>* value, uin t16_t classId) OVERRIDE
337 #endif
338 {
321 if (classId != v8DOMObjectClassId) 339 if (classId != v8DOMObjectClassId)
322 return; 340 return;
323 ASSERT(value->IsObject()); 341 ASSERT((*value)->IsObject());
324 #ifdef V8_USE_UNSAFE_HANDLES 342 #ifdef V8_USE_UNSAFE_HANDLES
325 v8::Persistent<v8::Object> wrapper = v8::Persistent<v8::Object>::Cas t(value); 343 v8::Persistent<v8::Object> wrapper = v8::Persistent<v8::Object>::Cas t(*value);
326 #else 344 #else
327 v8::Persistent<v8::Object>& wrapper = v8::Persistent<v8::Object>::Ca st(value); 345 v8::Persistent<v8::Object>& wrapper = v8::Persistent<v8::Object>::Ca st(*value);
328 #endif 346 #endif
329 if (!toWrapperTypeInfo(wrapper)->isSubclass(&V8ArrayBufferView::info )) 347 if (!toWrapperTypeInfo(wrapper)->isSubclass(&V8ArrayBufferView::info ))
330 return; 348 return;
331 m_visitor->visitJSExternalArray(V8ArrayBufferView::toNative(wrapper) ); 349 m_visitor->visitJSExternalArray(V8ArrayBufferView::toNative(wrapper) );
332 } 350 }
333 351
334 private: 352 private:
335 ExternalArrayVisitor* m_visitor; 353 ExternalArrayVisitor* m_visitor;
336 } wrapperVisitor(visitor); 354 } wrapperVisitor(visitor);
337 355
(...skipping 15 matching lines...) Expand all
353 return profiler->GetProfilerMemorySize(); 371 return profiler->GetProfilerMemorySize();
354 } 372 }
355 373
356 ProfileNameIdleTimeMap* ScriptProfiler::currentProfileNameIdleTimeMap() 374 ProfileNameIdleTimeMap* ScriptProfiler::currentProfileNameIdleTimeMap()
357 { 375 {
358 AtomicallyInitializedStatic(WTF::ThreadSpecific<ProfileNameIdleTimeMap>*, ma p = new WTF::ThreadSpecific<ProfileNameIdleTimeMap>); 376 AtomicallyInitializedStatic(WTF::ThreadSpecific<ProfileNameIdleTimeMap>*, ma p = new WTF::ThreadSpecific<ProfileNameIdleTimeMap>);
359 return *map; 377 return *map;
360 } 378 }
361 379
362 } // namespace WebCore 380 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698