| OLD | NEW | 
|    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 27 matching lines...) Expand all  Loading... | 
|   38 #include "core/frame/LocalFrame.h" |   38 #include "core/frame/LocalFrame.h" | 
|   39 #include "core/inspector/ConsoleMessage.h" |   39 #include "core/inspector/ConsoleMessage.h" | 
|   40 #include "core/inspector/InspectorInstrumentation.h" |   40 #include "core/inspector/InspectorInstrumentation.h" | 
|   41 #include "core/loader/FrameLoader.h" |   41 #include "core/loader/FrameLoader.h" | 
|   42 #include "core/loader/FrameLoaderClient.h" |   42 #include "core/loader/FrameLoaderClient.h" | 
|   43 #include "core/loader/MixedContentChecker.h" |   43 #include "core/loader/MixedContentChecker.h" | 
|   44 #include "modules/websockets/InspectorWebSocketEvents.h" |   44 #include "modules/websockets/InspectorWebSocketEvents.h" | 
|   45 #include "modules/websockets/WebSocketChannelClient.h" |   45 #include "modules/websockets/WebSocketChannelClient.h" | 
|   46 #include "modules/websockets/WebSocketFrame.h" |   46 #include "modules/websockets/WebSocketFrame.h" | 
|   47 #include "modules/websockets/WebSocketHandleImpl.h" |   47 #include "modules/websockets/WebSocketHandleImpl.h" | 
 |   48 #include "platform/WebFrameScheduler.h" | 
