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" |
11 #include "ppapi/shared_impl/resource.h" | 11 #include "ppapi/shared_impl/resource.h" |
| 12 #include "ppapi/shared_impl/tracked_callback.h" |
12 #include "ppapi/thunk/ppb_websocket_api.h" | 13 #include "ppapi/thunk/ppb_websocket_api.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSocketClient.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSocketClient.h" |
14 | 15 |
15 namespace ppapi { | 16 namespace ppapi { |
16 class StringVar; | 17 class StringVar; |
17 } | 18 } |
18 | 19 |
19 namespace WebKit { | 20 namespace WebKit { |
20 class WebSocket; | 21 class WebSocket; |
21 } | 22 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 ClosingHandshakeCompletionStatus status, | 69 ClosingHandshakeCompletionStatus status, |
69 unsigned short code, | 70 unsigned short code, |
70 const WebKit::WebString& reason); | 71 const WebKit::WebString& reason); |
71 private: | 72 private: |
72 int32_t DoReceive(); | 73 int32_t DoReceive(); |
73 | 74 |
74 scoped_ptr<WebKit::WebSocket> websocket_; | 75 scoped_ptr<WebKit::WebSocket> websocket_; |
75 PP_WebSocketReadyState_Dev state_; | 76 PP_WebSocketReadyState_Dev state_; |
76 bool error_was_received_; | 77 bool error_was_received_; |
77 | 78 |
78 PP_CompletionCallback connect_callback_; | 79 scoped_refptr< ::ppapi::TrackedCallback> connect_callback_; |
79 | 80 |
80 PP_CompletionCallback receive_callback_; | 81 scoped_refptr< ::ppapi::TrackedCallback> receive_callback_; |
81 PP_Var* receive_callback_var_; | 82 PP_Var* receive_callback_var_; |
82 bool wait_for_receive_; | 83 bool wait_for_receive_; |
83 // TODO(toyoshim): Use std::queue<Var> when it supports binary. | 84 // TODO(toyoshim): Use std::queue<Var> when it supports binary. |
84 std::queue<PP_Var> received_messages_; | 85 std::queue<PP_Var> received_messages_; |
85 | 86 |
86 PP_CompletionCallback close_callback_; | 87 scoped_refptr< ::ppapi::TrackedCallback> close_callback_; |
87 uint16_t close_code_; | 88 uint16_t close_code_; |
88 scoped_refptr< ::ppapi::StringVar> close_reason_; | 89 scoped_refptr< ::ppapi::StringVar> close_reason_; |
89 PP_Bool close_was_clean_; | 90 PP_Bool close_was_clean_; |
90 | 91 |
91 scoped_refptr< ::ppapi::StringVar> empty_string_; | 92 scoped_refptr< ::ppapi::StringVar> empty_string_; |
92 scoped_refptr< ::ppapi::StringVar> extensions_; | 93 scoped_refptr< ::ppapi::StringVar> extensions_; |
93 scoped_refptr< ::ppapi::StringVar> url_; | 94 scoped_refptr< ::ppapi::StringVar> url_; |
94 | 95 |
95 uint64_t buffered_amount_; | 96 uint64_t buffered_amount_; |
96 uint64_t buffered_amount_after_close_; | 97 uint64_t buffered_amount_after_close_; |
97 | 98 |
98 DISALLOW_COPY_AND_ASSIGN(PPB_WebSocket_Impl); | 99 DISALLOW_COPY_AND_ASSIGN(PPB_WebSocket_Impl); |
99 }; | 100 }; |
100 | 101 |
101 } // namespace ppapi | 102 } // namespace ppapi |
102 } // namespace webkit | 103 } // namespace webkit |
103 | 104 |
104 #endif // WEBKIT_PLUGINS_PPAPI_PPB_WEBSOCKET_IMPL_H_ | 105 #endif // WEBKIT_PLUGINS_PPAPI_PPB_WEBSOCKET_IMPL_H_ |
OLD | NEW |