OLD | NEW |
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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 GlobalObjectNameResolver resolver; | 240 GlobalObjectNameResolver resolver; |
241 const v8::HeapSnapshot* snapshot = profiler->TakeHeapSnapshot(v8String(isola
te, title), &adapter, &resolver); | 241 const v8::HeapSnapshot* snapshot = profiler->TakeHeapSnapshot(v8String(isola
te, title), &adapter, &resolver); |
242 return snapshot ? ScriptHeapSnapshot::create(snapshot) : nullptr; | 242 return snapshot ? ScriptHeapSnapshot::create(snapshot) : nullptr; |
243 } | 243 } |
244 | 244 |
245 static v8::RetainedObjectInfo* retainedDOMInfo(uint16_t classId, v8::Handle<v8::
Value> wrapper) | 245 static v8::RetainedObjectInfo* retainedDOMInfo(uint16_t classId, v8::Handle<v8::
Value> wrapper) |
246 { | 246 { |
247 ASSERT(classId == WrapperTypeInfo::NodeClassId); | 247 ASSERT(classId == WrapperTypeInfo::NodeClassId); |
248 if (!wrapper->IsObject()) | 248 if (!wrapper->IsObject()) |
249 return 0; | 249 return 0; |
250 Node* node = V8Node::toNative(wrapper.As<v8::Object>()); | 250 Node* node = V8Node::toImpl(wrapper.As<v8::Object>()); |
251 return node ? new RetainedDOMInfo(node) : 0; | 251 return node ? new RetainedDOMInfo(node) : 0; |
252 } | 252 } |
253 | 253 |
254 void ScriptProfiler::initialize() | 254 void ScriptProfiler::initialize() |
255 { | 255 { |
256 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 256 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
257 v8::HeapProfiler* profiler = isolate->GetHeapProfiler(); | 257 v8::HeapProfiler* profiler = isolate->GetHeapProfiler(); |
258 if (profiler) | 258 if (profiler) |
259 profiler->SetWrapperClassInfoProvider(WrapperTypeInfo::NodeClassId, &ret
ainedDOMInfo); | 259 profiler->SetWrapperClassInfoProvider(WrapperTypeInfo::NodeClassId, &ret
ainedDOMInfo); |
260 } | 260 } |
(...skipping 15 matching lines...) Expand all Loading... |
276 | 276 |
277 virtual void VisitPersistentHandle(v8::Persistent<v8::Value>* value, uin
t16_t classId) OVERRIDE | 277 virtual void VisitPersistentHandle(v8::Persistent<v8::Value>* value, uin
t16_t classId) OVERRIDE |
278 { | 278 { |
279 if (classId != WrapperTypeInfo::NodeClassId) | 279 if (classId != WrapperTypeInfo::NodeClassId) |
280 return; | 280 return; |
281 // Casting to Handle is safe here, since the Persistent cannot get | 281 // Casting to Handle is safe here, since the Persistent cannot get |
282 // GCd during visiting. | 282 // GCd during visiting. |
283 v8::Handle<v8::Object>* wrapper = reinterpret_cast<v8::Handle<v8::Ob
ject>*>(value); | 283 v8::Handle<v8::Object>* wrapper = reinterpret_cast<v8::Handle<v8::Ob
ject>*>(value); |
284 ASSERT_UNUSED(m_isolate, V8Node::hasInstance(*wrapper, m_isolate)); | 284 ASSERT_UNUSED(m_isolate, V8Node::hasInstance(*wrapper, m_isolate)); |
285 ASSERT((*wrapper)->IsObject()); | 285 ASSERT((*wrapper)->IsObject()); |
286 m_visitor->visitNode(V8Node::toNative(*wrapper)); | 286 m_visitor->visitNode(V8Node::toImpl(*wrapper)); |
287 } | 287 } |
288 | 288 |
289 private: | 289 private: |
290 WrappedNodeVisitor* m_visitor; | 290 WrappedNodeVisitor* m_visitor; |
291 v8::Isolate* m_isolate; | 291 v8::Isolate* m_isolate; |
292 } wrapperVisitor(visitor, isolate); | 292 } wrapperVisitor(visitor, isolate); |
293 | 293 |
294 v8::V8::VisitHandlesWithClassIds(&wrapperVisitor); | 294 v8::V8::VisitHandlesWithClassIds(&wrapperVisitor); |
295 } | 295 } |
296 | 296 |
297 ProfileNameIdleTimeMap* ScriptProfiler::currentProfileNameIdleTimeMap() | 297 ProfileNameIdleTimeMap* ScriptProfiler::currentProfileNameIdleTimeMap() |
298 { | 298 { |
299 AtomicallyInitializedStatic(WTF::ThreadSpecific<ProfileNameIdleTimeMap>*, ma
p = new WTF::ThreadSpecific<ProfileNameIdleTimeMap>); | 299 AtomicallyInitializedStatic(WTF::ThreadSpecific<ProfileNameIdleTimeMap>*, ma
p = new WTF::ThreadSpecific<ProfileNameIdleTimeMap>); |
300 return *map; | 300 return *map; |
301 } | 301 } |
302 | 302 |
303 void ScriptProfiler::setIdle(bool isIdle) | 303 void ScriptProfiler::setIdle(bool isIdle) |
304 { | 304 { |
305 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 305 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
306 if (v8::CpuProfiler* profiler = isolate->GetCpuProfiler()) | 306 if (v8::CpuProfiler* profiler = isolate->GetCpuProfiler()) |
307 profiler->SetIdle(isIdle); | 307 profiler->SetIdle(isIdle); |
308 } | 308 } |
309 | 309 |
310 } // namespace blink | 310 } // namespace blink |
OLD | NEW |