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

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

Issue 334873002: [WebSocket] Make subprotocol and extensions live in WebSocket (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 flowControlIfNecessary(); 163 flowControlIfNecessary();
164 if (m_identifier) { 164 if (m_identifier) {
165 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "We bSocketCreate", "data", InspectorWebSocketCreateEvent::data(document(), m_identi fier, url, protocol)); 165 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "We bSocketCreate", "data", InspectorWebSocketCreateEvent::data(document(), m_identi fier, url, protocol));
166 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack" ), "CallStack", "stack", InspectorCallStackEvent::currentCallStack()); 166 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack" ), "CallStack", "stack", InspectorCallStackEvent::currentCallStack());
167 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing. 167 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing.
168 InspectorInstrumentation::didCreateWebSocket(document(), m_identifier, u rl, protocol); 168 InspectorInstrumentation::didCreateWebSocket(document(), m_identifier, u rl, protocol);
169 } 169 }
170 return true; 170 return true;
171 } 171 }
172 172
173 String NewWebSocketChannelImpl::subprotocol()
174 {
175 WTF_LOG(Network, "NewWebSocketChannelImpl %p subprotocol()", this);
176 return m_subprotocol;
177 }
178
179 String NewWebSocketChannelImpl::extensions()
180 {
181 WTF_LOG(Network, "NewWebSocketChannelImpl %p extensions()", this);
182 return m_extensions;
183 }
184
185 WebSocketChannel::SendResult NewWebSocketChannelImpl::send(const String& message ) 173 WebSocketChannel::SendResult NewWebSocketChannelImpl::send(const String& message )
186 { 174 {
187 WTF_LOG(Network, "NewWebSocketChannelImpl %p sendText(%s)", this, message.ut f8().data()); 175 WTF_LOG(Network, "NewWebSocketChannelImpl %p sendText(%s)", this, message.ut f8().data());
188 if (m_identifier) { 176 if (m_identifier) {
189 // FIXME: Change the inspector API to show the entire message instead 177 // FIXME: Change the inspector API to show the entire message instead
190 // of individual frames. 178 // of individual frames.
191 CString data = message.utf8(); 179 CString data = message.utf8();
192 InspectorInstrumentation::didSendWebSocketFrame(document(), m_identifier , WebSocketFrame::OpCodeText, true, data.data(), data.length()); 180 InspectorInstrumentation::didSendWebSocketFrame(document(), m_identifier , WebSocketFrame::OpCodeText, true, data.data(), data.length());
193 } 181 }
194 m_messages.append(adoptPtr(new Message(message))); 182 m_messages.append(adoptPtr(new Message(message)));
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 { 399 {
412 WTF_LOG(Network, "NewWebSocketChannelImpl %p didConnect(%p, %d, %s, %s)", th is, handle, fail, selectedProtocol.utf8().data(), extensions.utf8().data()); 400 WTF_LOG(Network, "NewWebSocketChannelImpl %p didConnect(%p, %d, %s, %s)", th is, handle, fail, selectedProtocol.utf8().data(), extensions.utf8().data());
413 ASSERT(m_handle); 401 ASSERT(m_handle);
414 ASSERT(handle == m_handle); 402 ASSERT(handle == m_handle);
415 ASSERT(m_client); 403 ASSERT(m_client);
416 if (fail) { 404 if (fail) {
417 failAsError("Cannot connect to " + m_url.string() + "."); 405 failAsError("Cannot connect to " + m_url.string() + ".");
418 // failAsError may delete this object. 406 // failAsError may delete this object.
419 return; 407 return;
420 } 408 }
421 m_subprotocol = selectedProtocol; 409 m_client->didConnect(selectedProtocol, extensions);
422 m_extensions = extensions;
423 m_client->didConnect();
424 } 410 }
425 411
426 void NewWebSocketChannelImpl::didStartOpeningHandshake(WebSocketHandle* handle, const blink::WebSocketHandshakeRequestInfo& request) 412 void NewWebSocketChannelImpl::didStartOpeningHandshake(WebSocketHandle* handle, const blink::WebSocketHandshakeRequestInfo& request)
427 { 413 {
428 WTF_LOG(Network, "NewWebSocketChannelImpl %p didStartOpeningHandshake(%p)", this, handle); 414 WTF_LOG(Network, "NewWebSocketChannelImpl %p didStartOpeningHandshake(%p)", this, handle);
429 if (m_identifier) { 415 if (m_identifier) {
430 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "We bSocketSendHandshakeRequest", "data", InspectorWebSocketEvent::data(document(), m_identifier)); 416 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "We bSocketSendHandshakeRequest", "data", InspectorWebSocketEvent::data(document(), m_identifier));
431 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack" ), "CallStack", "stack", InspectorCallStackEvent::currentCallStack()); 417 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack" ), "CallStack", "stack", InspectorCallStackEvent::currentCallStack());
432 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing. 418 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing.
433 InspectorInstrumentation::willSendWebSocketHandshakeRequest(document(), m_identifier, &request.toCoreRequest()); 419 InspectorInstrumentation::willSendWebSocketHandshakeRequest(document(), m_identifier, &request.toCoreRequest());
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 // |this| can be deleted here. 548 // |this| can be deleted here.
563 } 549 }
564 550
565 void NewWebSocketChannelImpl::trace(Visitor* visitor) 551 void NewWebSocketChannelImpl::trace(Visitor* visitor)
566 { 552 {
567 visitor->trace(m_blobLoader); 553 visitor->trace(m_blobLoader);
568 WebSocketChannel::trace(visitor); 554 WebSocketChannel::trace(visitor);
569 } 555 }
570 556
571 } // namespace WebCore 557 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698