| 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 void setOnLine(bool); | 62 void setOnLine(bool); |
| 63 | 63 |
| 64 blink::WebConnectionType connectionType() const | 64 blink::WebConnectionType connectionType() const |
| 65 { | 65 { |
| 66 MutexLocker locker(m_mutex); | 66 MutexLocker locker(m_mutex); |
| 67 return m_type; | 67 return m_type; |
| 68 } | 68 } |
| 69 | 69 |
| 70 void setWebConnectionType(blink::WebConnectionType); | 70 void setWebConnectionType(blink::WebConnectionType); |
| 71 | 71 |
| 72 // Must be called on the context's thread. An added observer must be | 72 // Must be called on the context's thread. An added observer must be removed |
| 73 // removed before its ExecutionContext is deleted. | 73 // before its ExecutionContext is deleted. It's possible for an observer to |
| 74 // be called twice for the same event if it is first removed and then added |
| 75 // during notification. |
| 74 void addObserver(NetworkStateObserver*, ExecutionContext*); | 76 void addObserver(NetworkStateObserver*, ExecutionContext*); |
| 75 void removeObserver(NetworkStateObserver*, ExecutionContext*); | 77 void removeObserver(NetworkStateObserver*, ExecutionContext*); |
| 76 | 78 |
| 77 // The following functions are for testing purposes. | 79 // The following functions are for testing purposes. |
| 78 | 80 |
| 79 // When true, setWebConnectionType calls are ignored and only setWebConnecti
onTypeForTest | 81 // When true, setWebConnectionType calls are ignored and only setWebConnecti
onTypeForTest |
| 80 // can update the connection type. This is used for layout tests (see crbug.
com/377736). | 82 // can update the connection type. This is used for layout tests (see crbug.
com/377736). |
| 81 void setTestUpdatesOnly(bool); | 83 void setTestUpdatesOnly(bool); |
| 82 // Tests should call this as it will change the type regardless of the value
of m_testUpdatesOnly. | 84 // Tests should call this as it will change the type regardless of the value
of m_testUpdatesOnly. |
| 83 void setWebConnectionTypeForTest(blink::WebConnectionType); | 85 void setWebConnectionTypeForTest(blink::WebConnectionType); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 111 blink::WebConnectionType m_type; | 113 blink::WebConnectionType m_type; |
| 112 ObserverListMap m_observers; | 114 ObserverListMap m_observers; |
| 113 bool m_testUpdatesOnly; | 115 bool m_testUpdatesOnly; |
| 114 }; | 116 }; |
| 115 | 117 |
| 116 NetworkStateNotifier& networkStateNotifier(); | 118 NetworkStateNotifier& networkStateNotifier(); |
| 117 | 119 |
| 118 } // namespace WebCore | 120 } // namespace WebCore |
| 119 | 121 |
| 120 #endif // NetworkStateNotifier_h | 122 #endif // NetworkStateNotifier_h |
| OLD | NEW |