OLD | NEW |
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 ASSERT(isMainThread()); | 62 ASSERT(isMainThread()); |
63 if (m_testUpdatesOnly) | 63 if (m_testUpdatesOnly) |
64 return; | 64 return; |
65 | 65 |
66 setWebConnectionTypeImpl(type); | 66 setWebConnectionTypeImpl(type); |
67 } | 67 } |
68 | 68 |
69 void NetworkStateNotifier::setWebConnectionTypeImpl(blink::WebConnectionType typ
e) | 69 void NetworkStateNotifier::setWebConnectionTypeImpl(blink::WebConnectionType typ
e) |
70 { | 70 { |
71 ASSERT(isMainThread()); | 71 ASSERT(isMainThread()); |
72 ASSERT(!m_testUpdatesOnly); | |
73 | 72 |
74 MutexLocker locker(m_mutex); | 73 MutexLocker locker(m_mutex); |
75 if (m_type == type) | 74 if (m_type == type) |
76 return; | 75 return; |
77 m_type = type; | 76 m_type = type; |
78 | 77 |
79 for (ObserverListMap::iterator it = m_observers.begin(); it != m_observers.e
nd(); ++it) { | 78 for (ObserverListMap::iterator it = m_observers.begin(); it != m_observers.e
nd(); ++it) { |
80 ExecutionContext* context = it->key; | 79 ExecutionContext* context = it->key; |
81 context->postTask(bind(&NetworkStateNotifier::notifyObserversOnContext,
this, context, type)); | 80 context->postTask(bind(&NetworkStateNotifier::notifyObserversOnContext,
this, context, type)); |
82 } | 81 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 171 |
173 list->zeroedObservers.clear(); | 172 list->zeroedObservers.clear(); |
174 | 173 |
175 if (list->observers.isEmpty()) { | 174 if (list->observers.isEmpty()) { |
176 MutexLocker locker(m_mutex); | 175 MutexLocker locker(m_mutex); |
177 m_observers.remove(context); // deletes list | 176 m_observers.remove(context); // deletes list |
178 } | 177 } |
179 } | 178 } |
180 | 179 |
181 } // namespace WebCore | 180 } // namespace WebCore |
OLD | NEW |