OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_WEBSOCKET_IMPL_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_WEBSOCKET_IMPL_H_ |
6 #define WEBKIT_PLUGINS_PPAPI_PPB_WEBSOCKET_IMPL_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPB_WEBSOCKET_IMPL_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 PP_CompletionCallback callback) OVERRIDE; | 46 PP_CompletionCallback callback) OVERRIDE; |
47 virtual int32_t ReceiveMessage(PP_Var* message, | 47 virtual int32_t ReceiveMessage(PP_Var* message, |
48 PP_CompletionCallback callbac) OVERRIDE; | 48 PP_CompletionCallback callbac) OVERRIDE; |
49 virtual int32_t SendMessage(PP_Var message) OVERRIDE; | 49 virtual int32_t SendMessage(PP_Var message) OVERRIDE; |
50 virtual uint64_t GetBufferedAmount() OVERRIDE; | 50 virtual uint64_t GetBufferedAmount() OVERRIDE; |
51 virtual uint16_t GetCloseCode() OVERRIDE; | 51 virtual uint16_t GetCloseCode() OVERRIDE; |
52 virtual PP_Var GetCloseReason() OVERRIDE; | 52 virtual PP_Var GetCloseReason() OVERRIDE; |
53 virtual PP_Bool GetCloseWasClean() OVERRIDE; | 53 virtual PP_Bool GetCloseWasClean() OVERRIDE; |
54 virtual PP_Var GetExtensions() OVERRIDE; | 54 virtual PP_Var GetExtensions() OVERRIDE; |
55 virtual PP_Var GetProtocol() OVERRIDE; | 55 virtual PP_Var GetProtocol() OVERRIDE; |
56 virtual PP_WebSocketReadyState_Dev GetReadyState() OVERRIDE; | 56 virtual PP_WebSocketReadyState GetReadyState() OVERRIDE; |
57 virtual PP_Var GetURL() OVERRIDE; | 57 virtual PP_Var GetURL() OVERRIDE; |
58 | 58 |
59 // WebSocketClient implementation. | 59 // WebSocketClient implementation. |
60 virtual void didConnect(); | 60 virtual void didConnect(); |
61 virtual void didReceiveMessage(const WebKit::WebString& message); | 61 virtual void didReceiveMessage(const WebKit::WebString& message); |
62 virtual void didReceiveArrayBuffer(const WebKit::WebArrayBuffer& binaryData); | 62 virtual void didReceiveArrayBuffer(const WebKit::WebArrayBuffer& binaryData); |
63 virtual void didReceiveMessageError(); | 63 virtual void didReceiveMessageError(); |
64 virtual void didUpdateBufferedAmount(unsigned long buffered_amount); | 64 virtual void didUpdateBufferedAmount(unsigned long buffered_amount); |
65 virtual void didStartClosingHandshake(); | 65 virtual void didStartClosingHandshake(); |
66 virtual void didClose(unsigned long unhandled_buffered_amount, | 66 virtual void didClose(unsigned long unhandled_buffered_amount, |
67 ClosingHandshakeCompletionStatus status, | 67 ClosingHandshakeCompletionStatus status, |
68 unsigned short code, | 68 unsigned short code, |
69 const WebKit::WebString& reason); | 69 const WebKit::WebString& reason); |
70 private: | 70 private: |
71 int32_t DoReceive(); | 71 int32_t DoReceive(); |
72 | 72 |
73 scoped_ptr<WebKit::WebSocket> websocket_; | 73 scoped_ptr<WebKit::WebSocket> websocket_; |
74 PP_WebSocketReadyState_Dev state_; | 74 PP_WebSocketReadyState state_; |
75 bool error_was_received_; | 75 bool error_was_received_; |
76 | 76 |
77 scoped_refptr< ::ppapi::TrackedCallback> connect_callback_; | 77 scoped_refptr< ::ppapi::TrackedCallback> connect_callback_; |
78 | 78 |
79 scoped_refptr< ::ppapi::TrackedCallback> receive_callback_; | 79 scoped_refptr< ::ppapi::TrackedCallback> receive_callback_; |
80 PP_Var* receive_callback_var_; | 80 PP_Var* receive_callback_var_; |
81 bool wait_for_receive_; | 81 bool wait_for_receive_; |
82 std::queue< scoped_refptr< ::ppapi::Var> > received_messages_; | 82 std::queue< scoped_refptr< ::ppapi::Var> > received_messages_; |
83 | 83 |
84 scoped_refptr< ::ppapi::TrackedCallback> close_callback_; | 84 scoped_refptr< ::ppapi::TrackedCallback> close_callback_; |
85 uint16_t close_code_; | 85 uint16_t close_code_; |
86 scoped_refptr< ::ppapi::StringVar> close_reason_; | 86 scoped_refptr< ::ppapi::StringVar> close_reason_; |
87 PP_Bool close_was_clean_; | 87 PP_Bool close_was_clean_; |
88 | 88 |
89 scoped_refptr< ::ppapi::StringVar> empty_string_; | 89 scoped_refptr< ::ppapi::StringVar> empty_string_; |
90 scoped_refptr< ::ppapi::StringVar> extensions_; | 90 scoped_refptr< ::ppapi::StringVar> extensions_; |
91 scoped_refptr< ::ppapi::StringVar> url_; | 91 scoped_refptr< ::ppapi::StringVar> url_; |
92 | 92 |
93 uint64_t buffered_amount_; | 93 uint64_t buffered_amount_; |
94 uint64_t buffered_amount_after_close_; | 94 uint64_t buffered_amount_after_close_; |
95 | 95 |
96 DISALLOW_COPY_AND_ASSIGN(PPB_WebSocket_Impl); | 96 DISALLOW_COPY_AND_ASSIGN(PPB_WebSocket_Impl); |
97 }; | 97 }; |
98 | 98 |
99 } // namespace ppapi | 99 } // namespace ppapi |
100 } // namespace webkit | 100 } // namespace webkit |
101 | 101 |
102 #endif // WEBKIT_PLUGINS_PPAPI_PPB_WEBSOCKET_IMPL_H_ | 102 #endif // WEBKIT_PLUGINS_PPAPI_PPB_WEBSOCKET_IMPL_H_ |
OLD | NEW |