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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
483 m_loaderProxy.postTaskToLoader(createCallbackTask(&Peer::initialize, referen ce.release(), AllowCrossThreadAccess(&m_loaderProxy), m_workerClientWrapper, sou rceURL, lineNumber, syncHelper.release())); | 483 m_loaderProxy.postTaskToLoader(createCallbackTask(&Peer::initialize, referen ce.release(), AllowCrossThreadAccess(&m_loaderProxy), m_workerClientWrapper, sou rceURL, lineNumber, syncHelper.release())); |
484 if (!waitForMethodCompletion()) { | 484 if (!waitForMethodCompletion()) { |
485 // The worker thread has been signalled to shutdown before method comple tion. | 485 // The worker thread has been signalled to shutdown before method comple tion. |
486 terminatePeer(); | 486 terminatePeer(); |
487 } | 487 } |
488 } | 488 } |
489 | 489 |
490 bool WorkerThreadableWebSocketChannel::Bridge::connect(const KURL& url, const St ring& protocol) | 490 bool WorkerThreadableWebSocketChannel::Bridge::connect(const KURL& url, const St ring& protocol) |
491 { | 491 { |
492 ASSERT(m_workerClientWrapper); | 492 ASSERT(m_workerClientWrapper); |
493 if (!m_workerGlobalScope) | |
yhirano
2014/04/30 07:17:08
m_syncHelper?
tyoshino (SeeGerritForStatus)
2014/04/30 07:36:23
m_workerGlobalScope can also tell whether initiali
| |
494 return false; | |
495 ASSERT(m_syncHelper); | |
493 m_loaderProxy.postTaskToLoader(CallClosureTask::create(bind(&Peer::connect, m_peer, url.copy(), protocol.isolatedCopy()))); | 496 m_loaderProxy.postTaskToLoader(CallClosureTask::create(bind(&Peer::connect, m_peer, url.copy(), protocol.isolatedCopy()))); |
494 RefPtr<Bridge> protect(this); | 497 RefPtr<Bridge> protect(this); |
495 waitForMethodCompletion(); | 498 waitForMethodCompletion(); |
496 return m_syncHelper->connectRequestResult(); | 499 return m_syncHelper->connectRequestResult(); |
497 } | 500 } |
498 | 501 |
499 WebSocketChannel::SendResult WorkerThreadableWebSocketChannel::Bridge::send(cons t String& message) | 502 WebSocketChannel::SendResult WorkerThreadableWebSocketChannel::Bridge::send(cons t String& message) |
500 { | 503 { |
501 if (!m_workerClientWrapper || !m_workerGlobalScope) | 504 if (!m_workerClientWrapper || !m_workerGlobalScope) |
502 return WebSocketChannel::SendFail; | 505 return WebSocketChannel::SendFail; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
594 } | 597 } |
595 | 598 |
596 void WorkerThreadableWebSocketChannel::Bridge::terminatePeer() | 599 void WorkerThreadableWebSocketChannel::Bridge::terminatePeer() |
597 { | 600 { |
598 m_loaderProxy.postTaskToLoader(CallClosureTask::create(bind(&Peer::destroy, m_peer))); | 601 m_loaderProxy.postTaskToLoader(CallClosureTask::create(bind(&Peer::destroy, m_peer))); |
599 m_workerGlobalScope = nullptr; | 602 m_workerGlobalScope = nullptr; |
600 m_syncHelper = 0; | 603 m_syncHelper = 0; |
601 } | 604 } |
602 | 605 |
603 } // namespace WebCore | 606 } // namespace WebCore |
OLD | NEW |