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

Side by Side Diff: third_party/WebKit/Source/modules/websockets/WebSocketHandleImpl.cpp

Issue 2668903003: Replace WTF::emptyString{16Bit}() with a static global (Closed)
Patch Set: Replace WTF::emptyString{16Bit}() with a static global Created 3 years, 10 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/websockets/WebSocketHandleImpl.h" 5 #include "modules/websockets/WebSocketHandleImpl.h"
6 6
7 #include "modules/websockets/WebSocketHandleClient.h" 7 #include "modules/websockets/WebSocketHandleClient.h"
8 #include "platform/WebTaskRunner.h" 8 #include "platform/WebTaskRunner.h"
9 #include "platform/network/NetworkLog.h" 9 #include "platform/network/NetworkLog.h"
10 #include "platform/network/WebSocketHandshakeRequest.h" 10 #include "platform/network/WebSocketHandshakeRequest.h"
(...skipping 15 matching lines...) Expand all
26 26
27 WebSocketHandleImpl::WebSocketHandleImpl() 27 WebSocketHandleImpl::WebSocketHandleImpl()
28 : m_client(nullptr), m_clientBinding(this) { 28 : m_client(nullptr), m_clientBinding(this) {
29 NETWORK_DVLOG(1) << this << " created"; 29 NETWORK_DVLOG(1) << this << " created";
30 } 30 }
31 31
32 WebSocketHandleImpl::~WebSocketHandleImpl() { 32 WebSocketHandleImpl::~WebSocketHandleImpl() {
33 NETWORK_DVLOG(1) << this << " deleted"; 33 NETWORK_DVLOG(1) << this << " deleted";
34 34
35 if (m_websocket) 35 if (m_websocket)
36 m_websocket->StartClosingHandshake(kAbnormalShutdownOpCode, emptyString()); 36 m_websocket->StartClosingHandshake(kAbnormalShutdownOpCode, emptyString);
37 } 37 }
38 38
39 void WebSocketHandleImpl::initialize(InterfaceProvider* interfaceProvider) { 39 void WebSocketHandleImpl::initialize(InterfaceProvider* interfaceProvider) {
40 NETWORK_DVLOG(1) << this << " initialize(...)"; 40 NETWORK_DVLOG(1) << this << " initialize(...)";
41 41
42 DCHECK(!m_websocket); 42 DCHECK(!m_websocket);
43 interfaceProvider->getInterface(mojo::MakeRequest(&m_websocket)); 43 interfaceProvider->getInterface(mojo::MakeRequest(&m_websocket));
44 44
45 m_websocket.set_connection_error_with_reason_handler( 45 m_websocket.set_connection_error_with_reason_handler(
46 convertToBaseCallback(WTF::bind(&WebSocketHandleImpl::onConnectionError, 46 convertToBaseCallback(WTF::bind(&WebSocketHandleImpl::onConnectionError,
(...skipping 10 matching lines...) Expand all
57 57
58 NETWORK_DVLOG(1) << this << " connect(" << url.getString() << ", " 58 NETWORK_DVLOG(1) << this << " connect(" << url.getString() << ", "
59 << origin->toString() << ")"; 59 << origin->toString() << ")";
60 60
61 DCHECK(!m_client); 61 DCHECK(!m_client);
62 DCHECK(client); 62 DCHECK(client);
63 m_client = client; 63 m_client = client;
64 64
65 m_websocket->AddChannelRequest( 65 m_websocket->AddChannelRequest(
66 url, protocols, origin, firstPartyForCookies, 66 url, protocols, origin, firstPartyForCookies,
67 userAgentOverride.isNull() ? emptyString() : userAgentOverride, 67 userAgentOverride.isNull() ? emptyString : userAgentOverride,
68 m_clientBinding.CreateInterfacePtrAndBind( 68 m_clientBinding.CreateInterfacePtrAndBind(
69 Platform::current() 69 Platform::current()
70 ->currentThread() 70 ->currentThread()
71 ->scheduler() 71 ->scheduler()
72 ->loadingTaskRunner() 72 ->loadingTaskRunner()
73 ->toSingleThreadTaskRunner())); 73 ->toSingleThreadTaskRunner()));
74 } 74 }
75 75
76 void WebSocketHandleImpl::send(bool fin, 76 void WebSocketHandleImpl::send(bool fin,
77 WebSocketHandle::MessageType type, 77 WebSocketHandle::MessageType type,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 m_websocket->SendFlowControl(quota); 113 m_websocket->SendFlowControl(quota);
114 } 114 }
115 115
116 void WebSocketHandleImpl::close(unsigned short code, const String& reason) { 116 void WebSocketHandleImpl::close(unsigned short code, const String& reason) {
117 DCHECK(m_websocket); 117 DCHECK(m_websocket);
118 118
119 NETWORK_DVLOG(1) << this << " close(" << code << ", " << reason << ")"; 119 NETWORK_DVLOG(1) << this << " close(" << code << ", " << reason << ")";
120 120
121 m_websocket->StartClosingHandshake(code, 121 m_websocket->StartClosingHandshake(code,
122 reason.isNull() ? emptyString() : reason); 122 reason.isNull() ? emptyString : reason);
123 } 123 }
124 124
125 void WebSocketHandleImpl::disconnect() { 125 void WebSocketHandleImpl::disconnect() {
126 m_websocket.reset(); 126 m_websocket.reset();
127 m_client = nullptr; 127 m_client = nullptr;
128 } 128 }
129 129
130 void WebSocketHandleImpl::onConnectionError(uint32_t customReason, 130 void WebSocketHandleImpl::onConnectionError(uint32_t customReason,
131 const std::string& description) { 131 const std::string& description) {
132 if (!blink::Platform::current()) { 132 if (!blink::Platform::current()) {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 void WebSocketHandleImpl::OnClosingHandshake() { 262 void WebSocketHandleImpl::OnClosingHandshake() {
263 NETWORK_DVLOG(1) << this << " OnClosingHandshake()"; 263 NETWORK_DVLOG(1) << this << " OnClosingHandshake()";
264 if (!m_client) 264 if (!m_client)
265 return; 265 return;
266 266
267 m_client->didStartClosingHandshake(this); 267 m_client->didStartClosingHandshake(this);
268 // |this| can be deleted here. 268 // |this| can be deleted here.
269 } 269 }
270 270
271 } // namespace blink 271 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698