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 22 matching lines...) Expand all Loading... |
33 #include "modules/websockets/WorkerThreadableWebSocketChannel.h" | 33 #include "modules/websockets/WorkerThreadableWebSocketChannel.h" |
34 | 34 |
35 #include "bindings/v8/ScriptCallStackFactory.h" | 35 #include "bindings/v8/ScriptCallStackFactory.h" |
36 #include "core/dom/CrossThreadTask.h" | 36 #include "core/dom/CrossThreadTask.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/fileapi/Blob.h" | 39 #include "core/fileapi/Blob.h" |
40 #include "core/inspector/ScriptCallFrame.h" | 40 #include "core/inspector/ScriptCallFrame.h" |
41 #include "core/inspector/ScriptCallStack.h" | 41 #include "core/inspector/ScriptCallStack.h" |
42 #include "core/page/Settings.h" | 42 #include "core/page/Settings.h" |
43 #include "core/workers/WorkerGlobalScope.h" | |
44 #include "core/workers/WorkerLoaderProxy.h" | 43 #include "core/workers/WorkerLoaderProxy.h" |
45 #include "core/workers/WorkerRunLoop.h" | 44 #include "core/workers/WorkerRunLoop.h" |
46 #include "core/workers/WorkerThread.h" | 45 #include "core/workers/WorkerThread.h" |
47 #include "modules/websockets/MainThreadWebSocketChannel.h" | 46 #include "modules/websockets/MainThreadWebSocketChannel.h" |
48 #include "modules/websockets/ThreadableWebSocketChannelClientWrapper.h" | 47 #include "modules/websockets/ThreadableWebSocketChannelClientWrapper.h" |
49 #include "modules/websockets/WebSocketChannel.h" | |
50 #include "modules/websockets/WebSocketChannelClient.h" | |
51 #include "wtf/ArrayBuffer.h" | 48 #include "wtf/ArrayBuffer.h" |
52 #include "wtf/MainThread.h" | 49 #include "wtf/MainThread.h" |
53 #include "wtf/PassRefPtr.h" | |
54 #include "wtf/text/WTFString.h" | |
55 | 50 |
56 namespace WebCore { | 51 namespace WebCore { |
57 | 52 |
58 WorkerThreadableWebSocketChannel::WorkerThreadableWebSocketChannel(WorkerGlobalS
cope* context, WebSocketChannelClient* client, const String& taskMode) | 53 WorkerThreadableWebSocketChannel::WorkerThreadableWebSocketChannel(WorkerGlobalS
cope* context, WebSocketChannelClient* client, const String& taskMode) |
59 : m_workerGlobalScope(context) | 54 : m_workerGlobalScope(context) |
60 , m_workerClientWrapper(ThreadableWebSocketChannelClientWrapper::create(cont
ext, client)) | 55 , m_workerClientWrapper(ThreadableWebSocketChannelClientWrapper::create(cont
ext, client)) |
61 , m_bridge(Bridge::create(m_workerClientWrapper, m_workerGlobalScope, taskMo
de)) | 56 , m_bridge(Bridge::create(m_workerClientWrapper, m_workerGlobalScope, taskMo
de)) |
62 , m_lineNumberAtConnection(0) | 57 , m_lineNumberAtConnection(0) |
63 { | 58 { |
64 // We assume that we can take the JS callstack at WebSocket connection here. | 59 // We assume that we can take the JS callstack at WebSocket connection here. |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 WorkerRunLoop& runLoop = m_workerGlobalScope->thread()->runLoop(); | 675 WorkerRunLoop& runLoop = m_workerGlobalScope->thread()->runLoop(); |
681 MessageQueueWaitResult result = MessageQueueMessageReceived; | 676 MessageQueueWaitResult result = MessageQueueMessageReceived; |
682 ThreadableWebSocketChannelClientWrapper* clientWrapper = m_workerClientWrapp
er.get(); | 677 ThreadableWebSocketChannelClientWrapper* clientWrapper = m_workerClientWrapp
er.get(); |
683 while (m_workerGlobalScope && clientWrapper && !clientWrapper->syncMethodDon
e() && result != MessageQueueTerminated) { | 678 while (m_workerGlobalScope && clientWrapper && !clientWrapper->syncMethodDon
e() && result != MessageQueueTerminated) { |
684 result = runLoop.runInMode(m_workerGlobalScope.get(), m_taskMode); // Ma
y cause this bridge to get disconnected, which makes m_workerGlobalScope become
null. | 679 result = runLoop.runInMode(m_workerGlobalScope.get(), m_taskMode); // Ma
y cause this bridge to get disconnected, which makes m_workerGlobalScope become
null. |
685 clientWrapper = m_workerClientWrapper.get(); | 680 clientWrapper = m_workerClientWrapper.get(); |
686 } | 681 } |
687 } | 682 } |
688 | 683 |
689 } // namespace WebCore | 684 } // namespace WebCore |
OLD | NEW |