|   48 #include "platform/loader/fetch/UniqueIdentifier.h" |   49 #include "platform/loader/fetch/UniqueIdentifier.h" | 
|   49 #include "platform/network/NetworkLog.h" |   50 #include "platform/network/NetworkLog.h" | 
|   50 #include "platform/network/WebSocketHandshakeRequest.h" |   51 #include "platform/network/WebSocketHandshakeRequest.h" | 
|   51 #include "platform/weborigin/SecurityOrigin.h" |   52 #include "platform/weborigin/SecurityOrigin.h" | 
|   52 #include "public/platform/InterfaceProvider.h" |   53 #include "public/platform/InterfaceProvider.h" | 
|   53 #include "public/platform/Platform.h" |   54 #include "public/platform/Platform.h" | 
|   54 #include "wtf/PtrUtil.h" |   55 #include "wtf/PtrUtil.h" | 
|   55 #include <memory> |   56 #include <memory> | 
|   56  |   57  | 
|   57 namespace blink { |   58 namespace blink { | 
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  452   return m_document; |  453   return m_document; | 
|  453 } |  454 } | 
|  454  |  455  | 
|  455 void DocumentWebSocketChannel::didConnect(WebSocketHandle* handle, |  456 void DocumentWebSocketChannel::didConnect(WebSocketHandle* handle, | 
|  456                                           const String& selectedProtocol, |  457                                           const String& selectedProtocol, | 
|  457                                           const String& extensions) { |  458                                           const String& extensions) { | 
|  458   NETWORK_DVLOG(1) << this << " didConnect(" << handle << ", " |  459   NETWORK_DVLOG(1) << this << " didConnect(" << handle << ", " | 
|  459                    << String(selectedProtocol) << ", " << String(extensions) |  460                    << String(selectedProtocol) << ", " << String(extensions) | 
|  460                    << ")"; |  461                    << ")"; | 
|  461  |  462  | 
 |  463   if (document()->frame()) { | 
 |  464     connection_handle_for_scheduler_ = | 
 |  465         document()->frame()->frameScheduler()->onActiveConnectionCreated(); | 
 |  466   } | 
 |  467  | 
|  462   DCHECK(m_handle); |  468   DCHECK(m_handle); | 
|  463   DCHECK_EQ(handle, m_handle.get()); |  469   DCHECK_EQ(handle, m_handle.get()); | 
|  464   DCHECK(m_client); |  470   DCHECK(m_client); | 
|  465  |  471  | 
|  466   m_client->didConnect(selectedProtocol, extensions); |  472   m_client->didConnect(selectedProtocol, extensions); | 
|  467 } |  473 } | 
|  468  |  474  | 
|  469 void DocumentWebSocketChannel::didStartOpeningHandshake( |  475 void DocumentWebSocketChannel::didStartOpeningHandshake( | 
|  470     WebSocketHandle* handle, |  476     WebSocketHandle* handle, | 
|  471     PassRefPtr<WebSocketHandshakeRequest> request) { |  477     PassRefPtr<WebSocketHandshakeRequest> request) { | 
| (...skipping 24 matching lines...) Expand all  Loading... | 
|  496   InspectorInstrumentation::didReceiveWebSocketHandshakeResponse( |  502   InspectorInstrumentation::didReceiveWebSocketHandshakeResponse( | 
|  497       document(), m_identifier, m_handshakeRequest.get(), response); |  503       document(), m_identifier, m_handshakeRequest.get(), response); | 
|  498   m_handshakeRequest.clear(); |  504   m_handshakeRequest.clear(); | 
|  499 } |  505 } | 
|  500  |  506  | 
|  501 void DocumentWebSocketChannel::didFail(WebSocketHandle* handle, |  507 void DocumentWebSocketChannel::didFail(WebSocketHandle* handle, | 
|  502                                        const String& message) { |  508                                        const String& message) { | 
|  503   NETWORK_DVLOG(1) << this << " didFail(" << handle << ", " << String(message) |  509   NETWORK_DVLOG(1) << this << " didFail(" << handle << ", " << String(message) | 
|  504                    << ")"; |  510                    << ")"; | 
|  505  |  511  | 
 |  512   connection_handle_for_scheduler_.reset(); | 
 |  513  | 
|  506   DCHECK(m_handle); |  514   DCHECK(m_handle); | 
|  507   DCHECK_EQ(handle, m_handle.get()); |  515   DCHECK_EQ(handle, m_handle.get()); | 
|  508  |  516  | 
|  509   // This function is called when the browser is required to fail the |  517   // This function is called when the browser is required to fail the | 
|  510   // WebSocketConnection. Hence we fail this channel by calling |  518   // WebSocketConnection. Hence we fail this channel by calling | 
|  511   // |this->failAsError| function. |  519   // |this->failAsError| function. | 
|  512   failAsError(message); |  520   failAsError(message); | 
|  513   // |this| may be deleted. |  521   // |this| may be deleted. | 
|  514 } |  522 } | 
|  515  |  523  | 
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  578   } |  586   } | 
|  579 } |  587 } | 
|  580  |  588  | 
|  581 void DocumentWebSocketChannel::didClose(WebSocketHandle* handle, |  589 void DocumentWebSocketChannel::didClose(WebSocketHandle* handle, | 
|  582                                         bool wasClean, |  590                                         bool wasClean, | 
|  583                                         unsigned short code, |  591                                         unsigned short code, | 
|  584                                         const String& reason) { |  592                                         const String& reason) { | 
|  585   NETWORK_DVLOG(1) << this << " didClose(" << handle << ", " << wasClean << ", " |  593   NETWORK_DVLOG(1) << this << " didClose(" << handle << ", " << wasClean << ", " | 
|  586                    << code << ", " << String(reason) << ")"; |  594                    << code << ", " << String(reason) << ")"; | 
|  587  |  595  | 
 |  596   connection_handle_for_scheduler_.reset(); | 
 |  597  | 
|  588   DCHECK(m_handle); |  598   DCHECK(m_handle); | 
|  589   DCHECK_EQ(handle, m_handle.get()); |  599   DCHECK_EQ(handle, m_handle.get()); | 
|  590  |  600  | 
|  591   m_handle.reset(); |  601   m_handle.reset(); | 
|  592  |  602  | 
|  593   if (m_identifier) { |  603   if (m_identifier) { | 
|  594     TRACE_EVENT_INSTANT1( |  604     TRACE_EVENT_INSTANT1( | 
|  595         "devtools.timeline", "WebSocketDestroy", TRACE_EVENT_SCOPE_THREAD, |  605         "devtools.timeline", "WebSocketDestroy", TRACE_EVENT_SCOPE_THREAD, | 
|  596         "data", InspectorWebSocketEvent::data(document(), m_identifier)); |  606         "data", InspectorWebSocketEvent::data(document(), m_identifier)); | 
|  597     InspectorInstrumentation::didCloseWebSocket(document(), m_identifier); |  607     InspectorInstrumentation::didCloseWebSocket(document(), m_identifier); | 
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  657   WebSocketChannel::trace(visitor); |  667   WebSocketChannel::trace(visitor); | 
|  658 } |  668 } | 
|  659  |  669  | 
|  660 std::ostream& operator<<(std::ostream& ostream, |  670 std::ostream& operator<<(std::ostream& ostream, | 
|  661                          const DocumentWebSocketChannel* channel) { |  671                          const DocumentWebSocketChannel* channel) { | 
|  662   return ostream << "DocumentWebSocketChannel " |  672   return ostream << "DocumentWebSocketChannel " | 
|  663                  << static_cast<const void*>(channel); |  673                  << static_cast<const void*>(channel); | 
|  664 } |  674 } | 
|  665  |  675  | 
|  666 }  // namespace blink |  676 }  // namespace blink | 
| OLD | NEW |