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

Side by Side Diff: Source/core/platform/network/chromium/SocketStreamHandle.cpp

Issue 14071008: WebSocket object should fire error event when WebSocket server can't be connected. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Add new layouttests into TestExceptions because it depends on chromium side patch Created 7 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) 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2012 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "SocketStreamHandle.h" 32 #include "SocketStreamHandle.h"
33 #include "SocketStreamHandleInternal.h" 33 #include "SocketStreamHandleInternal.h"
34 34
35 #include "Logging.h" 35 #include "Logging.h"
36 #include "NotImplemented.h" 36 #include "NotImplemented.h"
37 #include "SocketStreamError.h"
37 #include "SocketStreamHandleClient.h" 38 #include "SocketStreamHandleClient.h"
38 #include <public/Platform.h> 39 #include <public/Platform.h>
39 #include <public/WebData.h> 40 #include <public/WebData.h>
41 #include <public/WebSocketStreamError.h>
40 #include <public/WebSocketStreamHandle.h> 42 #include <public/WebSocketStreamHandle.h>
41 #include <wtf/PassOwnPtr.h> 43 #include <wtf/PassOwnPtr.h>
42 44
43 namespace WebCore { 45 namespace WebCore {
44 46
45 SocketStreamHandleInternal::SocketStreamHandleInternal(SocketStreamHandle* handl e) 47 SocketStreamHandleInternal::SocketStreamHandleInternal(SocketStreamHandle* handl e)
46 : m_handle(handle) 48 : m_handle(handle)
47 , m_maxPendingSendAllowed(0) 49 , m_maxPendingSendAllowed(0)
48 , m_pendingAmountSent(0) 50 , m_pendingAmountSent(0)
49 { 51 {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 if (h->m_client) 148 if (h->m_client)
147 h->m_client->didCloseSocketStream(h); 149 h->m_client->didCloseSocketStream(h);
148 } 150 }
149 } 151 }
150 152
151 void SocketStreamHandleInternal::didFail(WebKit::WebSocketStreamHandle* socketHa ndle, const WebKit::WebSocketStreamError& err) 153 void SocketStreamHandleInternal::didFail(WebKit::WebSocketStreamHandle* socketHa ndle, const WebKit::WebSocketStreamError& err)
152 { 154 {
153 LOG(Network, "SocketStreamHandleInternal %p didFail()", this); 155 LOG(Network, "SocketStreamHandleInternal %p didFail()", this);
154 if (m_handle && m_socket) { 156 if (m_handle && m_socket) {
155 ASSERT(socketHandle == m_socket.get()); 157 ASSERT(socketHandle == m_socket.get());
156 m_socket.clear(); 158 if (m_handle->m_client)
157 SocketStreamHandle* h = m_handle; 159 m_handle->m_client->didFailSocketStream(m_handle, *(PassRefPtr<Socke tStreamError>(err)));
158 m_handle = 0;
159 if (h->m_client)
160 h->m_client->didCloseSocketStream(h); // didFail(h, err);
161 } 160 }
162 } 161 }
163 162
164 // FIXME: auth 163 // FIXME: auth
165 164
166 // SocketStreamHandle ---------------------------------------------------------- 165 // SocketStreamHandle ----------------------------------------------------------
167 166
168 SocketStreamHandle::SocketStreamHandle(const KURL& url, SocketStreamHandleClient * client) 167 SocketStreamHandle::SocketStreamHandle(const KURL& url, SocketStreamHandleClient * client)
169 : SocketStreamHandleBase(url, client) 168 : SocketStreamHandleBase(url, client)
170 { 169 {
(...skipping 14 matching lines...) Expand all
185 return m_internal->send(buf, len); 184 return m_internal->send(buf, len);
186 } 185 }
187 186
188 void SocketStreamHandle::platformClose() 187 void SocketStreamHandle::platformClose()
189 { 188 {
190 if (m_internal) 189 if (m_internal)
191 m_internal->close(); 190 m_internal->close();
192 } 191 }
193 192
194 } // namespace WebCore 193 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/platform/network/chromium/SocketStreamError.h ('k') | Source/modules/websockets/MainThreadWebSocketChannel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698