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

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

Issue 800113002: Use C++11 range-based for loop in Source/core/inspector (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: REBASE AGAIN! Created 6 years 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
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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 116 }
117 117
118 void TraceEventDispatcher::removeAllListeners(void* eventTarget, InspectorClient * client) 118 void TraceEventDispatcher::removeAllListeners(void* eventTarget, InspectorClient * client)
119 { 119 {
120 ASSERT(isMainThread()); 120 ASSERT(isMainThread());
121 processBackgroundEvents(); 121 processBackgroundEvents();
122 { 122 {
123 MutexLocker locker(m_mutex); 123 MutexLocker locker(m_mutex);
124 124
125 ListenersMap remainingListeners; 125 ListenersMap remainingListeners;
126 for (ListenersMap::iterator it = m_listeners->begin(); it != m_listeners ->end(); ++it) { 126 for (auto& it : *m_listeners) {
127 WillBeHeapVector<OwnPtrWillBeMember<TraceEventListener> >& listeners = *it->value.get(); 127 WillBeHeapVector<OwnPtrWillBeMember<TraceEventListener> >& listeners = *it.value.get();
128 for (size_t j = 0; j < listeners.size();) { 128 for (size_t j = 0; j < listeners.size();) {
129 if (listeners[j]->target() == eventTarget) 129 if (listeners[j]->target() == eventTarget)
130 listeners.remove(j); 130 listeners.remove(j);
131 else 131 else
132 ++j; 132 ++j;
133 } 133 }
134 if (!listeners.isEmpty()) 134 if (!listeners.isEmpty())
135 remainingListeners.add(it->key, it->value.release()); 135 remainingListeners.add(it.key, it.value.release());
136 } 136 }
137 m_listeners->swap(remainingListeners); 137 m_listeners->swap(remainingListeners);
138 } 138 }
139 if (m_listeners->isEmpty()) 139 if (m_listeners->isEmpty())
140 client->resetTraceEventCallback(); 140 client->resetTraceEventCallback();
141 } 141 }
142 142
143 size_t TraceEventDispatcher::TraceEvent::findParameter(const char* name) const 143 size_t TraceEventDispatcher::TraceEvent::findParameter(const char* name) const
144 { 144 {
145 for (int i = 0; i < m_argumentCount; ++i) { 145 for (int i = 0; i < m_argumentCount; ++i) {
(...skipping 10 matching lines...) Expand all
156 ASSERT(isMainThread()); 156 ASSERT(isMainThread());
157 if (index == kNotFound || m_argumentTypes[index] != expectedType) { 157 if (index == kNotFound || m_argumentTypes[index] != expectedType) {
158 ASSERT_NOT_REACHED(); 158 ASSERT_NOT_REACHED();
159 return missingValue; 159 return missingValue;
160 } 160 }
161 return m_argumentValues[index]; 161 return m_argumentValues[index];
162 } 162 }
163 163
164 } // namespace blink 164 } // namespace blink
165 165
OLDNEW
« Source/core/inspector/InspectorResourceAgent.cpp ('K') | « Source/core/inspector/PromiseTracker.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698