OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 "bindings/core/v8/ExceptionState.h" | 33 #include "bindings/core/v8/ExceptionState.h" |
34 #include "bindings/core/v8/ScriptController.h" | 34 #include "bindings/core/v8/ScriptController.h" |
35 #include "bindings/core/v8/SourceLocation.h" | 35 #include "bindings/core/v8/SourceLocation.h" |
36 #include "bindings/modules/v8/StringOrStringSequence.h" | 36 #include "bindings/modules/v8/StringOrStringSequence.h" |
37 #include "core/dom/DOMArrayBuffer.h" | 37 #include "core/dom/DOMArrayBuffer.h" |
38 #include "core/dom/DOMArrayBufferView.h" | 38 #include "core/dom/DOMArrayBufferView.h" |
39 #include "core/dom/Document.h" | 39 #include "core/dom/Document.h" |
40 #include "core/dom/ExceptionCode.h" | 40 #include "core/dom/ExceptionCode.h" |
41 #include "core/dom/ExecutionContext.h" | 41 #include "core/dom/ExecutionContext.h" |
42 #include "core/dom/SecurityContext.h" | 42 #include "core/dom/SecurityContext.h" |
| 43 #include "core/dom/TaskRunnerHelper.h" |
43 #include "core/events/MessageEvent.h" | 44 #include "core/events/MessageEvent.h" |
44 #include "core/fileapi/Blob.h" | 45 #include "core/fileapi/Blob.h" |
45 #include "core/frame/LocalDOMWindow.h" | 46 #include "core/frame/LocalDOMWindow.h" |
46 #include "core/frame/LocalFrame.h" | 47 #include "core/frame/LocalFrame.h" |
47 #include "core/frame/UseCounter.h" | 48 #include "core/frame/UseCounter.h" |
48 #include "core/frame/csp/ContentSecurityPolicy.h" | 49 #include "core/frame/csp/ContentSecurityPolicy.h" |
49 #include "core/inspector/ConsoleMessage.h" | 50 #include "core/inspector/ConsoleMessage.h" |
50 #include "modules/websockets/CloseEvent.h" | 51 #include "modules/websockets/CloseEvent.h" |
51 #include "platform/Histogram.h" | 52 #include "platform/Histogram.h" |
52 #include "platform/blob/BlobData.h" | 53 #include "platform/blob/BlobData.h" |
(...skipping 10 matching lines...) Expand all Loading... |
63 #include "wtf/text/StringBuilder.h" | 64 #include "wtf/text/StringBuilder.h" |
64 | 65 |
65 static const size_t kMaxByteSizeForHistogram = 100 * 1000 * 1000; | 66 static const size_t kMaxByteSizeForHistogram = 100 * 1000 * 1000; |
66 static const int32_t kBucketCountForMessageSizeHistogram = 50; | 67 static const int32_t kBucketCountForMessageSizeHistogram = 50; |
67 | 68 |
68 namespace blink { | 69 namespace blink { |
69 | 70 |
70 DOMWebSocket::EventQueue::EventQueue(EventTarget* target) | 71 DOMWebSocket::EventQueue::EventQueue(EventTarget* target) |
71 : m_state(Active), | 72 : m_state(Active), |
72 m_target(target), | 73 m_target(target), |
73 m_resumeTimer(this, &EventQueue::resumeTimerFired) {} | 74 m_resumeTimer(TaskRunnerHelper::get(TaskType::WebSocket, |
| 75 target->getExecutionContext()), |
| 76 this, |
| 77 &EventQueue::resumeTimerFired) {} |
74 | 78 |
75 DOMWebSocket::EventQueue::~EventQueue() { | 79 DOMWebSocket::EventQueue::~EventQueue() { |
76 contextDestroyed(); | 80 contextDestroyed(); |
77 } | 81 } |
78 | 82 |
79 void DOMWebSocket::EventQueue::dispatch(Event* event) { | 83 void DOMWebSocket::EventQueue::dispatch(Event* event) { |
80 switch (m_state) { | 84 switch (m_state) { |
81 case Active: | 85 case Active: |
82 DCHECK(m_events.isEmpty()); | 86 DCHECK(m_events.isEmpty()); |
83 DCHECK(m_target->getExecutionContext()); | 87 DCHECK(m_target->getExecutionContext()); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 m_state(kConnecting), | 226 m_state(kConnecting), |
223 m_bufferedAmount(0), | 227 m_bufferedAmount(0), |
224 m_consumedBufferedAmount(0), | 228 m_consumedBufferedAmount(0), |
225 m_bufferedAmountAfterClose(0), | 229 m_bufferedAmountAfterClose(0), |
226 m_binaryType(BinaryTypeBlob), | 230 m_binaryType(BinaryTypeBlob), |
227 m_binaryTypeChangesAfterOpen(0), | 231 m_binaryTypeChangesAfterOpen(0), |
228 m_subprotocol(""), | 232 m_subprotocol(""), |
229 m_extensions(""), | 233 m_extensions(""), |
230 m_eventQueue(EventQueue::create(this)), | 234 m_eventQueue(EventQueue::create(this)), |
231 m_bufferedAmountConsumeTimer( | 235 m_bufferedAmountConsumeTimer( |
| 236 TaskRunnerHelper::get(TaskType::WebSocket, context), |
232 this, | 237 this, |
233 &DOMWebSocket::reflectBufferedAmountConsumption) {} | 238 &DOMWebSocket::reflectBufferedAmountConsumption) {} |
234 | 239 |
235 DOMWebSocket::~DOMWebSocket() { | 240 DOMWebSocket::~DOMWebSocket() { |
236 DCHECK(!m_channel); | 241 DCHECK(!m_channel); |
237 } | 242 } |
238 | 243 |
239 void DOMWebSocket::logError(const String& message) { | 244 void DOMWebSocket::logError(const String& message) { |
240 if (getExecutionContext()) | 245 if (getExecutionContext()) |
241 getExecutionContext()->addConsoleMessage( | 246 getExecutionContext()->addConsoleMessage( |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 | 864 |
860 DEFINE_TRACE(DOMWebSocket) { | 865 DEFINE_TRACE(DOMWebSocket) { |
861 visitor->trace(m_channel); | 866 visitor->trace(m_channel); |
862 visitor->trace(m_eventQueue); | 867 visitor->trace(m_eventQueue); |
863 WebSocketChannelClient::trace(visitor); | 868 WebSocketChannelClient::trace(visitor); |
864 EventTargetWithInlineData::trace(visitor); | 869 EventTargetWithInlineData::trace(visitor); |
865 SuspendableObject::trace(visitor); | 870 SuspendableObject::trace(visitor); |
866 } | 871 } |
867 | 872 |
868 } // namespace blink | 873 } // namespace blink |
OLD | NEW |