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 12 matching lines...) Expand all Loading... |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "modules/websockets/DOMWebSocket.h" | 31 #include "modules/websockets/DOMWebSocket.h" |
32 | 32 |
| 33 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
33 #include "bindings/core/v8/ExceptionState.h" | 34 #include "bindings/core/v8/ExceptionState.h" |
34 #include "bindings/core/v8/ScriptController.h" | 35 #include "bindings/core/v8/ScriptController.h" |
35 #include "bindings/core/v8/SourceLocation.h" | 36 #include "bindings/core/v8/SourceLocation.h" |
36 #include "bindings/modules/v8/StringOrStringSequence.h" | 37 #include "bindings/modules/v8/StringOrStringSequence.h" |
| 38 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 39 #include "bindings/modules/v8/UnionTypesModules.h" |
37 #include "core/dom/DOMArrayBuffer.h" | 40 #include "core/dom/DOMArrayBuffer.h" |
38 #include "core/dom/DOMArrayBufferView.h" | 41 #include "core/dom/DOMArrayBufferView.h" |
39 #include "core/dom/Document.h" | 42 #include "core/dom/Document.h" |
40 #include "core/dom/ExceptionCode.h" | 43 #include "core/dom/ExceptionCode.h" |
41 #include "core/dom/ExecutionContext.h" | 44 #include "core/dom/ExecutionContext.h" |
42 #include "core/dom/SecurityContext.h" | 45 #include "core/dom/SecurityContext.h" |
43 #include "core/events/MessageEvent.h" | 46 #include "core/events/MessageEvent.h" |
44 #include "core/fileapi/Blob.h" | 47 #include "core/fileapi/Blob.h" |
45 #include "core/frame/LocalDOMWindow.h" | 48 #include "core/frame/LocalDOMWindow.h" |
46 #include "core/frame/LocalFrame.h" | 49 #include "core/frame/LocalFrame.h" |
47 #include "core/frame/UseCounter.h" | 50 #include "core/frame/UseCounter.h" |
48 #include "core/frame/csp/ContentSecurityPolicy.h" | 51 #include "core/frame/csp/ContentSecurityPolicy.h" |
49 #include "core/inspector/ConsoleMessage.h" | 52 #include "core/inspector/ConsoleMessage.h" |
50 #include "modules/websockets/CloseEvent.h" | 53 #include "modules/websockets/CloseEvent.h" |
51 #include "platform/Histogram.h" | 54 #include "platform/Histogram.h" |
52 #include "platform/Logging.h" | 55 #include "platform/Logging.h" |
53 #include "platform/blob/BlobData.h" | 56 #include "platform/blob/BlobData.h" |
54 #include "platform/heap/Handle.h" | 57 #include "platform/heap/Handle.h" |
55 #include "platform/weborigin/KnownPorts.h" | 58 #include "platform/weborigin/KnownPorts.h" |
56 #include "platform/weborigin/SecurityOrigin.h" | 59 #include "platform/weborigin/SecurityOrigin.h" |
57 #include "public/platform/Platform.h" | 60 #include "public/platform/Platform.h" |
58 #include "public/platform/WebInsecureRequestPolicy.h" | 61 #include "public/platform/WebInsecureRequestPolicy.h" |
| 62 #include "public/platform/modules/websockets/WebSocketHandle.h" |
59 #include "wtf/Assertions.h" | 63 #include "wtf/Assertions.h" |
60 #include "wtf/HashSet.h" | 64 #include "wtf/HashSet.h" |
61 #include "wtf/PassOwnPtr.h" | 65 #include "wtf/PassOwnPtr.h" |
62 #include "wtf/StdLibExtras.h" | 66 #include "wtf/StdLibExtras.h" |
63 #include "wtf/text/CString.h" | 67 #include "wtf/text/CString.h" |
64 #include "wtf/text/StringBuilder.h" | 68 #include "wtf/text/StringBuilder.h" |
65 #include "wtf/text/WTFString.h" | 69 #include "wtf/text/WTFString.h" |
66 | 70 |
67 namespace blink { | 71 namespace blink { |
68 | 72 |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, sendTypeHistogram, new
EnumerationHistogram("WebCore.WebSocket.SendType", WebSocketSendTypeMax)); | 710 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, sendTypeHistogram, new
EnumerationHistogram("WebCore.WebSocket.SendType", WebSocketSendTypeMax)); |
707 sendTypeHistogram.count(type); | 711 sendTypeHistogram.count(type); |
708 } | 712 } |
709 | 713 |
710 void DOMWebSocket::recordReceiveTypeHistogram(WebSocketReceiveType type) | 714 void DOMWebSocket::recordReceiveTypeHistogram(WebSocketReceiveType type) |
711 { | 715 { |
712 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, receiveTypeHistogram,
new EnumerationHistogram("WebCore.WebSocket.ReceiveType", WebSocketReceiveTypeMa
x)); | 716 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, receiveTypeHistogram,
new EnumerationHistogram("WebCore.WebSocket.ReceiveType", WebSocketReceiveTypeMa
x)); |
713 receiveTypeHistogram.count(type); | 717 receiveTypeHistogram.count(type); |
714 } | 718 } |
715 | 719 |
| 720 ScriptPromise DOMWebSocket::loaderTestTransmitChromiumIPC(ScriptState* scriptSta
te, int bucketSize, int bufferSize, int totalSize) |
| 721 { |
| 722 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; |
| 723 ScriptPromise promise = resolver->promise(); |
| 724 if (m_channel) { |
| 725 m_channel->loaderTestTransmit(WebSocketHandle::ViaChromiumIPC, false, bu
cketSize, bufferSize, totalSize, new CallbackPromiseAdapter<int, void>(resolver)
); |
| 726 } else { |
| 727 resolver->reject("channel is null"); |
| 728 } |
| 729 return promise; |
| 730 } |
| 731 |
| 732 ScriptPromise DOMWebSocket::loaderTestTransmitMojo(ScriptState* scriptState, int
bucketSize, int bufferSize, int totalSize) |
| 733 { |
| 734 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; |
| 735 ScriptPromise promise = resolver->promise(); |
| 736 if (m_channel) { |
| 737 m_channel->loaderTestTransmit(WebSocketHandle::ViaMojo, false, bucketSiz
e, bufferSize, totalSize, new CallbackPromiseAdapter<int, void>(resolver)); |
| 738 } else { |
| 739 resolver->reject("channel is null"); |
| 740 } |
| 741 return promise; |
| 742 } |
| 743 |
716 DEFINE_TRACE(DOMWebSocket) | 744 DEFINE_TRACE(DOMWebSocket) |
717 { | 745 { |
718 visitor->trace(m_channel); | 746 visitor->trace(m_channel); |
719 visitor->trace(m_eventQueue); | 747 visitor->trace(m_eventQueue); |
720 WebSocketChannelClient::trace(visitor); | 748 WebSocketChannelClient::trace(visitor); |
721 EventTargetWithInlineData::trace(visitor); | 749 EventTargetWithInlineData::trace(visitor); |
722 ActiveDOMObject::trace(visitor); | 750 ActiveDOMObject::trace(visitor); |
723 } | 751 } |
724 | 752 |
725 } // namespace blink | 753 } // namespace blink |
OLD | NEW |