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

Side by Side Diff: Source/modules/websockets/MainThreadWebSocketChannel.cpp

Issue 304113002: Pass render frame ID to WebSocketBridge (Blink side) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed #2 Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 m_handshake->reset(); 106 m_handshake->reset();
107 m_handshake->addExtensionProcessor(m_perMessageDeflate.createExtensionProces sor()); 107 m_handshake->addExtensionProcessor(m_perMessageDeflate.createExtensionProces sor());
108 m_handshake->addExtensionProcessor(m_deflateFramer.createExtensionProcessor( )); 108 m_handshake->addExtensionProcessor(m_deflateFramer.createExtensionProcessor( ));
109 if (m_identifier) { 109 if (m_identifier) {
110 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "We bSocketCreate", "data", InspectorWebSocketCreateEvent::data(m_document, m_identi fier, url, protocol)); 110 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "We bSocketCreate", "data", InspectorWebSocketCreateEvent::data(m_document, m_identi fier, url, protocol));
111 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack" ), "CallStack", "stack", InspectorCallStackEvent::currentCallStack()); 111 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack" ), "CallStack", "stack", InspectorCallStackEvent::currentCallStack());
112 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing. 112 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing.
113 InspectorInstrumentation::didCreateWebSocket(m_document, m_identifier, u rl, protocol); 113 InspectorInstrumentation::didCreateWebSocket(m_document, m_identifier, u rl, protocol);
114 } 114 }
115 ref(); 115 ref();
116 m_handle = SocketStreamHandle::create(m_handshake->url(), this); 116
117 m_handle = SocketStreamHandle::create(this);
118 ASSERT(m_handle);
119 if (m_document->frame()) {
120 m_document->frame()->loader().client()->dispatchWillOpenSocketStream(m_h andle.get());
121 }
122 m_handle->connect(m_handshake->url());
123
117 return true; 124 return true;
118 } 125 }
119 126
120 String MainThreadWebSocketChannel::subprotocol() 127 String MainThreadWebSocketChannel::subprotocol()
121 { 128 {
122 WTF_LOG(Network, "MainThreadWebSocketChannel %p subprotocol()", this); 129 WTF_LOG(Network, "MainThreadWebSocketChannel %p subprotocol()", this);
123 if (!m_handshake || m_handshake->mode() != WebSocketHandshake::Connected) 130 if (!m_handshake || m_handshake->mode() != WebSocketHandshake::Connected)
124 return ""; 131 return "";
125 String serverProtocol = m_handshake->serverWebSocketProtocol(); 132 String serverProtocol = m_handshake->serverWebSocketProtocol();
126 if (serverProtocol.isNull()) 133 if (serverProtocol.isNull())
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 m_suspended = true; 270 m_suspended = true;
264 } 271 }
265 272
266 void MainThreadWebSocketChannel::resume() 273 void MainThreadWebSocketChannel::resume()
267 { 274 {
268 m_suspended = false; 275 m_suspended = false;
269 if ((!m_buffer.isEmpty() || (m_state == ChannelClosed)) && m_client && !m_re sumeTimer.isActive()) 276 if ((!m_buffer.isEmpty() || (m_state == ChannelClosed)) && m_client && !m_re sumeTimer.isActive())
270 m_resumeTimer.startOneShot(0, FROM_HERE); 277 m_resumeTimer.startOneShot(0, FROM_HERE);
271 } 278 }
272 279
273 void MainThreadWebSocketChannel::willOpenSocketStream(SocketStreamHandle* handle )
274 {
275 WTF_LOG(Network, "MainThreadWebSocketChannel %p willOpenSocketStream()", thi s);
276 ASSERT(handle);
277 if (m_document->frame())
278 m_document->frame()->loader().client()->dispatchWillOpenSocketStream(han dle);
279 }
280
281 void MainThreadWebSocketChannel::didOpenSocketStream(SocketStreamHandle* handle) 280 void MainThreadWebSocketChannel::didOpenSocketStream(SocketStreamHandle* handle)
282 { 281 {
283 WTF_LOG(Network, "MainThreadWebSocketChannel %p didOpenSocketStream()", this ); 282 WTF_LOG(Network, "MainThreadWebSocketChannel %p didOpenSocketStream()", this );
284 ASSERT(handle == m_handle); 283 ASSERT(handle == m_handle);
285 if (!m_document) 284 if (!m_document)
286 return; 285 return;
287 if (m_identifier) { 286 if (m_identifier) {
288 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "We bSocketSendHandshakeRequest", "data", InspectorWebSocketEvent::data(m_document, m_identifier)); 287 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "We bSocketSendHandshakeRequest", "data", InspectorWebSocketEvent::data(m_document, m_identifier));
289 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack" ), "CallStack", "stack", InspectorCallStackEvent::currentCallStack()); 288 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack" ), "CallStack", "stack", InspectorCallStackEvent::currentCallStack());
290 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing. 289 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing.
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 } 864 }
866 865
867 Vector<char> frameData; 866 Vector<char> frameData;
868 frame.makeFrameData(frameData); 867 frame.makeFrameData(frameData);
869 868
870 m_perMessageDeflate.resetDeflateBuffer(); 869 m_perMessageDeflate.resetDeflateBuffer();
871 return m_handle->send(frameData.data(), frameData.size()); 870 return m_handle->send(frameData.data(), frameData.size());
872 } 871 }
873 872
874 } // namespace WebCore 873 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/websockets/MainThreadWebSocketChannel.h ('k') | Source/modules/websockets/NewWebSocketChannelImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698