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 #include "webkit/plugins/ppapi/ppb_websocket_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_websocket_impl.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 PPB_WebSocket_Impl::PPB_WebSocket_Impl(PP_Instance instance) | 78 PPB_WebSocket_Impl::PPB_WebSocket_Impl(PP_Instance instance) |
79 : Resource(instance), | 79 : Resource(instance), |
80 state_(PP_WEBSOCKETREADYSTATE_INVALID_DEV), | 80 state_(PP_WEBSOCKETREADYSTATE_INVALID_DEV), |
81 error_was_received_(false), | 81 error_was_received_(false), |
82 receive_callback_var_(NULL), | 82 receive_callback_var_(NULL), |
83 wait_for_receive_(false), | 83 wait_for_receive_(false), |
84 close_code_(0), | 84 close_code_(0), |
85 close_was_clean_(PP_FALSE), | 85 close_was_clean_(PP_FALSE), |
86 buffered_amount_(0), | 86 buffered_amount_(0), |
87 buffered_amount_after_close_(0) { | 87 buffered_amount_after_close_(0) { |
| 88 connect_callback_.func = NULL; |
| 89 connect_callback_.user_data = NULL; |
| 90 receive_callback_.func = NULL; |
| 91 receive_callback_.user_data = NULL; |
| 92 close_callback_.func = NULL; |
| 93 close_callback_.user_data = NULL; |
88 empty_string_ = new StringVar("", 0); | 94 empty_string_ = new StringVar("", 0); |
89 } | 95 } |
90 | 96 |
91 PPB_WebSocket_Impl::~PPB_WebSocket_Impl() { | 97 PPB_WebSocket_Impl::~PPB_WebSocket_Impl() { |
92 if (websocket_.get()) | 98 if (websocket_.get()) |
93 websocket_->disconnect(); | 99 websocket_->disconnect(); |
94 | 100 |
95 // Clean up received and unread messages | 101 // Clean up received and unread messages |
96 VarTracker* var_tracker = PpapiGlobals::Get()->GetVarTracker(); | 102 VarTracker* var_tracker = PpapiGlobals::Get()->GetVarTracker(); |
97 while (!received_messages_.empty()) { | 103 while (!received_messages_.empty()) { |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 | 504 |
499 *receive_callback_var_ = received_messages_.front(); | 505 *receive_callback_var_ = received_messages_.front(); |
500 received_messages_.pop(); | 506 received_messages_.pop(); |
501 receive_callback_var_ = NULL; | 507 receive_callback_var_ = NULL; |
502 wait_for_receive_ = false; | 508 wait_for_receive_ = false; |
503 return PP_OK; | 509 return PP_OK; |
504 } | 510 } |
505 | 511 |
506 } // namespace ppapi | 512 } // namespace ppapi |
507 } // namespace webkit | 513 } // namespace webkit |
OLD | NEW |