Changeset 79563 in webkit
- Timestamp:
- Feb 24, 2011 7:49:15 AM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 deleted
- 6 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r79562 r79563 1 2011-02-24 Adam Klein <adamk@chromium.org> 2 3 Reviewed by Darin Fisher. 4 5 [chromium] Add code to WebKit Chromium to allow access to NetworkStateNotifier 6 https://bugs.webkit.org/show_bug.cgi?id=54516 7 8 Give Chromium's NetworkStateNotifier the ability to change the value 9 of m_isOnLine, rather than making it always true. 10 11 No new tests, not sure how to test this. No other LayoutTests seem 12 to exercise navigator.onLine. 13 14 * WebCore.gypi: 15 * platform/network/NetworkStateNotifier.cpp: 16 (WebCore::NetworkStateNotifier::setOnLine): Moved and renamed from NetworkStateNotifierAndroid. 17 * platform/network/NetworkStateNotifier.h: 18 (WebCore::NetworkStateNotifier::networkStateChange): Forward to setOnLine. 19 * platform/network/android/NetworkStateNotifierAndroid.cpp: Removed. 20 * platform/network/chromium/NetworkStateNotifierChromium.cpp: Removed. 21 * platform/network/chromium/NetworkStateNotifierPrivate.h: Removed. 22 1 23 2011-02-24 Benjamin Poulain <benjamin.poulain@nokia.com> 2 24 -
trunk/Source/WebCore/WebCore.gypi
r79426 r79563 3167 3167 'platform/network/chromium/CookieJarChromium.cpp', 3168 3168 'platform/network/chromium/DNSChromium.cpp', 3169 'platform/network/chromium/NetworkStateNotifierChromium.cpp',3170 'platform/network/chromium/NetworkStateNotifierPrivate.h',3171 3169 'platform/network/chromium/ResourceError.h', 3172 3170 'platform/network/chromium/ResourceRequest.cpp', -
trunk/Source/WebCore/platform/network/NetworkStateNotifier.cpp
r39138 r79563 21 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 24 */ 25 25 … … 36 36 { 37 37 AtomicallyInitializedStatic(NetworkStateNotifier*, networkStateNotifier = new NetworkStateNotifier); 38 38 39 39 return *networkStateNotifier; 40 40 } … … 43 43 { 44 44 ASSERT(!m_networkStateChangedFunction); 45 45 46 46 m_networkStateChangedFunction = function; 47 47 } 48 48 49 #if PLATFORM(ANDROID) || PLATFORM(CHROMIUM) 50 void NetworkStateNotifier::setOnLine(bool onLine) 51 { 52 if (m_isOnLine == onLine) 53 return; 54 55 m_isOnLine = onLine; 56 57 if (m_networkStateChangedFunction) 58 m_networkStateChangedFunction(); 49 59 } 60 #endif // PLATFORM(ANDROID) || PLATFORM(CHROMIM) 61 62 } -
trunk/Source/WebCore/platform/network/NetworkStateNotifier.h
r76248 r79563 38 38 typedef const struct __SCDynamicStore * SCDynamicStoreRef; 39 39 40 #elif PLATFORM(CHROMIUM)41 42 #include "NetworkStateNotifierPrivate.h"43 44 40 #elif PLATFORM(WIN) 45 41 … … 68 64 NetworkStateNotifier(); 69 65 void setNetworkStateChangedFunction(void (*)()); 70 66 71 67 bool onLine() const { return m_isOnLine; } 72 68 73 69 #if (PLATFORM(QT) && ENABLE(QT_BEARER)) 74 70 void setNetworkAccessAllowed(bool); 71 #elif PLATFORM(ANDROID) || PLATFORM(CHROMIUM) 72 void setOnLine(bool); 75 73 #endif 76 74 77 private: 75 #if PLATFORM(ANDROID) 76 void networkStateChange(bool online) { setOnLine(online); } 77 #endif 78 79 private: 78 80 bool m_isOnLine; 79 81 void (*m_networkStateChangedFunction)(); … … 93 95 static void callAddressChanged(void*); 94 96 void addressChanged(); 95 97 96 98 void registerForAddressChange(); 97 99 HANDLE m_waitHandle; 98 100 OVERLAPPED m_overlapped; 99 100 #elif PLATFORM(CHROMIUM)101 NetworkStateNotifierPrivate p;102 103 #elif PLATFORM(ANDROID)104 public:105 void networkStateChange(bool online);106 101 107 102 #elif PLATFORM(QT) && ENABLE(QT_BEARER) … … 111 106 }; 112 107 113 #if !PLATFORM(MAC) && !PLATFORM(WIN) && ! PLATFORM(CHROMIUM) && !(PLATFORM(QT) && ENABLE(QT_BEARER))108 #if !PLATFORM(MAC) && !PLATFORM(WIN) && !(PLATFORM(QT) && ENABLE(QT_BEARER)) 114 109 115 110 inline NetworkStateNotifier::NetworkStateNotifier() 116 111 : m_isOnLine(true) 117 112 , m_networkStateChangedFunction(0) 118 { 113 { 119 114 } 120 115 … … 124 119 125 120 NetworkStateNotifier& networkStateNotifier(); 126 121 127 122 }; 128 123 -
trunk/Source/WebKit/chromium/ChangeLog
r79534 r79563 1 2011-02-24 Adam Klein <adamk@chromium.org> 2 3 Reviewed by Darin Fisher. 4 5 [chromium] Add code to WebKit Chromium to allow access to NetworkStateNotifier 6 https://bugs.webkit.org/show_bug.cgi?id=54516 7 8 Add a new WebNetworkStateNotifier class with a single static method, 9 setOnLine(), which dispatches to WebCore's singleton NetworkStateNotifier. 10 11 * WebKit.gyp: 12 * public/WebNetworkStateNotifier.h: Added. 13 * src/WebNetworkStateNotifier.cpp: Added. 14 (WebKit::WebNetworkStateNotifier::setOnLine): 15 1 16 2011-02-24 Robert Kroeger <rjkroege@chromium.org> 2 17 -
trunk/Source/WebKit/chromium/WebKit.gyp
r79503 r79563 220 220 'public/WebNamedNodeMap.h', 221 221 'public/WebNavigationType.h', 222 'public/WebNetworkStateNotifier.h', 222 223 'public/WebNode.h', 223 224 'public/WebNodeCollection.h', … … 506 507 'src/WebMediaPlayerClientImpl.h', 507 508 'src/WebNamedNodeMap.cpp', 509 'src/WebNetworkStateNotifier.cpp', 508 510 'src/WebNode.cpp', 509 511 'src/WebNodeCollection.cpp', -
trunk/Source/WebKit/chromium/public/WebNetworkStateNotifier.h
r79562 r79563 1 1 /* 2 * Copyright ( c) 2008, Google Inc.All rights reserved.3 * 2 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * 4 4 * Redistribution and use in source and binary forms, with or without 5 5 * modification, are permitted provided that the following conditions are 6 6 * met: 7 * 7 * 8 8 * * Redistributions of source code must retain the above copyright 9 9 * notice, this list of conditions and the following disclaimer. … … 15 15 * contributors may be used to endorse or promote products derived from 16 16 * this software without specific prior written permission. 17 * 17 * 18 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT … … 29 29 */ 30 30 31 #ifndef NetworkStateNotifierPrivate_h32 #define NetworkStateNotifierPrivate_h31 #ifndef WebNetworkStateNotifier_h 32 #define WebNetworkStateNotifier_h 33 33 34 namespace WebCore { 34 #include "WebCommon.h" 35 35 36 struct NetworkStateNotifierPrivate {}; 36 namespace WebKit { 37 37 38 } // namespace WebCore 38 class WebNetworkStateNotifier { 39 public: 40 WEBKIT_API static void setOnLine(bool); 41 42 private: 43 WebNetworkStateNotifier(); 44 }; 45 46 } // namespace WebKit 39 47 40 48 #endif -
trunk/Source/WebKit/chromium/src/WebNetworkStateNotifier.cpp
r79562 r79563 1 1 /* 2 * Copyright ( c) 2008,Google Inc. All rights reserved.3 * 2 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * 4 4 * Redistribution and use in source and binary forms, with or without 5 5 * modification, are permitted provided that the following conditions are 6 6 * met: 7 * 7 * 8 8 * * Redistributions of source code must retain the above copyright 9 9 * notice, this list of conditions and the following disclaimer. … … 15 15 * contributors may be used to endorse or promote products derived from 16 16 * this software without specific prior written permission. 17 * 17 * 18 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT … … 30 30 31 31 #include "config.h" 32 #include "WebNetworkStateNotifier.h" 33 32 34 #include "NetworkStateNotifier.h" 33 35 34 namespace WebCore { 36 using namespace WebCore; 35 37 36 // Chromium doesn't currently support network state notifications. This causes 37 // an extra DLL to get loaded into the renderer which can slow things down a 38 // bit. We may want an alternate design. 38 namespace WebKit { 39 39 40 void NetworkStateNotifier::updateState()40 void WebNetworkStateNotifier::setOnLine(bool onLine) 41 41 { 42 networkStateNotifier().setOnLine(onLine); 42 43 } 43 44 44 NetworkStateNotifier::NetworkStateNotifier() 45 : m_isOnLine(true) 46 , m_networkStateChangedFunction(0) 47 { 48 } 49 50 } // namespace WebCore 45 } // namespace WebKit
Note: See TracChangeset
for help on using the changeset viewer.