| 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 CONTENT_RENDERER_MEDIA_RTC_DATA_CHANNEL_HANDLER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_RTC_DATA_CHANNEL_HANDLER_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_RTC_DATA_CHANNEL_HANDLER_H_ | 6 #define CONTENT_RENDERER_MEDIA_RTC_DATA_CHANNEL_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // The reason we must construct and hook ourselves up as an observer on the | 30 // The reason we must construct and hook ourselves up as an observer on the |
| 31 // signaling thread is to avoid missing out on any state changes or messages | 31 // signaling thread is to avoid missing out on any state changes or messages |
| 32 // that may occur before we've fully connected with webkit. | 32 // that may occur before we've fully connected with webkit. |
| 33 // This period is basically between when the ctor is called and until | 33 // This period is basically between when the ctor is called and until |
| 34 // setClient is called. | 34 // setClient is called. |
| 35 // * For local data channels, the object will be construced on the main thread | 35 // * For local data channels, the object will be construced on the main thread |
| 36 // and we don't have the issue described above. | 36 // and we don't have the issue described above. |
| 37 RtcDataChannelHandler( | 37 RtcDataChannelHandler( |
| 38 const scoped_refptr<base::SingleThreadTaskRunner>& main_thread, | 38 const scoped_refptr<base::SingleThreadTaskRunner>& main_thread, |
| 39 webrtc::DataChannelInterface* channel); | 39 webrtc::DataChannelInterface* channel); |
| 40 virtual ~RtcDataChannelHandler(); | 40 ~RtcDataChannelHandler() override; |
| 41 | 41 |
| 42 // blink::WebRTCDataChannelHandler implementation. | 42 // blink::WebRTCDataChannelHandler implementation. |
| 43 virtual void setClient( | 43 void setClient( |
| 44 blink::WebRTCDataChannelHandlerClient* client) override; | 44 blink::WebRTCDataChannelHandlerClient* client) override; |
| 45 virtual blink::WebString label() override; | 45 blink::WebString label() override; |
| 46 virtual bool isReliable() override; | 46 bool isReliable() override; |
| 47 virtual bool ordered() const override; | 47 bool ordered() const override; |
| 48 virtual unsigned short maxRetransmitTime() const override; | 48 unsigned short maxRetransmitTime() const override; |
| 49 virtual unsigned short maxRetransmits() const override; | 49 unsigned short maxRetransmits() const override; |
| 50 virtual blink::WebString protocol() const override; | 50 blink::WebString protocol() const override; |
| 51 virtual bool negotiated() const override; | 51 bool negotiated() const override; |
| 52 virtual unsigned short id() const override; | 52 unsigned short id() const override; |
| 53 // TODO(bemasc): Mark |state()| as |override| once https://codereview.chromium
.org/782843003/ | 53 blink::WebRTCDataChannelHandlerClient::ReadyState state() const override; |
| 54 // lands in Blink and rolls into Chromium. | 54 unsigned long bufferedAmount() override; |
| 55 virtual blink::WebRTCDataChannelHandlerClient::ReadyState state() const; | 55 bool sendStringData(const blink::WebString& data) override; |
| 56 virtual unsigned long bufferedAmount() override; | 56 bool sendRawData(const char* data, size_t length) override; |
| 57 virtual bool sendStringData(const blink::WebString& data) override; | 57 void close() override; |
| 58 virtual bool sendRawData(const char* data, size_t length) override; | |
| 59 virtual void close() override; | |
| 60 | 58 |
| 61 const scoped_refptr<webrtc::DataChannelInterface>& channel() const; | 59 const scoped_refptr<webrtc::DataChannelInterface>& channel() const; |
| 62 | 60 |
| 63 private: | 61 private: |
| 64 void OnStateChange(webrtc::DataChannelInterface::DataState state); | 62 void OnStateChange(webrtc::DataChannelInterface::DataState state); |
| 65 void OnMessage(scoped_ptr<webrtc::DataBuffer> buffer); | 63 void OnMessage(scoped_ptr<webrtc::DataBuffer> buffer); |
| 66 void RecordMessageSent(size_t num_bytes); | 64 void RecordMessageSent(size_t num_bytes); |
| 67 | 65 |
| 68 class CONTENT_EXPORT Observer | 66 class CONTENT_EXPORT Observer |
| 69 : public NON_EXPORTED_BASE( | 67 : public NON_EXPORTED_BASE( |
| (...skipping 30 matching lines...) Expand all Loading... |
| 100 | 98 |
| 101 scoped_refptr<Observer> observer_; | 99 scoped_refptr<Observer> observer_; |
| 102 base::ThreadChecker thread_checker_; | 100 base::ThreadChecker thread_checker_; |
| 103 | 101 |
| 104 blink::WebRTCDataChannelHandlerClient* webkit_client_; | 102 blink::WebRTCDataChannelHandlerClient* webkit_client_; |
| 105 }; | 103 }; |
| 106 | 104 |
| 107 } // namespace content | 105 } // namespace content |
| 108 | 106 |
| 109 #endif // CONTENT_RENDERER_MEDIA_RTC_DATA_CHANNEL_HANDLER_H_ | 107 #endif // CONTENT_RENDERER_MEDIA_RTC_DATA_CHANNEL_HANDLER_H_ |
| OLD | NEW |