| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 void connect(const KURL&, const String& protocol); | 98 void connect(const KURL&, const String& protocol); |
| 99 void sendTextAsCharVector(PassOwnPtr<Vector<char>>); | 99 void sendTextAsCharVector(PassOwnPtr<Vector<char>>); |
| 100 void sendBinaryAsCharVector(PassOwnPtr<Vector<char>>); | 100 void sendBinaryAsCharVector(PassOwnPtr<Vector<char>>); |
| 101 void sendBlob(PassRefPtr<BlobDataHandle>); | 101 void sendBlob(PassRefPtr<BlobDataHandle>); |
| 102 void close(int code, const String& reason); | 102 void close(int code, const String& reason); |
| 103 void fail(const String& reason, MessageLevel, PassOwnPtr<SourceLocation>
); | 103 void fail(const String& reason, MessageLevel, PassOwnPtr<SourceLocation>
); |
| 104 void disconnect(); | 104 void disconnect(); |
| 105 | 105 |
| 106 DECLARE_VIRTUAL_TRACE(); | 106 DECLARE_VIRTUAL_TRACE(); |
| 107 // Promptly clear connection to bridge + loader proxy. |
| 108 EAGERLY_FINALIZE(); |
| 107 | 109 |
| 108 // WebSocketChannelClient functions. | 110 // WebSocketChannelClient functions. |
| 109 void didConnect(const String& subprotocol, const String& extensions) ove
rride; | 111 void didConnect(const String& subprotocol, const String& extensions) ove
rride; |
| 110 void didReceiveTextMessage(const String& payload) override; | 112 void didReceiveTextMessage(const String& payload) override; |
| 111 void didReceiveBinaryMessage(PassOwnPtr<Vector<char>>) override; | 113 void didReceiveBinaryMessage(PassOwnPtr<Vector<char>>) override; |
| 112 void didConsumeBufferedAmount(uint64_t) override; | 114 void didConsumeBufferedAmount(uint64_t) override; |
| 113 void didStartClosingHandshake() override; | 115 void didStartClosingHandshake() override; |
| 114 void didClose(ClosingHandshakeCompletionStatus, unsigned short code, con
st String& reason) override; | 116 void didClose(ClosingHandshakeCompletionStatus, unsigned short code, con
st String& reason) override; |
| 115 void didError() override; | 117 void didError() override; |
| 116 | 118 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 139 void close(int code, const String& reason); | 141 void close(int code, const String& reason); |
| 140 void fail(const String& reason, MessageLevel, PassOwnPtr<SourceLocation>
); | 142 void fail(const String& reason, MessageLevel, PassOwnPtr<SourceLocation>
); |
| 141 void disconnect(); | 143 void disconnect(); |
| 142 | 144 |
| 143 void createPeerOnMainThread(PassOwnPtr<SourceLocation>, WorkerThreadLife
cycleContext*, ExecutionContext*); | 145 void createPeerOnMainThread(PassOwnPtr<SourceLocation>, WorkerThreadLife
cycleContext*, ExecutionContext*); |
| 144 | 146 |
| 145 // Returns null when |disconnect| has already been called. | 147 // Returns null when |disconnect| has already been called. |
| 146 WebSocketChannelClient* client() { return m_client; } | 148 WebSocketChannelClient* client() { return m_client; } |
| 147 | 149 |
| 148 DECLARE_TRACE(); | 150 DECLARE_TRACE(); |
| 151 // Promptly clear connection to peer + loader proxy. |
| 152 EAGERLY_FINALIZE(); |
| 149 | 153 |
| 150 private: | 154 private: |
| 151 // Returns false if shutdown event is received before method completion. | 155 // Returns false if shutdown event is received before method completion. |
| 152 bool waitForMethodCompletion(std::unique_ptr<ExecutionContextTask>); | 156 bool waitForMethodCompletion(std::unique_ptr<ExecutionContextTask>); |
| 153 | 157 |
| 154 Member<WebSocketChannelClient> m_client; | 158 Member<WebSocketChannelClient> m_client; |
| 155 Member<WorkerGlobalScope> m_workerGlobalScope; | 159 Member<WorkerGlobalScope> m_workerGlobalScope; |
| 156 RefPtr<WorkerLoaderProxy> m_loaderProxy; | 160 RefPtr<WorkerLoaderProxy> m_loaderProxy; |
| 157 Member<WebSocketChannelSyncHelper> m_syncHelper; | 161 Member<WebSocketChannelSyncHelper> m_syncHelper; |
| 158 CrossThreadPersistent<Peer> m_peer; | 162 CrossThreadPersistent<Peer> m_peer; |
| 159 }; | 163 }; |
| 160 | 164 |
| 161 private: | 165 private: |
| 162 WorkerWebSocketChannel(WorkerGlobalScope&, WebSocketChannelClient*, PassOwnP
tr<SourceLocation>); | 166 WorkerWebSocketChannel(WorkerGlobalScope&, WebSocketChannelClient*, PassOwnP
tr<SourceLocation>); |
| 163 | 167 |
| 164 Member<Bridge> m_bridge; | 168 Member<Bridge> m_bridge; |
| 165 OwnPtr<SourceLocation> m_locationAtConnection; | 169 OwnPtr<SourceLocation> m_locationAtConnection; |
| 166 }; | 170 }; |
| 167 | 171 |
| 168 } // namespace blink | 172 } // namespace blink |
| 169 | 173 |
| 170 #endif // WorkerWebSocketChannel_h | 174 #endif // WorkerWebSocketChannel_h |
| OLD | NEW |