| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // An implementation of WebSocketStreamHandle. | 5 // An implementation of WebSocketStreamHandle. |
| 6 | 6 |
| 7 #include "content/child/web_socket_stream_handle_impl.h" | 7 #include "content/child/web_socket_stream_handle_impl.h" |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 void Connect(const WebURL& url); | 46 void Connect(const WebURL& url); |
| 47 bool Send(const WebData& data); | 47 bool Send(const WebData& data); |
| 48 void Close(); | 48 void Close(); |
| 49 | 49 |
| 50 // Must be called before |handle_| or |client_| is deleted. | 50 // Must be called before |handle_| or |client_| is deleted. |
| 51 // Once detached, it never calls |client_| back. | 51 // Once detached, it never calls |client_| back. |
| 52 void Detach(); | 52 void Detach(); |
| 53 | 53 |
| 54 // WebSocketStreamHandleDelegate methods: | 54 // WebSocketStreamHandleDelegate methods: |
| 55 virtual void DidOpenStream(WebSocketStreamHandle*, int) OVERRIDE; | 55 virtual void DidOpenStream(WebSocketStreamHandle*, int) override; |
| 56 virtual void DidSendData(WebSocketStreamHandle*, int) OVERRIDE; | 56 virtual void DidSendData(WebSocketStreamHandle*, int) override; |
| 57 virtual void DidReceiveData(WebSocketStreamHandle*, | 57 virtual void DidReceiveData(WebSocketStreamHandle*, |
| 58 const char*, | 58 const char*, |
| 59 int) OVERRIDE; | 59 int) override; |
| 60 virtual void DidClose(WebSocketStreamHandle*) OVERRIDE; | 60 virtual void DidClose(WebSocketStreamHandle*) override; |
| 61 virtual void DidFail(WebSocketStreamHandle*, | 61 virtual void DidFail(WebSocketStreamHandle*, |
| 62 int, | 62 int, |
| 63 const base::string16&) OVERRIDE; | 63 const base::string16&) override; |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 friend class base::RefCounted<Context>; | 66 friend class base::RefCounted<Context>; |
| 67 virtual ~Context() { | 67 virtual ~Context() { |
| 68 DCHECK(!handle_); | 68 DCHECK(!handle_); |
| 69 DCHECK(!client_); | 69 DCHECK(!client_); |
| 70 DCHECK(!bridge_.get()); | 70 DCHECK(!bridge_.get()); |
| 71 } | 71 } |
| 72 | 72 |
| 73 WebSocketStreamHandleImpl* handle_; | 73 WebSocketStreamHandleImpl* handle_; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 189 |
| 190 bool WebSocketStreamHandleImpl::send(const WebData& data) { | 190 bool WebSocketStreamHandleImpl::send(const WebData& data) { |
| 191 return context_->Send(data); | 191 return context_->Send(data); |
| 192 } | 192 } |
| 193 | 193 |
| 194 void WebSocketStreamHandleImpl::close() { | 194 void WebSocketStreamHandleImpl::close() { |
| 195 context_->Close(); | 195 context_->Close(); |
| 196 } | 196 } |
| 197 | 197 |
| 198 } // namespace content | 198 } // namespace content |
| OLD | NEW |