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

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

Issue 138643003: Simpler return value of HashTable::add/HashMap:add and others (Closed)
Patch Set: Daily master update (now with base url?) 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
« no previous file with comments | « Source/core/html/forms/FormController.cpp ('k') | Source/core/inspector/DOMPatchSupport.cpp » ('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) 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 ASSERT(executionContext()); 73 ASSERT(executionContext());
74 ExecutionContextData* self = m_tracker->m_executionContextDataMap.take(e xecutionContext()); 74 ExecutionContextData* self = m_tracker->m_executionContextDataMap.take(e xecutionContext());
75 ASSERT(self == this); 75 ASSERT(self == this);
76 ContextLifecycleObserver::contextDestroyed(); 76 ContextLifecycleObserver::contextDestroyed();
77 delete self; 77 delete self;
78 } 78 }
79 79
80 void addEventListenerData(EventTarget* eventTarget, const AtomicString& even tType, const EventListenerAsyncCallChain& item) 80 void addEventListenerData(EventTarget* eventTarget, const AtomicString& even tType, const EventListenerAsyncCallChain& item)
81 { 81 {
82 HashMap<EventTarget*, EventListenerAsyncCallChainVectorHashMap>::iterato r it = m_eventTargetCallChains.find(eventTarget); 82 HashMap<EventTarget*, EventListenerAsyncCallChainVectorHashMap>::iterato r it = m_eventTargetCallChains.find(eventTarget);
83 EventListenerAsyncCallChainVectorHashMap* mapPtr;
83 if (it == m_eventTargetCallChains.end()) 84 if (it == m_eventTargetCallChains.end())
84 it = m_eventTargetCallChains.set(eventTarget, EventListenerAsyncCall ChainVectorHashMap()).iterator; 85 mapPtr = &m_eventTargetCallChains.set(eventTarget, EventListenerAsyn cCallChainVectorHashMap()).storedValue->value;
85 EventListenerAsyncCallChainVectorHashMap& map = it->value; 86 else
87 mapPtr = &it->value;
88 EventListenerAsyncCallChainVectorHashMap& map = *mapPtr;
86 EventListenerAsyncCallChainVectorHashMap::iterator it2 = map.find(eventT ype); 89 EventListenerAsyncCallChainVectorHashMap::iterator it2 = map.find(eventT ype);
87 if (it2 == map.end()) 90 if (it2 == map.end())
88 it2 = map.set(eventType, EventListenerAsyncCallChainVector()).iterat or; 91 map.set(eventType, EventListenerAsyncCallChainVector()).storedValue- >value.append(item);
89 it2->value.append(item); 92 else
93 it2->value.append(item);
90 } 94 }
91 95
92 void removeEventListenerData(EventTarget* eventTarget, const AtomicString& e ventType, const RegisteredEventListener& item) 96 void removeEventListenerData(EventTarget* eventTarget, const AtomicString& e ventType, const RegisteredEventListener& item)
93 { 97 {
94 findEventListenerData(eventTarget, eventType, item, true); 98 findEventListenerData(eventTarget, eventType, item, true);
95 } 99 }
96 100
97 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)
98 { 102 {
99 HashMap<EventTarget*, EventListenerAsyncCallChainVectorHashMap>::iterato r it = m_eventTargetCallChains.find(eventTarget); 103 HashMap<EventTarget*, EventListenerAsyncCallChainVectorHashMap>::iterato r it = m_eventTargetCallChains.find(eventTarget);
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 { 452 {
449 m_currentAsyncCallChain.clear(); 453 m_currentAsyncCallChain.clear();
450 m_nestedAsyncCallCount = 0; 454 m_nestedAsyncCallCount = 0;
451 ExecutionContextDataMap copy; 455 ExecutionContextDataMap copy;
452 m_executionContextDataMap.swap(copy); 456 m_executionContextDataMap.swap(copy);
453 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)
454 delete it->value; 458 delete it->value;
455 } 459 }
456 460
457 } // namespace WebCore 461 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/forms/FormController.cpp ('k') | Source/core/inspector/DOMPatchSupport.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698