| 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 24 matching lines...) Expand all Loading... |
| 35 #include "core/dom/CrossThreadTask.h" | 35 #include "core/dom/CrossThreadTask.h" |
| 36 #include "core/dom/DOMArrayBuffer.h" | 36 #include "core/dom/DOMArrayBuffer.h" |
| 37 #include "core/dom/Document.h" | 37 #include "core/dom/Document.h" |
| 38 #include "core/dom/ExecutionContext.h" | 38 #include "core/dom/ExecutionContext.h" |
| 39 #include "core/dom/ExecutionContextTask.h" | 39 #include "core/dom/ExecutionContextTask.h" |
| 40 #include "core/fileapi/Blob.h" | 40 #include "core/fileapi/Blob.h" |
| 41 #include "core/inspector/ScriptCallFrame.h" | 41 #include "core/inspector/ScriptCallFrame.h" |
| 42 #include "core/inspector/ScriptCallStack.h" | 42 #include "core/inspector/ScriptCallStack.h" |
| 43 #include "core/workers/WorkerGlobalScope.h" | 43 #include "core/workers/WorkerGlobalScope.h" |
| 44 #include "core/workers/WorkerLoaderProxy.h" | 44 #include "core/workers/WorkerLoaderProxy.h" |
| 45 #include "core/workers/WorkerThread.h" | 45 #include "core/workers/WorkerScript.h" |
| 46 #include "modules/websockets/DocumentWebSocketChannel.h" | 46 #include "modules/websockets/DocumentWebSocketChannel.h" |
| 47 #include "platform/heap/SafePoint.h" | 47 #include "platform/heap/SafePoint.h" |
| 48 #include "public/platform/Platform.h" | 48 #include "public/platform/Platform.h" |
| 49 #include "public/platform/WebWaitableEvent.h" | 49 #include "public/platform/WebWaitableEvent.h" |
| 50 #include "wtf/Assertions.h" | 50 #include "wtf/Assertions.h" |
| 51 #include "wtf/Functional.h" | 51 #include "wtf/Functional.h" |
| 52 #include "wtf/MainThread.h" | 52 #include "wtf/MainThread.h" |
| 53 #include "wtf/text/CString.h" | 53 #include "wtf/text/CString.h" |
| 54 #include "wtf/text/WTFString.h" | 54 #include "wtf/text/WTFString.h" |
| 55 | 55 |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 { | 368 { |
| 369 visitor->trace(m_bridge); | 369 visitor->trace(m_bridge); |
| 370 visitor->trace(m_mainWebSocketChannel); | 370 visitor->trace(m_mainWebSocketChannel); |
| 371 visitor->trace(m_syncHelper); | 371 visitor->trace(m_syncHelper); |
| 372 WebSocketChannelClient::trace(visitor); | 372 WebSocketChannelClient::trace(visitor); |
| 373 } | 373 } |
| 374 | 374 |
| 375 Bridge::Bridge(WebSocketChannelClient* client, WorkerGlobalScope& workerGlobalSc
ope) | 375 Bridge::Bridge(WebSocketChannelClient* client, WorkerGlobalScope& workerGlobalSc
ope) |
| 376 : m_client(client) | 376 : m_client(client) |
| 377 , m_workerGlobalScope(workerGlobalScope) | 377 , m_workerGlobalScope(workerGlobalScope) |
| 378 , m_loaderProxy(m_workerGlobalScope->thread()->workerLoaderProxy()) | 378 , m_loaderProxy(m_workerGlobalScope->script()->workerLoaderProxy()) |
| 379 , m_syncHelper(WebSocketChannelSyncHelper::create(adoptPtr(Platform::current
()->createWaitableEvent()))) | 379 , m_syncHelper(WebSocketChannelSyncHelper::create(adoptPtr(Platform::current
()->createWaitableEvent()))) |
| 380 , m_peer(new Peer(this, m_loaderProxy, m_syncHelper)) | 380 , m_peer(new Peer(this, m_loaderProxy, m_syncHelper)) |
| 381 { | 381 { |
| 382 } | 382 } |
| 383 | 383 |
| 384 Bridge::~Bridge() | 384 Bridge::~Bridge() |
| 385 { | 385 { |
| 386 ASSERT(!m_peer); | 386 ASSERT(!m_peer); |
| 387 } | 387 } |
| 388 | 388 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 ASSERT(m_workerGlobalScope); | 466 ASSERT(m_workerGlobalScope); |
| 467 ASSERT(m_syncHelper); | 467 ASSERT(m_syncHelper); |
| 468 | 468 |
| 469 m_loaderProxy->postTaskToLoader(task); | 469 m_loaderProxy->postTaskToLoader(task); |
| 470 | 470 |
| 471 // We wait for the syncHelper event even if a shutdown event is fired. | 471 // We wait for the syncHelper event even if a shutdown event is fired. |
| 472 // See https://codereview.chromium.org/267323004/#msg43 for why we need to w
ait this. | 472 // See https://codereview.chromium.org/267323004/#msg43 for why we need to w
ait this. |
| 473 SafePointScope scope(ThreadState::HeapPointersOnStack); | 473 SafePointScope scope(ThreadState::HeapPointersOnStack); |
| 474 m_syncHelper->wait(); | 474 m_syncHelper->wait(); |
| 475 // This is checking whether a shutdown event is fired or not. | 475 // This is checking whether a shutdown event is fired or not. |
| 476 return !m_workerGlobalScope->thread()->terminated(); | 476 return !m_workerGlobalScope->script()->terminated(); |
| 477 } | 477 } |
| 478 | 478 |
| 479 DEFINE_TRACE(Bridge) | 479 DEFINE_TRACE(Bridge) |
| 480 { | 480 { |
| 481 visitor->trace(m_client); | 481 visitor->trace(m_client); |
| 482 visitor->trace(m_workerGlobalScope); | 482 visitor->trace(m_workerGlobalScope); |
| 483 visitor->trace(m_syncHelper); | 483 visitor->trace(m_syncHelper); |
| 484 visitor->trace(m_peer); | 484 visitor->trace(m_peer); |
| 485 } | 485 } |
| 486 | 486 |
| 487 } // namespace blink | 487 } // namespace blink |
| OLD | NEW |