| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 return adoptRef(new WorkerThreadableWebSocketChannel(workerContext, clie
nt, taskMode)); | 60 return adoptRef(new WorkerThreadableWebSocketChannel(workerContext, clie
nt, taskMode)); |
| 61 } | 61 } |
| 62 virtual ~WorkerThreadableWebSocketChannel(); | 62 virtual ~WorkerThreadableWebSocketChannel(); |
| 63 | 63 |
| 64 // ThreadableWebSocketChannel functions. | 64 // ThreadableWebSocketChannel functions. |
| 65 virtual void connect(const KURL&, const String& protocol) OVERRIDE; | 65 virtual void connect(const KURL&, const String& protocol) OVERRIDE; |
| 66 virtual String subprotocol() OVERRIDE; | 66 virtual String subprotocol() OVERRIDE; |
| 67 virtual String extensions() OVERRIDE; | 67 virtual String extensions() OVERRIDE; |
| 68 virtual ThreadableWebSocketChannel::SendResult send(const String& message) O
VERRIDE; | 68 virtual ThreadableWebSocketChannel::SendResult send(const String& message) O
VERRIDE; |
| 69 virtual ThreadableWebSocketChannel::SendResult send(const ArrayBuffer&, unsi
gned byteOffset, unsigned byteLength) OVERRIDE; | 69 virtual ThreadableWebSocketChannel::SendResult send(const ArrayBuffer&, unsi
gned byteOffset, unsigned byteLength) OVERRIDE; |
| 70 virtual ThreadableWebSocketChannel::SendResult send(const Blob&) OVERRIDE; | 70 virtual ThreadableWebSocketChannel::SendResult send(const Blob&) OVERRIDE;
// TODO: change the API to send(BlobDataHandle*) |
| 71 virtual unsigned long bufferedAmount() const OVERRIDE; | 71 virtual unsigned long bufferedAmount() const OVERRIDE; |
| 72 virtual void close(int code, const String& reason) OVERRIDE; | 72 virtual void close(int code, const String& reason) OVERRIDE; |
| 73 virtual void fail(const String& reason) OVERRIDE; | 73 virtual void fail(const String& reason) OVERRIDE; |
| 74 virtual void disconnect() OVERRIDE; // Will suppress didClose(). | 74 virtual void disconnect() OVERRIDE; // Will suppress didClose(). |
| 75 virtual void suspend() OVERRIDE; | 75 virtual void suspend() OVERRIDE; |
| 76 virtual void resume() OVERRIDE; | 76 virtual void resume() OVERRIDE; |
| 77 | 77 |
| 78 // Generated by the bridge. The Peer and its bridge should have identical | 78 // Generated by the bridge. The Peer and its bridge should have identical |
| 79 // lifetimes. | 79 // lifetimes. |
| 80 class Peer : public WebSocketChannelClient { | 80 class Peer : public WebSocketChannelClient { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 WorkerLoaderProxy& m_loaderProxy; | 165 WorkerLoaderProxy& m_loaderProxy; |
| 166 String m_taskMode; | 166 String m_taskMode; |
| 167 Peer* m_peer; | 167 Peer* m_peer; |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 WorkerThreadableWebSocketChannel(WorkerContext*, WebSocketChannelClient*, co
nst String& taskMode); | 170 WorkerThreadableWebSocketChannel(WorkerContext*, WebSocketChannelClient*, co
nst String& taskMode); |
| 171 | 171 |
| 172 static void mainThreadConnect(ScriptExecutionContext*, Peer*, const KURL&, c
onst String& protocol); | 172 static void mainThreadConnect(ScriptExecutionContext*, Peer*, const KURL&, c
onst String& protocol); |
| 173 static void mainThreadSend(ScriptExecutionContext*, Peer*, const String& mes
sage); | 173 static void mainThreadSend(ScriptExecutionContext*, Peer*, const String& mes
sage); |
| 174 static void mainThreadSendArrayBuffer(ScriptExecutionContext*, Peer*, PassOw
nPtr<Vector<char> >); | 174 static void mainThreadSendArrayBuffer(ScriptExecutionContext*, Peer*, PassOw
nPtr<Vector<char> >); |
| 175 static void mainThreadSendBlob(ScriptExecutionContext*, Peer*, const KURL&,
const String& type, long long size); | 175 // TODO: Param s/b PassRefPtr<BlobDataHandle> instead of uuid |
| 176 static void mainThreadSendBlob(ScriptExecutionContext*, Peer*, const String&
uuid, const String& type, long long size); |
| 176 static void mainThreadBufferedAmount(ScriptExecutionContext*, Peer*); | 177 static void mainThreadBufferedAmount(ScriptExecutionContext*, Peer*); |
| 177 static void mainThreadClose(ScriptExecutionContext*, Peer*, int code, const
String& reason); | 178 static void mainThreadClose(ScriptExecutionContext*, Peer*, int code, const
String& reason); |
| 178 static void mainThreadFail(ScriptExecutionContext*, Peer*, const String& rea
son); | 179 static void mainThreadFail(ScriptExecutionContext*, Peer*, const String& rea
son); |
| 179 static void mainThreadDestroy(ScriptExecutionContext*, PassOwnPtr<Peer>); | 180 static void mainThreadDestroy(ScriptExecutionContext*, PassOwnPtr<Peer>); |
| 180 static void mainThreadSuspend(ScriptExecutionContext*, Peer*); | 181 static void mainThreadSuspend(ScriptExecutionContext*, Peer*); |
| 181 static void mainThreadResume(ScriptExecutionContext*, Peer*); | 182 static void mainThreadResume(ScriptExecutionContext*, Peer*); |
| 182 | 183 |
| 183 class WorkerContextDidInitializeTask; | 184 class WorkerContextDidInitializeTask; |
| 184 | 185 |
| 185 RefPtr<WorkerContext> m_workerContext; | 186 RefPtr<WorkerContext> m_workerContext; |
| 186 RefPtr<ThreadableWebSocketChannelClientWrapper> m_workerClientWrapper; | 187 RefPtr<ThreadableWebSocketChannelClientWrapper> m_workerClientWrapper; |
| 187 RefPtr<Bridge> m_bridge; | 188 RefPtr<Bridge> m_bridge; |
| 188 }; | 189 }; |
| 189 | 190 |
| 190 } // namespace WebCore | 191 } // namespace WebCore |
| 191 | 192 |
| 192 #endif // ENABLE(WEB_SOCKETS) | 193 #endif // ENABLE(WEB_SOCKETS) |
| 193 | 194 |
| 194 #endif // WorkerThreadableWebSocketChannel_h | 195 #endif // WorkerThreadableWebSocketChannel_h |
| OLD | NEW |