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

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

Issue 266483003: [WebSocket] Do nothing for connect() if initialization has failed. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698