| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 virtual PP_WebSocketReadyState_Dev GetReadyState() OVERRIDE; | 59 virtual PP_WebSocketReadyState_Dev GetReadyState() OVERRIDE; |
| 60 virtual PP_Var GetURL() OVERRIDE; | 60 virtual PP_Var GetURL() OVERRIDE; |
| 61 | 61 |
| 62 // WebSocketClient implementation. | 62 // WebSocketClient implementation. |
| 63 virtual void didConnect(); | 63 virtual void didConnect(); |
| 64 virtual void didReceiveMessage(const WebKit::WebString& message); | 64 virtual void didReceiveMessage(const WebKit::WebString& message); |
| 65 virtual void didReceiveBinaryData(const WebKit::WebData& binaryData); | 65 virtual void didReceiveBinaryData(const WebKit::WebData& binaryData); |
| 66 virtual void didReceiveMessageError(); | 66 virtual void didReceiveMessageError(); |
| 67 virtual void didUpdateBufferedAmount(unsigned long buffered_amount); | 67 virtual void didUpdateBufferedAmount(unsigned long buffered_amount); |
| 68 virtual void didStartClosingHandshake(); | 68 virtual void didStartClosingHandshake(); |
| 69 virtual void didClose(unsigned long buffered_amount, | 69 virtual void didClose(unsigned long unhandled_buffered_amount, |
| 70 ClosingHandshakeCompletionStatus status, | 70 ClosingHandshakeCompletionStatus status, |
| 71 unsigned short code, | 71 unsigned short code, |
| 72 const WebKit::WebString& reason); | 72 const WebKit::WebString& reason); |
| 73 private: | 73 private: |
| 74 int32_t DoReceive(); | 74 int32_t DoReceive(); |
| 75 | 75 |
| 76 scoped_ptr<WebKit::WebSocket> websocket_; | 76 scoped_ptr<WebKit::WebSocket> websocket_; |
| 77 PP_WebSocketReadyState_Dev state_; | 77 PP_WebSocketReadyState_Dev state_; |
| 78 bool error_was_received_; |
| 78 | 79 |
| 79 PP_CompletionCallback connect_callback_; | 80 PP_CompletionCallback connect_callback_; |
| 80 | 81 |
| 81 PP_CompletionCallback receive_callback_; | 82 PP_CompletionCallback receive_callback_; |
| 82 PP_Var* receive_callback_var_; | 83 PP_Var* receive_callback_var_; |
| 83 bool wait_for_receive_; | 84 bool wait_for_receive_; |
| 84 // TODO(toyoshim): Use std::queue<Var> when it supports binary. | 85 // TODO(toyoshim): Use std::queue<Var> when it supports binary. |
| 85 std::queue<PP_Var> received_messages_; | 86 std::queue<PP_Var> received_messages_; |
| 86 | 87 |
| 87 PP_CompletionCallback close_callback_; | 88 PP_CompletionCallback close_callback_; |
| 88 uint16_t close_code_; | 89 uint16_t close_code_; |
| 89 scoped_refptr< ::ppapi::StringVar> close_reason_; | 90 scoped_refptr< ::ppapi::StringVar> close_reason_; |
| 90 PP_Bool close_was_clean_; | 91 PP_Bool close_was_clean_; |
| 91 | 92 |
| 92 scoped_refptr< ::ppapi::StringVar> empty_string_; | 93 scoped_refptr< ::ppapi::StringVar> empty_string_; |
| 93 scoped_refptr< ::ppapi::StringVar> extensions_; | 94 scoped_refptr< ::ppapi::StringVar> extensions_; |
| 94 scoped_refptr< ::ppapi::StringVar> url_; | 95 scoped_refptr< ::ppapi::StringVar> url_; |
| 95 | 96 |
| 96 uint64_t buffered_amount_; | 97 uint64_t buffered_amount_; |
| 97 uint64_t buffered_amount_after_close_; | 98 uint64_t buffered_amount_after_close_; |
| 98 | 99 |
| 99 DISALLOW_COPY_AND_ASSIGN(PPB_WebSocket_Impl); | 100 DISALLOW_COPY_AND_ASSIGN(PPB_WebSocket_Impl); |
| 100 }; | 101 }; |
| 101 | 102 |
| 102 } // namespace ppapi | 103 } // namespace ppapi |
| 103 } // namespace webkit | 104 } // namespace webkit |
| 104 | 105 |
| 105 #endif // WEBKIT_PLUGINS_PPAPI_PPB_WEBSOCKET_IMPL_H_ | 106 #endif // WEBKIT_PLUGINS_PPAPI_PPB_WEBSOCKET_IMPL_H_ |
| OLD | NEW |