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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 namespace blink { | 50 namespace blink { |
51 | 51 |
52 class BlobDataHandle; | 52 class BlobDataHandle; |
53 class Document; | 53 class Document; |
54 class FileReaderLoader; | 54 class FileReaderLoader; |
55 class SocketStreamHandle; | 55 class SocketStreamHandle; |
56 class SocketStreamError; | 56 class SocketStreamError; |
57 class WebSocketChannelClient; | 57 class WebSocketChannelClient; |
58 | 58 |
59 class MainThreadWebSocketChannel FINAL : public WebSocketChannel, public SocketS
treamHandleClient, public FileReaderLoaderClient { | 59 class MainThreadWebSocketChannel final : public WebSocketChannel, public SocketS
treamHandleClient, public FileReaderLoaderClient { |
60 USING_GARBAGE_COLLECTED_MIXIN(MainThreadWebSocketChannel); | 60 USING_GARBAGE_COLLECTED_MIXIN(MainThreadWebSocketChannel); |
61 public: | 61 public: |
62 // You can specify the source file and the line number information | 62 // You can specify the source file and the line number information |
63 // explicitly by passing the last parameter. | 63 // explicitly by passing the last parameter. |
64 // In the usual case, they are set automatically and you don't have to | 64 // In the usual case, they are set automatically and you don't have to |
65 // pass it. | 65 // pass it. |
66 static MainThreadWebSocketChannel* create(Document* document, WebSocketChann
elClient* client, const String& sourceURL = String(), unsigned lineNumber = 0) | 66 static MainThreadWebSocketChannel* create(Document* document, WebSocketChann
elClient* client, const String& sourceURL = String(), unsigned lineNumber = 0) |
67 { | 67 { |
68 return adoptRefCountedGarbageCollected(new MainThreadWebSocketChannel(do
cument, client, sourceURL, lineNumber)); | 68 return adoptRefCountedGarbageCollected(new MainThreadWebSocketChannel(do
cument, client, sourceURL, lineNumber)); |
69 } | 69 } |
70 virtual ~MainThreadWebSocketChannel(); | 70 virtual ~MainThreadWebSocketChannel(); |
71 | 71 |
72 // WebSocketChannel functions. | 72 // WebSocketChannel functions. |
73 virtual bool connect(const KURL&, const String& protocol) OVERRIDE; | 73 virtual bool connect(const KURL&, const String& protocol) override; |
74 virtual void send(const String& message) OVERRIDE; | 74 virtual void send(const String& message) override; |
75 virtual void send(const ArrayBuffer&, unsigned byteOffset, unsigned byteLeng
th) OVERRIDE; | 75 virtual void send(const ArrayBuffer&, unsigned byteOffset, unsigned byteLeng
th) override; |
76 virtual void send(PassRefPtr<BlobDataHandle>) OVERRIDE; | 76 virtual void send(PassRefPtr<BlobDataHandle>) override; |
77 virtual void send(PassOwnPtr<Vector<char> > data) OVERRIDE; | 77 virtual void send(PassOwnPtr<Vector<char> > data) override; |
78 // Start closing handshake. Use the CloseEventCodeNotSpecified for the code | 78 // Start closing handshake. Use the CloseEventCodeNotSpecified for the code |
79 // argument to omit payload. | 79 // argument to omit payload. |
80 virtual void close(int code, const String& reason) OVERRIDE; | 80 virtual void close(int code, const String& reason) override; |
81 virtual void fail(const String& reason, MessageLevel, const String&, unsigne
d lineNumber) OVERRIDE; | 81 virtual void fail(const String& reason, MessageLevel, const String&, unsigne
d lineNumber) override; |
82 virtual void disconnect() OVERRIDE; | 82 virtual void disconnect() override; |
83 | 83 |
84 virtual void suspend() OVERRIDE; | 84 virtual void suspend() override; |
85 virtual void resume() OVERRIDE; | 85 virtual void resume() override; |
86 | 86 |
87 // SocketStreamHandleClient functions. | 87 // SocketStreamHandleClient functions. |
88 virtual void didOpenSocketStream(SocketStreamHandle*) OVERRIDE; | 88 virtual void didOpenSocketStream(SocketStreamHandle*) override; |
89 virtual void didCloseSocketStream(SocketStreamHandle*) OVERRIDE; | 89 virtual void didCloseSocketStream(SocketStreamHandle*) override; |
90 virtual void didReceiveSocketStreamData(SocketStreamHandle*, const char*, in
t) OVERRIDE; | 90 virtual void didReceiveSocketStreamData(SocketStreamHandle*, const char*, in
t) override; |
91 virtual void didConsumeBufferedAmount(SocketStreamHandle*, size_t consumed)
OVERRIDE; | 91 virtual void didConsumeBufferedAmount(SocketStreamHandle*, size_t consumed)
override; |
92 virtual void didFailSocketStream(SocketStreamHandle*, const SocketStreamErro
r&) OVERRIDE; | 92 virtual void didFailSocketStream(SocketStreamHandle*, const SocketStreamErro
r&) override; |
93 | 93 |
94 // FileReaderLoaderClient functions. | 94 // FileReaderLoaderClient functions. |
95 virtual void didStartLoading() OVERRIDE; | 95 virtual void didStartLoading() override; |
96 virtual void didReceiveData() OVERRIDE; | 96 virtual void didReceiveData() override; |
97 virtual void didFinishLoading() OVERRIDE; | 97 virtual void didFinishLoading() override; |
98 virtual void didFail(FileError::ErrorCode) OVERRIDE; | 98 virtual void didFail(FileError::ErrorCode) override; |
99 | 99 |
100 virtual void trace(Visitor*) OVERRIDE; | 100 virtual void trace(Visitor*) override; |
101 | 101 |
102 private: | 102 private: |
103 MainThreadWebSocketChannel(Document*, WebSocketChannelClient*, const String&
, unsigned); | 103 MainThreadWebSocketChannel(Document*, WebSocketChannelClient*, const String&
, unsigned); |
104 | 104 |
105 class FramingOverhead { | 105 class FramingOverhead { |
106 public: | 106 public: |
107 FramingOverhead(WebSocketFrame::OpCode opcode, size_t frameDataSize, siz
e_t originalPayloadLength) | 107 FramingOverhead(WebSocketFrame::OpCode opcode, size_t frameDataSize, siz
e_t originalPayloadLength) |
108 : m_opcode(opcode) | 108 : m_opcode(opcode) |
109 , m_frameDataSize(frameDataSize) | 109 , m_frameDataSize(frameDataSize) |
110 , m_originalPayloadLength(originalPayloadLength) | 110 , m_originalPayloadLength(originalPayloadLength) |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 unsigned m_lineNumberAtConstruction; | 243 unsigned m_lineNumberAtConstruction; |
244 | 244 |
245 WebSocketPerMessageDeflate m_perMessageDeflate; | 245 WebSocketPerMessageDeflate m_perMessageDeflate; |
246 | 246 |
247 WebSocketDeflateFramer m_deflateFramer; | 247 WebSocketDeflateFramer m_deflateFramer; |
248 }; | 248 }; |
249 | 249 |
250 } // namespace blink | 250 } // namespace blink |
251 | 251 |
252 #endif // MainThreadWebSocketChannel_h | 252 #endif // MainThreadWebSocketChannel_h |
OLD | NEW |