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

Side by Side Diff: third_party/WebKit/Source/core/page/NetworkStateNotifier.h

Issue 1409853007: Have NetworkStateNotifier keep untraced ExecutionContext observers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comment Created 5 years, 1 month 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 | « no previous file | no next file » | 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) 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 { 101 {
102 } 102 }
103 bool iterating; 103 bool iterating;
104 Vector<NetworkStateObserver*> observers; 104 Vector<NetworkStateObserver*> observers;
105 Vector<size_t> zeroedObservers; // Indices in observers that are 0. 105 Vector<size_t> zeroedObservers; // Indices in observers that are 0.
106 }; 106 };
107 107
108 void setWebConnectionImpl(WebConnectionType, double maxBandwidthMbps); 108 void setWebConnectionImpl(WebConnectionType, double maxBandwidthMbps);
109 void setMaxBandwidthImpl(double maxBandwidthMbps); 109 void setMaxBandwidthImpl(double maxBandwidthMbps);
110 110
111 using ObserverListMap = WillBePersistentHeapHashMap<RawPtrWillBeWeakMember<E xecutionContext>, OwnPtr<ObserverList>>; 111 // The ObserverListMap is cross-thread accessed, adding/removing Observers r unning
112 // within an ExecutionContext. Kept off-heap to ease cross-thread allocation and use;
113 // the observers are (already) responsible for explicitly unregistering whil e finalizing.
114 using ObserverListMap = HashMap<RawPtrWillBeUntracedMember<ExecutionContext> , OwnPtr<ObserverList>>;
112 115
113 void notifyObserversOfConnectionChangeOnContext(WebConnectionType, double ma xBandwidthMbps, ExecutionContext*); 116 void notifyObserversOfConnectionChangeOnContext(WebConnectionType, double ma xBandwidthMbps, ExecutionContext*);
114 117
115 ObserverList* lockAndFindObserverList(ExecutionContext*); 118 ObserverList* lockAndFindObserverList(ExecutionContext*);
116 119
117 // Removed observers are nulled out in the list in case the list is being 120 // Removed observers are nulled out in the list in case the list is being
118 // iterated over. Once done iterating, call this to clean up nulled 121 // iterated over. Once done iterating, call this to clean up nulled
119 // observers. 122 // observers.
120 void collectZeroedObservers(ObserverList*, ExecutionContext*); 123 void collectZeroedObservers(ObserverList*, ExecutionContext*);
121 124
122 mutable Mutex m_mutex; 125 mutable Mutex m_mutex;
123 bool m_isOnLine; 126 bool m_isOnLine;
124 WebConnectionType m_type; 127 WebConnectionType m_type;
125 double m_maxBandwidthMbps; 128 double m_maxBandwidthMbps;
126 ObserverListMap m_observers; 129 ObserverListMap m_observers;
127 bool m_testUpdatesOnly; 130 bool m_testUpdatesOnly;
128 }; 131 };
129 132
130 CORE_EXPORT NetworkStateNotifier& networkStateNotifier(); 133 CORE_EXPORT NetworkStateNotifier& networkStateNotifier();
131 134
132 } // namespace blink 135 } // namespace blink
133 136
134 #endif // NetworkStateNotifier_h 137 #endif // NetworkStateNotifier_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698