| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 void ScriptProfiler::clearHeapObjectIds() | 135 void ScriptProfiler::clearHeapObjectIds() |
| 136 { | 136 { |
| 137 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 137 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 138 v8::HeapProfiler* profiler = isolate->GetHeapProfiler(); | 138 v8::HeapProfiler* profiler = isolate->GetHeapProfiler(); |
| 139 profiler->ClearObjectIds(); | 139 profiler->ClearObjectIds(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 namespace { | 142 namespace { |
| 143 | 143 |
| 144 class ActivityControlAdapter : public v8::ActivityControl { | 144 class ActivityControlAdapter FINAL : public v8::ActivityControl { |
| 145 public: | 145 public: |
| 146 ActivityControlAdapter(ScriptProfiler::HeapSnapshotProgress* progress) | 146 ActivityControlAdapter(ScriptProfiler::HeapSnapshotProgress* progress) |
| 147 : m_progress(progress), m_firstReport(true) { } | 147 : m_progress(progress), m_firstReport(true) { } |
| 148 ControlOption ReportProgressValue(int done, int total) | 148 virtual ControlOption ReportProgressValue(int done, int total) OVERRIDE |
| 149 { | 149 { |
| 150 ControlOption result = m_progress->isCanceled() ? kAbort : kContinue; | 150 ControlOption result = m_progress->isCanceled() ? kAbort : kContinue; |
| 151 if (m_firstReport) { | 151 if (m_firstReport) { |
| 152 m_firstReport = false; | 152 m_firstReport = false; |
| 153 m_progress->Start(total); | 153 m_progress->Start(total); |
| 154 } else | 154 } else |
| 155 m_progress->Worked(done); | 155 m_progress->Worked(done); |
| 156 if (done >= total) | 156 if (done >= total) |
| 157 m_progress->Done(); | 157 m_progress->Done(); |
| 158 return result; | 158 return result; |
| 159 } | 159 } |
| 160 private: | 160 private: |
| 161 ScriptProfiler::HeapSnapshotProgress* m_progress; | 161 ScriptProfiler::HeapSnapshotProgress* m_progress; |
| 162 bool m_firstReport; | 162 bool m_firstReport; |
| 163 }; | 163 }; |
| 164 | 164 |
| 165 class GlobalObjectNameResolver : public v8::HeapProfiler::ObjectNameResolver { | 165 class GlobalObjectNameResolver FINAL : public v8::HeapProfiler::ObjectNameResolv
er { |
| 166 public: | 166 public: |
| 167 virtual const char* GetName(v8::Handle<v8::Object> object) | 167 virtual const char* GetName(v8::Handle<v8::Object> object) OVERRIDE |
| 168 { | 168 { |
| 169 if (V8DOMWrapper::isWrapperOfType(object, &V8Window::wrapperTypeInfo)) { | 169 if (V8DOMWrapper::isWrapperOfType(object, &V8Window::wrapperTypeInfo)) { |
| 170 DOMWindow* window = V8Window::toNative(object); | 170 DOMWindow* window = V8Window::toNative(object); |
| 171 if (window) { | 171 if (window) { |
| 172 CString url = window->document()->url().string().utf8(); | 172 CString url = window->document()->url().string().utf8(); |
| 173 m_strings.append(url); | 173 m_strings.append(url); |
| 174 return url.data(); | 174 return url.data(); |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 return 0; | 177 return 0; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 } | 305 } |
| 306 | 306 |
| 307 void ScriptProfiler::setIdle(bool isIdle) | 307 void ScriptProfiler::setIdle(bool isIdle) |
| 308 { | 308 { |
| 309 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 309 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 310 if (v8::CpuProfiler* profiler = isolate->GetCpuProfiler()) | 310 if (v8::CpuProfiler* profiler = isolate->GetCpuProfiler()) |
| 311 profiler->SetIdle(isIdle); | 311 profiler->SetIdle(isIdle); |
| 312 } | 312 } |
| 313 | 313 |
| 314 } // namespace WebCore | 314 } // namespace WebCore |
| OLD | NEW |