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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 class ThreadableWebSocketChannelClientWrapper : public ThreadSafeRefCountedWillB
eGarbageCollectedFinalized<ThreadableWebSocketChannelClientWrapper> { | 48 class ThreadableWebSocketChannelClientWrapper : public ThreadSafeRefCountedWillB
eGarbageCollectedFinalized<ThreadableWebSocketChannelClientWrapper> { |
49 public: | 49 public: |
50 static PassRefPtrWillBeRawPtr<ThreadableWebSocketChannelClientWrapper> creat
e(WebSocketChannelClient*); | 50 static PassRefPtrWillBeRawPtr<ThreadableWebSocketChannelClientWrapper> creat
e(WebSocketChannelClient*); |
51 ~ThreadableWebSocketChannelClientWrapper(); | 51 ~ThreadableWebSocketChannelClientWrapper(); |
52 | 52 |
53 void clearClient(); | 53 void clearClient(); |
54 | 54 |
55 void didConnect(const String& subprotocol, const String& extensions); | 55 void didConnect(const String& subprotocol, const String& extensions); |
56 void didReceiveMessage(const String& message); | 56 void didReceiveMessage(const String& message); |
57 void didReceiveBinaryData(PassOwnPtr<Vector<char> >); | 57 void didReceiveBinaryData(PassOwnPtr<Vector<char> >); |
58 void didConsumeBufferedAmount(unsigned long); | 58 void didUpdateBufferedAmount(unsigned long bufferedAmount); |
59 void didStartClosingHandshake(); | 59 void didStartClosingHandshake(); |
60 void didClose(WebSocketChannelClient::ClosingHandshakeCompletionStatus, unsi
gned short code, const String& reason); | 60 void didClose(unsigned long unhandledBufferedAmount, WebSocketChannelClient:
:ClosingHandshakeCompletionStatus, unsigned short code, const String& reason); |
61 void didReceiveMessageError(); | 61 void didReceiveMessageError(); |
62 | 62 |
63 void suspend(); | 63 void suspend(); |
64 void resume(); | 64 void resume(); |
65 | 65 |
66 void trace(Visitor*) { } | 66 void trace(Visitor*) { } |
67 | 67 |
68 private: | 68 private: |
69 ThreadableWebSocketChannelClientWrapper(WebSocketChannelClient*); | 69 ThreadableWebSocketChannelClientWrapper(WebSocketChannelClient*); |
70 | 70 |
71 void processPendingTasks(); | 71 void processPendingTasks(); |
72 | 72 |
73 static void didConnectCallback(ExecutionContext*, PassRefPtrWillBeRawPtr<Thr
eadableWebSocketChannelClientWrapper>, const String& subprotocol, const String&
extensions); | 73 static void didConnectCallback(ExecutionContext*, PassRefPtrWillBeRawPtr<Thr
eadableWebSocketChannelClientWrapper>, const String& subprotocol, const String&
extensions); |
74 static void didReceiveMessageCallback(ExecutionContext*, PassRefPtrWillBeRaw
Ptr<ThreadableWebSocketChannelClientWrapper>, const String& message); | 74 static void didReceiveMessageCallback(ExecutionContext*, PassRefPtrWillBeRaw
Ptr<ThreadableWebSocketChannelClientWrapper>, const String& message); |
75 static void didReceiveBinaryDataCallback(ExecutionContext*, PassRefPtrWillBe
RawPtr<ThreadableWebSocketChannelClientWrapper>, PassOwnPtr<Vector<char> >); | 75 static void didReceiveBinaryDataCallback(ExecutionContext*, PassRefPtrWillBe
RawPtr<ThreadableWebSocketChannelClientWrapper>, PassOwnPtr<Vector<char> >); |
76 static void didConsumeBufferedAmountCallback(ExecutionContext*, PassRefPtrWi
llBeRawPtr<ThreadableWebSocketChannelClientWrapper>, unsigned long); | 76 static void didUpdateBufferedAmountCallback(ExecutionContext*, PassRefPtrWil
lBeRawPtr<ThreadableWebSocketChannelClientWrapper>, unsigned long bufferedAmount
); |
77 static void didStartClosingHandshakeCallback(ExecutionContext*, PassRefPtrWi
llBeRawPtr<ThreadableWebSocketChannelClientWrapper>); | 77 static void didStartClosingHandshakeCallback(ExecutionContext*, PassRefPtrWi
llBeRawPtr<ThreadableWebSocketChannelClientWrapper>); |
78 static void didCloseCallback(ExecutionContext*, PassRefPtrWillBeRawPtr<Threa
dableWebSocketChannelClientWrapper>, WebSocketChannelClient::ClosingHandshakeCom
pletionStatus, unsigned short code, const String& reason); | 78 static void didCloseCallback(ExecutionContext*, PassRefPtrWillBeRawPtr<Threa
dableWebSocketChannelClientWrapper>, unsigned long unhandledBufferedAmount, WebS
ocketChannelClient::ClosingHandshakeCompletionStatus, unsigned short code, const
String& reason); |
79 static void didReceiveMessageErrorCallback(ExecutionContext*, PassRefPtrWill
BeRawPtr<ThreadableWebSocketChannelClientWrapper>); | 79 static void didReceiveMessageErrorCallback(ExecutionContext*, PassRefPtrWill
BeRawPtr<ThreadableWebSocketChannelClientWrapper>); |
80 | 80 |
81 WebSocketChannelClient* m_client; | 81 WebSocketChannelClient* m_client; |
82 bool m_suspended; | 82 bool m_suspended; |
83 Vector<OwnPtr<ExecutionContextTask> > m_pendingTasks; | 83 Vector<OwnPtr<ExecutionContextTask> > m_pendingTasks; |
84 }; | 84 }; |
85 | 85 |
86 } // namespace WebCore | 86 } // namespace WebCore |
87 | 87 |
88 #endif // ThreadableWebSocketChannelClientWrapper_h | 88 #endif // ThreadableWebSocketChannelClientWrapper_h |
OLD | NEW |