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

Side by Side Diff: Source/core/inspector/AsyncCallStackTracker.cpp

Issue 170603003: Use nullptr_t for RefPtr, PassRefPtr and RawPtr. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Final rebase Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 void removeEventListenerData(EventTarget* eventTarget, const AtomicString& e ventType, const RegisteredEventListener& item) 96 void removeEventListenerData(EventTarget* eventTarget, const AtomicString& e ventType, const RegisteredEventListener& item)
97 { 97 {
98 findEventListenerData(eventTarget, eventType, item, true); 98 findEventListenerData(eventTarget, eventType, item, true);
99 } 99 }
100 100
101 PassRefPtr<AsyncCallChain> findEventListenerData(EventTarget* eventTarget, c onst AtomicString& eventType, const RegisteredEventListener& item, bool remove = false) 101 PassRefPtr<AsyncCallChain> findEventListenerData(EventTarget* eventTarget, c onst AtomicString& eventType, const RegisteredEventListener& item, bool remove = false)
102 { 102 {
103 HashMap<EventTarget*, EventListenerAsyncCallChainVectorHashMap>::iterato r it = m_eventTargetCallChains.find(eventTarget); 103 HashMap<EventTarget*, EventListenerAsyncCallChainVectorHashMap>::iterato r it = m_eventTargetCallChains.find(eventTarget);
104 if (it == m_eventTargetCallChains.end()) 104 if (it == m_eventTargetCallChains.end())
105 return 0; 105 return nullptr;
106 EventListenerAsyncCallChainVectorHashMap& map = it->value; 106 EventListenerAsyncCallChainVectorHashMap& map = it->value;
107 EventListenerAsyncCallChainVectorHashMap::iterator it2 = map.find(eventT ype); 107 EventListenerAsyncCallChainVectorHashMap::iterator it2 = map.find(eventT ype);
108 if (it2 == map.end()) 108 if (it2 == map.end())
109 return 0; 109 return nullptr;
110 RefPtr<AsyncCallChain> result; 110 RefPtr<AsyncCallChain> result;
111 EventListenerAsyncCallChainVector& vector = it2->value; 111 EventListenerAsyncCallChainVector& vector = it2->value;
112 for (size_t i = 0; i < vector.size(); ++i) { 112 for (size_t i = 0; i < vector.size(); ++i) {
113 if (vector[i].first == item) { 113 if (vector[i].first == item) {
114 result = vector[i].second; 114 result = vector[i].second;
115 if (remove) { 115 if (remove) {
116 vector.remove(i); 116 vector.remove(i);
117 if (vector.isEmpty()) 117 if (vector.isEmpty())
118 map.remove(it2); 118 map.remove(it2);
119 if (map.isEmpty()) 119 if (map.isEmpty())
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 ASSERT(context); 209 ASSERT(context);
210 ASSERT(isEnabled()); 210 ASSERT(isEnabled());
211 ASSERT(timerId > 0); 211 ASSERT(timerId > 0);
212 ASSERT(!m_currentAsyncCallChain); 212 ASSERT(!m_currentAsyncCallChain);
213 if (ExecutionContextData* data = m_executionContextDataMap.get(context)) { 213 if (ExecutionContextData* data = m_executionContextDataMap.get(context)) {
214 if (data->m_intervalTimerIds.contains(timerId)) 214 if (data->m_intervalTimerIds.contains(timerId))
215 setCurrentAsyncCallChain(data->m_timerCallChains.get(timerId)); 215 setCurrentAsyncCallChain(data->m_timerCallChains.get(timerId));
216 else 216 else
217 setCurrentAsyncCallChain(data->m_timerCallChains.take(timerId)); 217 setCurrentAsyncCallChain(data->m_timerCallChains.take(timerId));
218 } else { 218 } else {
219 setCurrentAsyncCallChain(0); 219 setCurrentAsyncCallChain(nullptr);
220 } 220 }
221 } 221 }
222 222
223 void AsyncCallStackTracker::didRequestAnimationFrame(ExecutionContext* context, int callbackId, const ScriptValue& callFrames) 223 void AsyncCallStackTracker::didRequestAnimationFrame(ExecutionContext* context, int callbackId, const ScriptValue& callFrames)
224 { 224 {
225 ASSERT(context); 225 ASSERT(context);
226 ASSERT(isEnabled()); 226 ASSERT(isEnabled());
227 if (!validateCallFrames(callFrames)) 227 if (!validateCallFrames(callFrames))
228 return; 228 return;
229 ASSERT(callbackId > 0); 229 ASSERT(callbackId > 0);
(...skipping 13 matching lines...) Expand all
243 243
244 void AsyncCallStackTracker::willFireAnimationFrame(ExecutionContext* context, in t callbackId) 244 void AsyncCallStackTracker::willFireAnimationFrame(ExecutionContext* context, in t callbackId)
245 { 245 {
246 ASSERT(context); 246 ASSERT(context);
247 ASSERT(isEnabled()); 247 ASSERT(isEnabled());
248 ASSERT(callbackId > 0); 248 ASSERT(callbackId > 0);
249 ASSERT(!m_currentAsyncCallChain); 249 ASSERT(!m_currentAsyncCallChain);
250 if (ExecutionContextData* data = m_executionContextDataMap.get(context)) 250 if (ExecutionContextData* data = m_executionContextDataMap.get(context))
251 setCurrentAsyncCallChain(data->m_animationFrameCallChains.take(callbackI d)); 251 setCurrentAsyncCallChain(data->m_animationFrameCallChains.take(callbackI d));
252 else 252 else
253 setCurrentAsyncCallChain(0); 253 setCurrentAsyncCallChain(nullptr);
254 } 254 }
255 255
256 void AsyncCallStackTracker::didAddEventListener(EventTarget* eventTarget, const AtomicString& eventType, EventListener* listener, bool useCapture, const ScriptV alue& callFrames) 256 void AsyncCallStackTracker::didAddEventListener(EventTarget* eventTarget, const AtomicString& eventType, EventListener* listener, bool useCapture, const ScriptV alue& callFrames)
257 { 257 {
258 ASSERT(eventTarget->executionContext()); 258 ASSERT(eventTarget->executionContext());
259 ASSERT(isEnabled()); 259 ASSERT(isEnabled());
260 if (!validateCallFrames(callFrames) || toXmlHttpRequest(eventTarget)) 260 if (!validateCallFrames(callFrames) || toXmlHttpRequest(eventTarget))
261 return; 261 return;
262 262
263 StringBuilder description; 263 StringBuilder description;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 { 297 {
298 ASSERT(eventTarget->executionContext()); 298 ASSERT(eventTarget->executionContext());
299 ASSERT(isEnabled()); 299 ASSERT(isEnabled());
300 if (XMLHttpRequest* xhr = toXmlHttpRequest(eventTarget)) { 300 if (XMLHttpRequest* xhr = toXmlHttpRequest(eventTarget)) {
301 willHandleXHREvent(xhr, eventTarget, eventType); 301 willHandleXHREvent(xhr, eventTarget, eventType);
302 return; 302 return;
303 } 303 }
304 if (ExecutionContextData* data = m_executionContextDataMap.get(eventTarget-> executionContext())) 304 if (ExecutionContextData* data = m_executionContextDataMap.get(eventTarget-> executionContext()))
305 setCurrentAsyncCallChain(data->findEventListenerData(eventTarget, eventT ype, RegisteredEventListener(listener, useCapture))); 305 setCurrentAsyncCallChain(data->findEventListenerData(eventTarget, eventT ype, RegisteredEventListener(listener, useCapture)));
306 else 306 else
307 setCurrentAsyncCallChain(0); 307 setCurrentAsyncCallChain(nullptr);
308 } 308 }
309 309
310 void AsyncCallStackTracker::willLoadXHR(XMLHttpRequest* xhr, const ScriptValue& callFrames) 310 void AsyncCallStackTracker::willLoadXHR(XMLHttpRequest* xhr, const ScriptValue& callFrames)
311 { 311 {
312 ASSERT(xhr->executionContext()); 312 ASSERT(xhr->executionContext());
313 ASSERT(isEnabled()); 313 ASSERT(isEnabled());
314 if (!validateCallFrames(callFrames)) 314 if (!validateCallFrames(callFrames))
315 return; 315 return;
316 ExecutionContextData* data = createContextDataIfNeeded(xhr->executionContext ()); 316 ExecutionContextData* data = createContextDataIfNeeded(xhr->executionContext ());
317 data->m_xhrCallChains.set(xhr, createAsyncCallChain(xhrSendName, callFrames) ); 317 data->m_xhrCallChains.set(xhr, createAsyncCallChain(xhrSendName, callFrames) );
318 } 318 }
319 319
320 void AsyncCallStackTracker::willHandleXHREvent(XMLHttpRequest* xhr, EventTarget* eventTarget, const AtomicString& eventType) 320 void AsyncCallStackTracker::willHandleXHREvent(XMLHttpRequest* xhr, EventTarget* eventTarget, const AtomicString& eventType)
321 { 321 {
322 ASSERT(xhr->executionContext()); 322 ASSERT(xhr->executionContext());
323 ASSERT(isEnabled()); 323 ASSERT(isEnabled());
324 if (ExecutionContextData* data = m_executionContextDataMap.get(xhr->executio nContext())) { 324 if (ExecutionContextData* data = m_executionContextDataMap.get(xhr->executio nContext())) {
325 bool isXHRDownload = (xhr == eventTarget); 325 bool isXHRDownload = (xhr == eventTarget);
326 if (isXHRDownload && eventType == EventTypeNames::loadend) 326 if (isXHRDownload && eventType == EventTypeNames::loadend)
327 setCurrentAsyncCallChain(data->m_xhrCallChains.take(xhr)); 327 setCurrentAsyncCallChain(data->m_xhrCallChains.take(xhr));
328 else 328 else
329 setCurrentAsyncCallChain(data->m_xhrCallChains.get(xhr)); 329 setCurrentAsyncCallChain(data->m_xhrCallChains.get(xhr));
330 } else { 330 } else {
331 setCurrentAsyncCallChain(0); 331 setCurrentAsyncCallChain(nullptr);
332 } 332 }
333 } 333 }
334 334
335 void AsyncCallStackTracker::didEnqueueMutationRecord(ExecutionContext* context, MutationObserver* observer, const ScriptValue& callFrames) 335 void AsyncCallStackTracker::didEnqueueMutationRecord(ExecutionContext* context, MutationObserver* observer, const ScriptValue& callFrames)
336 { 336 {
337 ASSERT(context); 337 ASSERT(context);
338 ASSERT(isEnabled()); 338 ASSERT(isEnabled());
339 if (!validateCallFrames(callFrames)) 339 if (!validateCallFrames(callFrames))
340 return; 340 return;
341 ExecutionContextData* data = createContextDataIfNeeded(context); 341 ExecutionContextData* data = createContextDataIfNeeded(context);
(...skipping 17 matching lines...) Expand all
359 data->m_mutationObserverCallChains.remove(observer); 359 data->m_mutationObserverCallChains.remove(observer);
360 } 360 }
361 361
362 void AsyncCallStackTracker::willDeliverMutationRecords(ExecutionContext* context , MutationObserver* observer) 362 void AsyncCallStackTracker::willDeliverMutationRecords(ExecutionContext* context , MutationObserver* observer)
363 { 363 {
364 ASSERT(context); 364 ASSERT(context);
365 ASSERT(isEnabled()); 365 ASSERT(isEnabled());
366 if (ExecutionContextData* data = m_executionContextDataMap.get(context)) 366 if (ExecutionContextData* data = m_executionContextDataMap.get(context))
367 setCurrentAsyncCallChain(data->m_mutationObserverCallChains.take(observe r)); 367 setCurrentAsyncCallChain(data->m_mutationObserverCallChains.take(observe r));
368 else 368 else
369 setCurrentAsyncCallChain(0); 369 setCurrentAsyncCallChain(nullptr);
370 } 370 }
371 371
372 void AsyncCallStackTracker::didPostPromiseTask(ExecutionContext* context, Execut ionContextTask* task, bool isResolved, const ScriptValue& callFrames) 372 void AsyncCallStackTracker::didPostPromiseTask(ExecutionContext* context, Execut ionContextTask* task, bool isResolved, const ScriptValue& callFrames)
373 { 373 {
374 ASSERT(context); 374 ASSERT(context);
375 ASSERT(isEnabled()); 375 ASSERT(isEnabled());
376 if (validateCallFrames(callFrames)) { 376 if (validateCallFrames(callFrames)) {
377 ExecutionContextData* data = createContextDataIfNeeded(context); 377 ExecutionContextData* data = createContextDataIfNeeded(context);
378 data->m_promiseTaskCallChains.set(task, createAsyncCallChain(isResolved ? promiseResolved : promiseRejected, callFrames)); 378 data->m_promiseTaskCallChains.set(task, createAsyncCallChain(isResolved ? promiseResolved : promiseRejected, callFrames));
379 } else if (m_currentAsyncCallChain) { 379 } else if (m_currentAsyncCallChain) {
380 // Propagate async call stack to the re-posted task to update a derived Promise. 380 // Propagate async call stack to the re-posted task to update a derived Promise.
381 ExecutionContextData* data = createContextDataIfNeeded(context); 381 ExecutionContextData* data = createContextDataIfNeeded(context);
382 data->m_promiseTaskCallChains.set(task, m_currentAsyncCallChain); 382 data->m_promiseTaskCallChains.set(task, m_currentAsyncCallChain);
383 } 383 }
384 } 384 }
385 385
386 void AsyncCallStackTracker::willPerformPromiseTask(ExecutionContext* context, Ex ecutionContextTask* task) 386 void AsyncCallStackTracker::willPerformPromiseTask(ExecutionContext* context, Ex ecutionContextTask* task)
387 { 387 {
388 ASSERT(context); 388 ASSERT(context);
389 ASSERT(isEnabled()); 389 ASSERT(isEnabled());
390 if (ExecutionContextData* data = m_executionContextDataMap.get(context)) 390 if (ExecutionContextData* data = m_executionContextDataMap.get(context))
391 setCurrentAsyncCallChain(data->m_promiseTaskCallChains.take(task)); 391 setCurrentAsyncCallChain(data->m_promiseTaskCallChains.take(task));
392 else 392 else
393 setCurrentAsyncCallChain(0); 393 setCurrentAsyncCallChain(nullptr);
394 } 394 }
395 395
396 void AsyncCallStackTracker::didFireAsyncCall() 396 void AsyncCallStackTracker::didFireAsyncCall()
397 { 397 {
398 clearCurrentAsyncCallChain(); 398 clearCurrentAsyncCallChain();
399 } 399 }
400 400
401 PassRefPtr<AsyncCallStackTracker::AsyncCallChain> AsyncCallStackTracker::createA syncCallChain(const String& description, const ScriptValue& callFrames) 401 PassRefPtr<AsyncCallStackTracker::AsyncCallChain> AsyncCallStackTracker::createA syncCallChain(const String& description, const ScriptValue& callFrames)
402 { 402 {
403 RefPtr<AsyncCallChain> chain = adoptRef(m_currentAsyncCallChain ? new AsyncC allStackTracker::AsyncCallChain(*m_currentAsyncCallChain) : new AsyncCallStackTr acker::AsyncCallChain()); 403 RefPtr<AsyncCallChain> chain = adoptRef(m_currentAsyncCallChain ? new AsyncC allStackTracker::AsyncCallChain(*m_currentAsyncCallChain) : new AsyncCallStackTr acker::AsyncCallChain());
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 { 452 {
453 m_currentAsyncCallChain.clear(); 453 m_currentAsyncCallChain.clear();
454 m_nestedAsyncCallCount = 0; 454 m_nestedAsyncCallCount = 0;
455 ExecutionContextDataMap copy; 455 ExecutionContextDataMap copy;
456 m_executionContextDataMap.swap(copy); 456 m_executionContextDataMap.swap(copy);
457 for (ExecutionContextDataMap::const_iterator it = copy.begin(); it != copy.e nd(); ++it) 457 for (ExecutionContextDataMap::const_iterator it = copy.begin(); it != copy.e nd(); ++it)
458 delete it->value; 458 delete it->value;
459 } 459 }
460 460
461 } // namespace WebCore 461 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/track/vtt/VTTCue.cpp ('k') | Source/core/inspector/CodeGeneratorInspectorStrings.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698