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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 { | 77 { |
78 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 78 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
79 v8::CpuProfiler* profiler = isolate->GetCpuProfiler(); | 79 v8::CpuProfiler* profiler = isolate->GetCpuProfiler(); |
80 if (!profiler) | 80 if (!profiler) |
81 return 0; | 81 return 0; |
82 v8::HandleScope handleScope(isolate); | 82 v8::HandleScope handleScope(isolate); |
83 const v8::CpuProfile* profile = profiler->StopCpuProfiling(v8String(isolate,
title)); | 83 const v8::CpuProfile* profile = profiler->StopCpuProfiling(v8String(isolate,
title)); |
84 if (!profile) | 84 if (!profile) |
85 return 0; | 85 return 0; |
86 | 86 |
87 String profileTitle = toWebCoreString(profile->GetTitle()); | 87 String profileTitle = toCoreString(profile->GetTitle()); |
88 double idleTime = 0.0; | 88 double idleTime = 0.0; |
89 ProfileNameIdleTimeMap* profileNameIdleTimeMap = ScriptProfiler::currentProf
ileNameIdleTimeMap(); | 89 ProfileNameIdleTimeMap* profileNameIdleTimeMap = ScriptProfiler::currentProf
ileNameIdleTimeMap(); |
90 ProfileNameIdleTimeMap::iterator profileIdleTime = profileNameIdleTimeMap->f
ind(profileTitle); | 90 ProfileNameIdleTimeMap::iterator profileIdleTime = profileNameIdleTimeMap->f
ind(profileTitle); |
91 if (profileIdleTime != profileNameIdleTimeMap->end()) { | 91 if (profileIdleTime != profileNameIdleTimeMap->end()) { |
92 idleTime = profileIdleTime->value * 1000.0; | 92 idleTime = profileIdleTime->value * 1000.0; |
93 profileNameIdleTimeMap->remove(profileIdleTime); | 93 profileNameIdleTimeMap->remove(profileIdleTime); |
94 } | 94 } |
95 | 95 |
96 return ScriptProfile::create(profile, idleTime); | 96 return ScriptProfile::create(profile, idleTime); |
97 } | 97 } |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 } | 312 } |
313 | 313 |
314 void ScriptProfiler::setIdle(bool isIdle) | 314 void ScriptProfiler::setIdle(bool isIdle) |
315 { | 315 { |
316 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 316 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
317 if (v8::CpuProfiler* profiler = isolate->GetCpuProfiler()) | 317 if (v8::CpuProfiler* profiler = isolate->GetCpuProfiler()) |
318 profiler->SetIdle(isIdle); | 318 profiler->SetIdle(isIdle); |
319 } | 319 } |
320 | 320 |
321 } // namespace WebCore | 321 } // namespace WebCore |
OLD | NEW |