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

Side by Side Diff: third_party/WebKit/Source/platform/network/NetworkStateNotifier.h

Issue 2807073002: Removed local RefPtr objects created from PassRefPtr arguments. (Closed)
Patch Set: addressed review Created 3 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 }; 159 };
160 160
161 // The ObserverListMap is cross-thread accessed, adding/removing Observers 161 // The ObserverListMap is cross-thread accessed, adding/removing Observers
162 // running on a task runner. 162 // running on a task runner.
163 using ObserverListMap = 163 using ObserverListMap =
164 HashMap<RefPtr<WebTaskRunner>, std::unique_ptr<ObserverList>>; 164 HashMap<RefPtr<WebTaskRunner>, std::unique_ptr<ObserverList>>;
165 165
166 void NotifyObservers(ObserverListMap&, ObserverType, const NetworkState&); 166 void NotifyObservers(ObserverListMap&, ObserverType, const NetworkState&);
167 void NotifyObserversOnTaskRunner(ObserverListMap*, 167 void NotifyObserversOnTaskRunner(ObserverListMap*,
168 ObserverType, 168 ObserverType,
169 PassRefPtr<WebTaskRunner>, 169 RefPtr<WebTaskRunner>,
170 const NetworkState&); 170 const NetworkState&);
171 171
172 void AddObserver(ObserverListMap&, 172 void AddObserver(ObserverListMap&,
173 NetworkStateObserver*, 173 NetworkStateObserver*,
174 PassRefPtr<WebTaskRunner>); 174 PassRefPtr<WebTaskRunner>);
175 void RemoveObserver(ObserverListMap&, 175 void RemoveObserver(ObserverListMap&,
176 NetworkStateObserver*, 176 NetworkStateObserver*,
177 PassRefPtr<WebTaskRunner>); 177 RefPtr<WebTaskRunner>);
178 178
179 ObserverList* LockAndFindObserverList(ObserverListMap&, 179 ObserverList* LockAndFindObserverList(ObserverListMap&,
180 PassRefPtr<WebTaskRunner>); 180 PassRefPtr<WebTaskRunner>);
181 181
182 // Removed observers are nulled out in the list in case the list is being 182 // Removed observers are nulled out in the list in case the list is being
183 // iterated over. Once done iterating, call this to clean up nulled 183 // iterated over. Once done iterating, call this to clean up nulled
184 // observers. 184 // observers.
185 void CollectZeroedObservers(ObserverListMap&, 185 void CollectZeroedObservers(ObserverListMap&,
186 ObserverList*, 186 ObserverList*,
187 PassRefPtr<WebTaskRunner>); 187 PassRefPtr<WebTaskRunner>);
188 188
189 mutable Mutex mutex_; 189 mutable Mutex mutex_;
190 NetworkState state_; 190 NetworkState state_;
191 bool has_override_; 191 bool has_override_;
192 NetworkState override_; 192 NetworkState override_;
193 193
194 ObserverListMap connection_observers_; 194 ObserverListMap connection_observers_;
195 ObserverListMap on_line_state_observers_; 195 ObserverListMap on_line_state_observers_;
196 }; 196 };
197 197
198 PLATFORM_EXPORT NetworkStateNotifier& GetNetworkStateNotifier(); 198 PLATFORM_EXPORT NetworkStateNotifier& GetNetworkStateNotifier();
199 199
200 } // namespace blink 200 } // namespace blink
201 201
202 #endif // NetworkStateNotifier_h 202 #endif // NetworkStateNotifier_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698