| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 class WorkerThreadableWebSocketChannel FINAL : public RefCounted<WorkerThreadabl
eWebSocketChannel>, public WebSocketChannel { | 64 class WorkerThreadableWebSocketChannel FINAL : public RefCounted<WorkerThreadabl
eWebSocketChannel>, public WebSocketChannel { |
| 65 WTF_MAKE_FAST_ALLOCATED; | 65 WTF_MAKE_FAST_ALLOCATED; |
| 66 public: | 66 public: |
| 67 static PassRefPtr<WebSocketChannel> create(WorkerGlobalScope& workerGlobalSc
ope, WebSocketChannelClient* client, const String& sourceURL, unsigned lineNumbe
r) | 67 static PassRefPtr<WebSocketChannel> create(WorkerGlobalScope& workerGlobalSc
ope, WebSocketChannelClient* client, const String& sourceURL, unsigned lineNumbe
r) |
| 68 { | 68 { |
| 69 return adoptRef(new WorkerThreadableWebSocketChannel(workerGlobalScope,
client, sourceURL, lineNumber)); | 69 return adoptRef(new WorkerThreadableWebSocketChannel(workerGlobalScope,
client, sourceURL, lineNumber)); |
| 70 } | 70 } |
| 71 virtual ~WorkerThreadableWebSocketChannel(); | 71 virtual ~WorkerThreadableWebSocketChannel(); |
| 72 | 72 |
| 73 // WebSocketChannel functions. | 73 // WebSocketChannel functions. |
| 74 virtual void connect(const KURL&, const String& protocol) OVERRIDE; | 74 virtual bool connect(const KURL&, const String& protocol) OVERRIDE; |
| 75 virtual String subprotocol() OVERRIDE; | 75 virtual String subprotocol() OVERRIDE; |
| 76 virtual String extensions() OVERRIDE; | 76 virtual String extensions() OVERRIDE; |
| 77 virtual WebSocketChannel::SendResult send(const String& message) OVERRIDE; | 77 virtual WebSocketChannel::SendResult send(const String& message) OVERRIDE; |
| 78 virtual WebSocketChannel::SendResult send(const ArrayBuffer&, unsigned byteO
ffset, unsigned byteLength) OVERRIDE; | 78 virtual WebSocketChannel::SendResult send(const ArrayBuffer&, unsigned byteO
ffset, unsigned byteLength) OVERRIDE; |
| 79 virtual WebSocketChannel::SendResult send(PassRefPtr<BlobDataHandle>) OVERRI
DE; | 79 virtual WebSocketChannel::SendResult send(PassRefPtr<BlobDataHandle>) OVERRI
DE; |
| 80 virtual unsigned long bufferedAmount() const OVERRIDE; | 80 virtual unsigned long bufferedAmount() const OVERRIDE; |
| 81 virtual void close(int code, const String& reason) OVERRIDE; | 81 virtual void close(int code, const String& reason) OVERRIDE; |
| 82 virtual void fail(const String& reason, MessageLevel, const String&, unsigne
d) OVERRIDE; | 82 virtual void fail(const String& reason, MessageLevel, const String&, unsigne
d) OVERRIDE; |
| 83 virtual void disconnect() OVERRIDE; // Will suppress didClose(). | 83 virtual void disconnect() OVERRIDE; // Will suppress didClose(). |
| 84 virtual void suspend() OVERRIDE; | 84 virtual void suspend() OVERRIDE; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 class Bridge : public RefCounted<Bridge> { | 140 class Bridge : public RefCounted<Bridge> { |
| 141 public: | 141 public: |
| 142 static PassRefPtr<Bridge> create(PassRefPtr<ThreadableWebSocketChannelCl
ientWrapper> workerClientWrapper, PassRefPtrWillBeRawPtr<WorkerGlobalScope> work
erGlobalScope) | 142 static PassRefPtr<Bridge> create(PassRefPtr<ThreadableWebSocketChannelCl
ientWrapper> workerClientWrapper, PassRefPtrWillBeRawPtr<WorkerGlobalScope> work
erGlobalScope) |
| 143 { | 143 { |
| 144 return adoptRef(new Bridge(workerClientWrapper, workerGlobalScope)); | 144 return adoptRef(new Bridge(workerClientWrapper, workerGlobalScope)); |
| 145 } | 145 } |
| 146 ~Bridge(); | 146 ~Bridge(); |
| 147 // sourceURLAtConnection and lineNumberAtConnection parameters may | 147 // sourceURLAtConnection and lineNumberAtConnection parameters may |
| 148 // be shown when the connection fails. | 148 // be shown when the connection fails. |
| 149 void initialize(const String& sourceURLAtConnection, unsigned lineNumber
AtConnection); | 149 void initialize(const String& sourceURLAtConnection, unsigned lineNumber
AtConnection); |
| 150 void connect(const KURL&, const String& protocol); | 150 bool connect(const KURL&, const String& protocol); |
| 151 WebSocketChannel::SendResult send(const String& message); | 151 WebSocketChannel::SendResult send(const String& message); |
| 152 WebSocketChannel::SendResult send(const ArrayBuffer&, unsigned byteOffse
t, unsigned byteLength); | 152 WebSocketChannel::SendResult send(const ArrayBuffer&, unsigned byteOffse
t, unsigned byteLength); |
| 153 WebSocketChannel::SendResult send(PassRefPtr<BlobDataHandle>); | 153 WebSocketChannel::SendResult send(PassRefPtr<BlobDataHandle>); |
| 154 unsigned long bufferedAmount(); | 154 unsigned long bufferedAmount(); |
| 155 void close(int code, const String& reason); | 155 void close(int code, const String& reason); |
| 156 void fail(const String& reason, MessageLevel, const String& sourceURL, u
nsigned lineNumber); | 156 void fail(const String& reason, MessageLevel, const String& sourceURL, u
nsigned lineNumber); |
| 157 void disconnect(); | 157 void disconnect(); |
| 158 void suspend(); | 158 void suspend(); |
| 159 void resume(); | 159 void resume(); |
| 160 | 160 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 186 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; | 186 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; |
| 187 RefPtr<ThreadableWebSocketChannelClientWrapper> m_workerClientWrapper; | 187 RefPtr<ThreadableWebSocketChannelClientWrapper> m_workerClientWrapper; |
| 188 RefPtr<Bridge> m_bridge; | 188 RefPtr<Bridge> m_bridge; |
| 189 String m_sourceURLAtConnection; | 189 String m_sourceURLAtConnection; |
| 190 unsigned m_lineNumberAtConnection; | 190 unsigned m_lineNumberAtConnection; |
| 191 }; | 191 }; |
| 192 | 192 |
| 193 } // namespace WebCore | 193 } // namespace WebCore |
| 194 | 194 |
| 195 #endif // WorkerThreadableWebSocketChannel_h | 195 #endif // WorkerThreadableWebSocketChannel_h |
| OLD | NEW |