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

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

Issue 638813002: Replace FINAL and OVERRIDE with their C++11 counterparts in Source/bindings (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « Source/bindings/core/v8/ScriptHeapSnapshot.cpp ('k') | Source/bindings/core/v8/ScriptPromise.h » ('j') | 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 void ScriptProfiler::clearHeapObjectIds() 133 void ScriptProfiler::clearHeapObjectIds()
134 { 134 {
135 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 135 v8::Isolate* isolate = v8::Isolate::GetCurrent();
136 v8::HeapProfiler* profiler = isolate->GetHeapProfiler(); 136 v8::HeapProfiler* profiler = isolate->GetHeapProfiler();
137 profiler->ClearObjectIds(); 137 profiler->ClearObjectIds();
138 } 138 }
139 139
140 namespace { 140 namespace {
141 141
142 class ActivityControlAdapter FINAL : public v8::ActivityControl { 142 class ActivityControlAdapter final : public v8::ActivityControl {
143 public: 143 public:
144 ActivityControlAdapter(ScriptProfiler::HeapSnapshotProgress* progress) 144 ActivityControlAdapter(ScriptProfiler::HeapSnapshotProgress* progress)
145 : m_progress(progress), m_firstReport(true) { } 145 : m_progress(progress), m_firstReport(true) { }
146 virtual ControlOption ReportProgressValue(int done, int total) OVERRIDE 146 virtual ControlOption ReportProgressValue(int done, int total) override
147 { 147 {
148 ControlOption result = m_progress->isCanceled() ? kAbort : kContinue; 148 ControlOption result = m_progress->isCanceled() ? kAbort : kContinue;
149 if (m_firstReport) { 149 if (m_firstReport) {
150 m_firstReport = false; 150 m_firstReport = false;
151 m_progress->Start(total); 151 m_progress->Start(total);
152 } else { 152 } else {
153 m_progress->Worked(done); 153 m_progress->Worked(done);
154 } 154 }
155 if (done >= total) 155 if (done >= total)
156 m_progress->Done(); 156 m_progress->Done();
157 return result; 157 return result;
158 } 158 }
159 private: 159 private:
160 ScriptProfiler::HeapSnapshotProgress* m_progress; 160 ScriptProfiler::HeapSnapshotProgress* m_progress;
161 bool m_firstReport; 161 bool m_firstReport;
162 }; 162 };
163 163
164 class GlobalObjectNameResolver FINAL : public v8::HeapProfiler::ObjectNameResolv er { 164 class GlobalObjectNameResolver final : public v8::HeapProfiler::ObjectNameResolv er {
165 public: 165 public:
166 virtual const char* GetName(v8::Handle<v8::Object> object) OVERRIDE 166 virtual const char* GetName(v8::Handle<v8::Object> object) override
167 { 167 {
168 LocalDOMWindow* window = toDOMWindow(object, v8::Isolate::GetCurrent()); 168 LocalDOMWindow* window = toDOMWindow(object, v8::Isolate::GetCurrent());
169 if (!window) 169 if (!window)
170 return 0; 170 return 0;
171 CString url = window->document()->url().string().utf8(); 171 CString url = window->document()->url().string().utf8();
172 m_strings.append(url); 172 m_strings.append(url);
173 return url.data(); 173 return url.data();
174 } 174 }
175 175
176 private: 176 private:
177 Vector<CString> m_strings; 177 Vector<CString> m_strings;
178 }; 178 };
179 179
180 } // namespace 180 } // namespace
181 181
182 void ScriptProfiler::startTrackingHeapObjects(bool trackAllocations) 182 void ScriptProfiler::startTrackingHeapObjects(bool trackAllocations)
183 { 183 {
184 v8::Isolate::GetCurrent()->GetHeapProfiler()->StartTrackingHeapObjects(track Allocations); 184 v8::Isolate::GetCurrent()->GetHeapProfiler()->StartTrackingHeapObjects(track Allocations);
185 } 185 }
186 186
187 namespace { 187 namespace {
188 188
189 class HeapStatsStream : public v8::OutputStream { 189 class HeapStatsStream : public v8::OutputStream {
190 public: 190 public:
191 HeapStatsStream(ScriptProfiler::OutputStream* stream) : m_stream(stream) { } 191 HeapStatsStream(ScriptProfiler::OutputStream* stream) : m_stream(stream) { }
192 virtual void EndOfStream() OVERRIDE { } 192 virtual void EndOfStream() override { }
193 193
194 virtual WriteResult WriteAsciiChunk(char* data, int size) OVERRIDE 194 virtual WriteResult WriteAsciiChunk(char* data, int size) override
195 { 195 {
196 ASSERT(false); 196 ASSERT(false);
197 return kAbort; 197 return kAbort;
198 } 198 }
199 199
200 virtual WriteResult WriteHeapStatsChunk(v8::HeapStatsUpdate* updateData, int count) OVERRIDE 200 virtual WriteResult WriteHeapStatsChunk(v8::HeapStatsUpdate* updateData, int count) override
201 { 201 {
202 Vector<uint32_t> rawData(count * 3); 202 Vector<uint32_t> rawData(count * 3);
203 for (int i = 0; i < count; ++i) { 203 for (int i = 0; i < count; ++i) {
204 int offset = i * 3; 204 int offset = i * 3;
205 rawData[offset] = updateData[i].index; 205 rawData[offset] = updateData[i].index;
206 rawData[offset + 1] = updateData[i].count; 206 rawData[offset + 1] = updateData[i].count;
207 rawData[offset + 2] = updateData[i].size; 207 rawData[offset + 2] = updateData[i].size;
208 } 208 }
209 m_stream->write(rawData.data(), rawData.size()); 209 m_stream->write(rawData.data(), rawData.size());
210 return kContinue; 210 return kContinue;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 v8::HandleScope handleScope(isolate); 267 v8::HandleScope handleScope(isolate);
268 268
269 class DOMNodeWrapperVisitor : public v8::PersistentHandleVisitor { 269 class DOMNodeWrapperVisitor : public v8::PersistentHandleVisitor {
270 public: 270 public:
271 DOMNodeWrapperVisitor(WrappedNodeVisitor* visitor, v8::Isolate* isolate) 271 DOMNodeWrapperVisitor(WrappedNodeVisitor* visitor, v8::Isolate* isolate)
272 : m_visitor(visitor) 272 : m_visitor(visitor)
273 , m_isolate(isolate) 273 , m_isolate(isolate)
274 { 274 {
275 } 275 }
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::toImpl(*wrapper)); 286 m_visitor->visitNode(V8Node::toImpl(*wrapper));
287 } 287 }
(...skipping 13 matching lines...) Expand all
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
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/ScriptHeapSnapshot.cpp ('k') | Source/bindings/core/v8/ScriptPromise.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698