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