| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 public: | 57 public: |
| 58 static WebSocketChannel* create(WorkerGlobalScope& workerGlobalScope, WebSoc
ketChannelClient* client, const String& sourceURL, unsigned lineNumber) | 58 static WebSocketChannel* create(WorkerGlobalScope& workerGlobalScope, WebSoc
ketChannelClient* client, const String& sourceURL, unsigned lineNumber) |
| 59 { | 59 { |
| 60 return new WorkerWebSocketChannel(workerGlobalScope, client, sourceURL,
lineNumber); | 60 return new WorkerWebSocketChannel(workerGlobalScope, client, sourceURL,
lineNumber); |
| 61 } | 61 } |
| 62 virtual ~WorkerWebSocketChannel(); | 62 virtual ~WorkerWebSocketChannel(); |
| 63 | 63 |
| 64 // WebSocketChannel functions. | 64 // WebSocketChannel functions. |
| 65 virtual bool connect(const KURL&, const String& protocol) override; | 65 virtual bool connect(const KURL&, const String& protocol) override; |
| 66 virtual void send(const String& message) override; | 66 virtual void send(const String& message) override; |
| 67 virtual void send(const ArrayBuffer&, unsigned byteOffset, unsigned byteLeng
th) override; | 67 virtual void send(const DOMArrayBuffer&, unsigned byteOffset, unsigned byteL
ength) override; |
| 68 virtual void send(PassRefPtr<BlobDataHandle>) override; | 68 virtual void send(PassRefPtr<BlobDataHandle>) override; |
| 69 virtual void send(PassOwnPtr<Vector<char> >) override | 69 virtual void send(PassOwnPtr<Vector<char> >) override |
| 70 { | 70 { |
| 71 ASSERT_NOT_REACHED(); | 71 ASSERT_NOT_REACHED(); |
| 72 } | 72 } |
| 73 virtual void close(int code, const String& reason) override; | 73 virtual void close(int code, const String& reason) override; |
| 74 virtual void fail(const String& reason, MessageLevel, const String&, unsigne
d) override; | 74 virtual void fail(const String& reason, MessageLevel, const String&, unsigne
d) override; |
| 75 virtual void disconnect() override; // Will suppress didClose(). | 75 virtual void disconnect() override; // Will suppress didClose(). |
| 76 virtual void suspend() override { } | 76 virtual void suspend() override { } |
| 77 virtual void resume() override { } | 77 virtual void resume() override { } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 class Bridge final : public GarbageCollectedFinalized<Bridge> { | 127 class Bridge final : public GarbageCollectedFinalized<Bridge> { |
| 128 WTF_MAKE_NONCOPYABLE(Bridge); | 128 WTF_MAKE_NONCOPYABLE(Bridge); |
| 129 public: | 129 public: |
| 130 Bridge(WebSocketChannelClient*, WorkerGlobalScope&); | 130 Bridge(WebSocketChannelClient*, WorkerGlobalScope&); |
| 131 ~Bridge(); | 131 ~Bridge(); |
| 132 // sourceURLAtConnection and lineNumberAtConnection parameters may | 132 // sourceURLAtConnection and lineNumberAtConnection parameters may |
| 133 // be shown when the connection fails. | 133 // be shown when the connection fails. |
| 134 void initialize(const String& sourceURLAtConnection, unsigned lineNumber
AtConnection); | 134 void initialize(const String& sourceURLAtConnection, unsigned lineNumber
AtConnection); |
| 135 bool connect(const KURL&, const String& protocol); | 135 bool connect(const KURL&, const String& protocol); |
| 136 void send(const String& message); | 136 void send(const String& message); |
| 137 void send(const ArrayBuffer&, unsigned byteOffset, unsigned byteLength); | 137 void send(const DOMArrayBuffer&, unsigned byteOffset, unsigned byteLengt
h); |
| 138 void send(PassRefPtr<BlobDataHandle>); | 138 void send(PassRefPtr<BlobDataHandle>); |
| 139 unsigned long bufferedAmount(); | 139 unsigned long bufferedAmount(); |
| 140 void close(int code, const String& reason); | 140 void close(int code, const String& reason); |
| 141 void fail(const String& reason, MessageLevel, const String& sourceURL, u
nsigned lineNumber); | 141 void fail(const String& reason, MessageLevel, const String& sourceURL, u
nsigned lineNumber); |
| 142 void disconnect(); | 142 void disconnect(); |
| 143 | 143 |
| 144 // Returns null when |disconnect| has already been called. | 144 // Returns null when |disconnect| has already been called. |
| 145 WebSocketChannelClient* client() { return m_client; } | 145 WebSocketChannelClient* client() { return m_client; } |
| 146 | 146 |
| 147 void trace(Visitor*); | 147 void trace(Visitor*); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 161 WorkerWebSocketChannel(WorkerGlobalScope&, WebSocketChannelClient*, const St
ring& sourceURL, unsigned lineNumber); | 161 WorkerWebSocketChannel(WorkerGlobalScope&, WebSocketChannelClient*, const St
ring& sourceURL, unsigned lineNumber); |
| 162 | 162 |
| 163 Member<Bridge> m_bridge; | 163 Member<Bridge> m_bridge; |
| 164 String m_sourceURLAtConnection; | 164 String m_sourceURLAtConnection; |
| 165 unsigned m_lineNumberAtConnection; | 165 unsigned m_lineNumberAtConnection; |
| 166 }; | 166 }; |
| 167 | 167 |
| 168 } // namespace blink | 168 } // namespace blink |
| 169 | 169 |
| 170 #endif // WorkerWebSocketChannel_h | 170 #endif // WorkerWebSocketChannel_h |
| OLD | NEW |