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

Side by Side Diff: Source/core/inspector/TraceEventDispatcher.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/inspector/InspectorTimelineAgent.cpp ('k') | Source/core/page/EventHandler.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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 99 }
100 100
101 void TraceEventDispatcher::innerAddListener(const char* name, char phase, TraceE ventTargetBase* instance, TraceEventHandlerMethod method, InspectorClient* clien t) 101 void TraceEventDispatcher::innerAddListener(const char* name, char phase, TraceE ventTargetBase* instance, TraceEventHandlerMethod method, InspectorClient* clien t)
102 { 102 {
103 ASSERT(isMainThread()); 103 ASSERT(isMainThread());
104 MutexLocker locker(m_mutex); 104 MutexLocker locker(m_mutex);
105 if (m_handlers.isEmpty()) 105 if (m_handlers.isEmpty())
106 client->setTraceEventCallback(dispatchEventOnAnyThread); 106 client->setTraceEventCallback(dispatchEventOnAnyThread);
107 HandlersMap::iterator it = m_handlers.find(std::make_pair(name, phase)); 107 HandlersMap::iterator it = m_handlers.find(std::make_pair(name, phase));
108 if (it == m_handlers.end()) 108 if (it == m_handlers.end())
109 it = m_handlers.add(std::make_pair(name, phase), Vector<BoundTraceEventH andler>()).iterator; 109 m_handlers.add(std::make_pair(name, phase), Vector<BoundTraceEventHandle r>()).storedValue->value.append(BoundTraceEventHandler(instance, method));
110 it->value.append(BoundTraceEventHandler(instance, method)); 110 else
111 it->value.append(BoundTraceEventHandler(instance, method));
111 } 112 }
112 113
113 void TraceEventDispatcher::removeAllListeners(TraceEventTargetBase* instance, In spectorClient* client) 114 void TraceEventDispatcher::removeAllListeners(TraceEventTargetBase* instance, In spectorClient* client)
114 { 115 {
115 ASSERT(isMainThread()); 116 ASSERT(isMainThread());
116 processBackgroundEvents(); 117 processBackgroundEvents();
117 { 118 {
118 MutexLocker locker(m_mutex); 119 MutexLocker locker(m_mutex);
119 120
120 HandlersMap remainingHandlers; 121 HandlersMap remainingHandlers;
(...skipping 29 matching lines...) Expand all
150 size_t index = findParameter(name); 151 size_t index = findParameter(name);
151 if (index == kNotFound || m_argumentTypes[index] != expectedType) { 152 if (index == kNotFound || m_argumentTypes[index] != expectedType) {
152 ASSERT_NOT_REACHED(); 153 ASSERT_NOT_REACHED();
153 return missingValue; 154 return missingValue;
154 } 155 }
155 return *reinterpret_cast<const WebCore::TraceEvent::TraceValueUnion*>(m_argu mentValues + index); 156 return *reinterpret_cast<const WebCore::TraceEvent::TraceValueUnion*>(m_argu mentValues + index);
156 } 157 }
157 158
158 } // namespace WebCore 159 } // namespace WebCore
159 160
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorTimelineAgent.cpp ('k') | Source/core/page/EventHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698