| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, 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 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 namespace WebCore { | 39 namespace WebCore { |
| 40 | 40 |
| 41 ScriptProfile::~ScriptProfile() | 41 ScriptProfile::~ScriptProfile() |
| 42 { | 42 { |
| 43 const_cast<v8::CpuProfile*>(m_profile)->Delete(); | 43 const_cast<v8::CpuProfile*>(m_profile)->Delete(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 String ScriptProfile::title() const | 46 String ScriptProfile::title() const |
| 47 { | 47 { |
| 48 v8::HandleScope scope; | 48 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| 49 return toWebCoreString(m_profile->GetTitle()); | 49 return toWebCoreString(m_profile->GetTitle()); |
| 50 } | 50 } |
| 51 | 51 |
| 52 unsigned int ScriptProfile::uid() const | 52 unsigned int ScriptProfile::uid() const |
| 53 { | 53 { |
| 54 return m_profile->GetUid(); | 54 return m_profile->GetUid(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 double ScriptProfile::idleTime() const | 57 double ScriptProfile::idleTime() const |
| 58 { | 58 { |
| 59 return m_idleTime; | 59 return m_idleTime; |
| 60 } | 60 } |
| 61 | 61 |
| 62 double ScriptProfile::startTime() const | 62 double ScriptProfile::startTime() const |
| 63 { | 63 { |
| 64 return static_cast<double>(m_profile->GetStartTime()) / 1000000; | 64 return static_cast<double>(m_profile->GetStartTime()) / 1000000; |
| 65 } | 65 } |
| 66 | 66 |
| 67 double ScriptProfile::endTime() const | 67 double ScriptProfile::endTime() const |
| 68 { | 68 { |
| 69 return static_cast<double>(m_profile->GetEndTime()) / 1000000; | 69 return static_cast<double>(m_profile->GetEndTime()) / 1000000; |
| 70 } | 70 } |
| 71 | 71 |
| 72 static PassRefPtr<TypeBuilder::Profiler::CPUProfileNode> buildInspectorObjectFor
(const v8::CpuProfileNode* node) | 72 static PassRefPtr<TypeBuilder::Profiler::CPUProfileNode> buildInspectorObjectFor
(const v8::CpuProfileNode* node) |
| 73 { | 73 { |
| 74 v8::HandleScope handleScope; | 74 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); |
| 75 | 75 |
| 76 RefPtr<TypeBuilder::Array<TypeBuilder::Profiler::CPUProfileNode> > children
= TypeBuilder::Array<TypeBuilder::Profiler::CPUProfileNode>::create(); | 76 RefPtr<TypeBuilder::Array<TypeBuilder::Profiler::CPUProfileNode> > children
= TypeBuilder::Array<TypeBuilder::Profiler::CPUProfileNode>::create(); |
| 77 const int childrenCount = node->GetChildrenCount(); | 77 const int childrenCount = node->GetChildrenCount(); |
| 78 for (int i = 0; i < childrenCount; i++) { | 78 for (int i = 0; i < childrenCount; i++) { |
| 79 const v8::CpuProfileNode* child = node->GetChild(i); | 79 const v8::CpuProfileNode* child = node->GetChild(i); |
| 80 children->addItem(buildInspectorObjectFor(child)); | 80 children->addItem(buildInspectorObjectFor(child)); |
| 81 } | 81 } |
| 82 | 82 |
| 83 RefPtr<TypeBuilder::Profiler::CPUProfileNode> result = TypeBuilder::Profiler
::CPUProfileNode::create() | 83 RefPtr<TypeBuilder::Profiler::CPUProfileNode> result = TypeBuilder::Profiler
::CPUProfileNode::create() |
| 84 .setFunctionName(toWebCoreString(node->GetFunctionName())) | 84 .setFunctionName(toWebCoreString(node->GetFunctionName())) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 101 { | 101 { |
| 102 RefPtr<TypeBuilder::Array<int> > array = TypeBuilder::Array<int>::create(); | 102 RefPtr<TypeBuilder::Array<int> > array = TypeBuilder::Array<int>::create(); |
| 103 int count = m_profile->GetSamplesCount(); | 103 int count = m_profile->GetSamplesCount(); |
| 104 for (int i = 0; i < count; i++) | 104 for (int i = 0; i < count; i++) |
| 105 array->addItem(m_profile->GetSample(i)->GetNodeId()); | 105 array->addItem(m_profile->GetSample(i)->GetNodeId()); |
| 106 return array.release(); | 106 return array.release(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 | 109 |
| 110 } // namespace WebCore | 110 } // namespace WebCore |
| OLD | NEW |