OLD | NEW |
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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 void WorkerThreadableWebSocketChannel::resume() | 215 void WorkerThreadableWebSocketChannel::resume() |
216 { | 216 { |
217 m_workerClientWrapper->resume(); | 217 m_workerClientWrapper->resume(); |
218 if (m_bridge) | 218 if (m_bridge) |
219 m_bridge->resume(); | 219 m_bridge->resume(); |
220 } | 220 } |
221 | 221 |
222 WorkerThreadableWebSocketChannel::Peer::Peer(PassRefPtr<WeakReference<Peer> > re
ference, PassRefPtr<ThreadableWebSocketChannelClientWrapper> clientWrapper, Work
erLoaderProxy& loaderProxy, ExecutionContext* context, const String& sourceURL,
unsigned lineNumber, PassOwnPtr<ThreadableWebSocketChannelSyncHelper> syncHelper
) | 222 WorkerThreadableWebSocketChannel::Peer::Peer(PassRefPtr<WeakReference<Peer> > re
ference, PassRefPtr<ThreadableWebSocketChannelClientWrapper> clientWrapper, Work
erLoaderProxy& loaderProxy, ExecutionContext* context, const String& sourceURL,
unsigned lineNumber, PassOwnPtr<ThreadableWebSocketChannelSyncHelper> syncHelper
) |
223 : m_workerClientWrapper(clientWrapper) | 223 : m_workerClientWrapper(clientWrapper) |
224 , m_loaderProxy(loaderProxy) | 224 , m_loaderProxy(loaderProxy) |
225 , m_mainWebSocketChannel(0) | 225 , m_mainWebSocketChannel(nullptr) |
226 , m_syncHelper(syncHelper) | 226 , m_syncHelper(syncHelper) |
227 , m_weakFactory(reference, this) | 227 , m_weakFactory(reference, this) |
228 { | 228 { |
229 ASSERT(isMainThread()); | 229 ASSERT(isMainThread()); |
230 Document* document = toDocument(context); | 230 Document* document = toDocument(context); |
231 if (RuntimeEnabledFeatures::experimentalWebSocketEnabled()) { | 231 if (RuntimeEnabledFeatures::experimentalWebSocketEnabled()) { |
232 m_mainWebSocketChannel = NewWebSocketChannelImpl::create(document, this,
sourceURL, lineNumber); | 232 m_mainWebSocketChannel = NewWebSocketChannelImpl::create(document, this,
sourceURL, lineNumber); |
233 } else { | 233 } else { |
234 m_mainWebSocketChannel = MainThreadWebSocketChannel::create(document, th
is, sourceURL, lineNumber); | 234 m_mainWebSocketChannel = MainThreadWebSocketChannel::create(document, th
is, sourceURL, lineNumber); |
235 } | 235 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 return; | 328 return; |
329 m_mainWebSocketChannel->fail(reason, level, sourceURL, lineNumber); | 329 m_mainWebSocketChannel->fail(reason, level, sourceURL, lineNumber); |
330 } | 330 } |
331 | 331 |
332 void WorkerThreadableWebSocketChannel::Peer::disconnect() | 332 void WorkerThreadableWebSocketChannel::Peer::disconnect() |
333 { | 333 { |
334 ASSERT(isMainThread()); | 334 ASSERT(isMainThread()); |
335 if (!m_mainWebSocketChannel) | 335 if (!m_mainWebSocketChannel) |
336 return; | 336 return; |
337 m_mainWebSocketChannel->disconnect(); | 337 m_mainWebSocketChannel->disconnect(); |
338 m_mainWebSocketChannel = 0; | 338 m_mainWebSocketChannel = nullptr; |
339 } | 339 } |
340 | 340 |
341 void WorkerThreadableWebSocketChannel::Peer::suspend() | 341 void WorkerThreadableWebSocketChannel::Peer::suspend() |
342 { | 342 { |
343 ASSERT(isMainThread()); | 343 ASSERT(isMainThread()); |
344 if (!m_mainWebSocketChannel) | 344 if (!m_mainWebSocketChannel) |
345 return; | 345 return; |
346 m_mainWebSocketChannel->suspend(); | 346 m_mainWebSocketChannel->suspend(); |
347 } | 347 } |
348 | 348 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 | 418 |
419 static void workerGlobalScopeDidClose(ExecutionContext* context, PassRefPtr<Thre
adableWebSocketChannelClientWrapper> workerClientWrapper, unsigned long unhandle
dBufferedAmount, WebSocketChannelClient::ClosingHandshakeCompletionStatus closin
gHandshakeCompletion, unsigned short code, const String& reason) | 419 static void workerGlobalScopeDidClose(ExecutionContext* context, PassRefPtr<Thre
adableWebSocketChannelClientWrapper> workerClientWrapper, unsigned long unhandle
dBufferedAmount, WebSocketChannelClient::ClosingHandshakeCompletionStatus closin
gHandshakeCompletion, unsigned short code, const String& reason) |
420 { | 420 { |
421 ASSERT_UNUSED(context, context->isWorkerGlobalScope()); | 421 ASSERT_UNUSED(context, context->isWorkerGlobalScope()); |
422 workerClientWrapper->didClose(unhandledBufferedAmount, closingHandshakeCompl
etion, code, reason); | 422 workerClientWrapper->didClose(unhandledBufferedAmount, closingHandshakeCompl
etion, code, reason); |
423 } | 423 } |
424 | 424 |
425 void WorkerThreadableWebSocketChannel::Peer::didClose(unsigned long unhandledBuf
feredAmount, ClosingHandshakeCompletionStatus closingHandshakeCompletion, unsign
ed short code, const String& reason) | 425 void WorkerThreadableWebSocketChannel::Peer::didClose(unsigned long unhandledBuf
feredAmount, ClosingHandshakeCompletionStatus closingHandshakeCompletion, unsign
ed short code, const String& reason) |
426 { | 426 { |
427 ASSERT(isMainThread()); | 427 ASSERT(isMainThread()); |
428 m_mainWebSocketChannel = 0; | 428 m_mainWebSocketChannel = nullptr; |
429 m_loaderProxy.postTaskToWorkerGlobalScope(createCallbackTask(&workerGlobalSc
opeDidClose, m_workerClientWrapper, unhandledBufferedAmount, closingHandshakeCom
pletion, code, reason)); | 429 m_loaderProxy.postTaskToWorkerGlobalScope(createCallbackTask(&workerGlobalSc
opeDidClose, m_workerClientWrapper, unhandledBufferedAmount, closingHandshakeCom
pletion, code, reason)); |
430 } | 430 } |
431 | 431 |
432 static void workerGlobalScopeDidReceiveMessageError(ExecutionContext* context, P
assRefPtr<ThreadableWebSocketChannelClientWrapper> workerClientWrapper) | 432 static void workerGlobalScopeDidReceiveMessageError(ExecutionContext* context, P
assRefPtr<ThreadableWebSocketChannelClientWrapper> workerClientWrapper) |
433 { | 433 { |
434 ASSERT_UNUSED(context, context->isWorkerGlobalScope()); | 434 ASSERT_UNUSED(context, context->isWorkerGlobalScope()); |
435 workerClientWrapper->didReceiveMessageError(); | 435 workerClientWrapper->didReceiveMessageError(); |
436 } | 436 } |
437 | 437 |
438 void WorkerThreadableWebSocketChannel::Peer::didReceiveMessageError() | 438 void WorkerThreadableWebSocketChannel::Peer::didReceiveMessageError() |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 events.append(shutdownEvent); | 569 events.append(shutdownEvent); |
570 events.append(m_syncHelper->event()); | 570 events.append(m_syncHelper->event()); |
571 | 571 |
572 blink::WebWaitableEvent* signalled = blink::Platform::current()->waitMultipl
eEvents(events); | 572 blink::WebWaitableEvent* signalled = blink::Platform::current()->waitMultipl
eEvents(events); |
573 return signalled != shutdownEvent; | 573 return signalled != shutdownEvent; |
574 } | 574 } |
575 | 575 |
576 void WorkerThreadableWebSocketChannel::Bridge::terminatePeer() | 576 void WorkerThreadableWebSocketChannel::Bridge::terminatePeer() |
577 { | 577 { |
578 m_loaderProxy.postTaskToLoader(CallClosureTask::create(bind(&Peer::destroy,
m_peer))); | 578 m_loaderProxy.postTaskToLoader(CallClosureTask::create(bind(&Peer::destroy,
m_peer))); |
579 m_workerGlobalScope = 0; | 579 m_workerGlobalScope = nullptr; |
580 m_syncHelper = 0; | 580 m_syncHelper = 0; |
581 } | 581 } |
582 | 582 |
583 } // namespace WebCore | 583 } // namespace WebCore |
OLD | NEW |