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 <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
8 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
10 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
11 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
12 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
13 #include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h
" | |
14 #include "third_party/WebKit/public/platform/WebRTCDataChannelHandler.h" | 16 #include "third_party/WebKit/public/platform/WebRTCDataChannelHandler.h" |
15 #include "third_party/WebKit/public/platform/WebRTCDataChannelHandlerClient.h" | 17 #include "third_party/WebKit/public/platform/WebRTCDataChannelHandlerClient.h" |
| 18 #include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h
" |
16 | 19 |
17 namespace content { | 20 namespace content { |
18 | 21 |
19 // RtcDataChannelHandler is a delegate for the RTC PeerConnection DataChannel | 22 // RtcDataChannelHandler is a delegate for the RTC PeerConnection DataChannel |
20 // API messages going between WebKit and native PeerConnection DataChannels in | 23 // API messages going between WebKit and native PeerConnection DataChannels in |
21 // libjingle. Instances of this class are owned by WebKit. | 24 // libjingle. Instances of this class are owned by WebKit. |
22 // WebKit call all of these methods on the main render thread. | 25 // WebKit call all of these methods on the main render thread. |
23 // Callbacks to the webrtc::DataChannelObserver implementation also occur on | 26 // Callbacks to the webrtc::DataChannelObserver implementation also occur on |
24 // the main render thread. | 27 // the main render thread. |
25 class CONTENT_EXPORT RtcDataChannelHandler | 28 class CONTENT_EXPORT RtcDataChannelHandler |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // will be attempted, disassociates this observer from the channel and | 83 // will be attempted, disassociates this observer from the channel and |
81 // releases the channel pointer. Must be called on the main thread. | 84 // releases the channel pointer. Must be called on the main thread. |
82 void Unregister(); | 85 void Unregister(); |
83 | 86 |
84 private: | 87 private: |
85 friend class base::RefCountedThreadSafe<RtcDataChannelHandler::Observer>; | 88 friend class base::RefCountedThreadSafe<RtcDataChannelHandler::Observer>; |
86 ~Observer() override; | 89 ~Observer() override; |
87 | 90 |
88 // webrtc::DataChannelObserver implementation. | 91 // webrtc::DataChannelObserver implementation. |
89 void OnStateChange() override; | 92 void OnStateChange() override; |
90 void OnBufferedAmountChange(uint64 previous_amount) override; | 93 void OnBufferedAmountChange(uint64_t previous_amount) override; |
91 void OnMessage(const webrtc::DataBuffer& buffer) override; | 94 void OnMessage(const webrtc::DataBuffer& buffer) override; |
92 | 95 |
93 void OnStateChangeImpl(webrtc::DataChannelInterface::DataState state); | 96 void OnStateChangeImpl(webrtc::DataChannelInterface::DataState state); |
94 void OnBufferedAmountDecreaseImpl(unsigned previous_amount); | 97 void OnBufferedAmountDecreaseImpl(unsigned previous_amount); |
95 void OnMessageImpl(scoped_ptr<webrtc::DataBuffer> buffer); | 98 void OnMessageImpl(scoped_ptr<webrtc::DataBuffer> buffer); |
96 | 99 |
97 RtcDataChannelHandler* handler_; | 100 RtcDataChannelHandler* handler_; |
98 const scoped_refptr<base::SingleThreadTaskRunner> main_thread_; | 101 const scoped_refptr<base::SingleThreadTaskRunner> main_thread_; |
99 scoped_refptr<webrtc::DataChannelInterface> channel_; | 102 scoped_refptr<webrtc::DataChannelInterface> channel_; |
100 }; | 103 }; |
101 | 104 |
102 scoped_refptr<Observer> observer_; | 105 scoped_refptr<Observer> observer_; |
103 base::ThreadChecker thread_checker_; | 106 base::ThreadChecker thread_checker_; |
104 | 107 |
105 blink::WebRTCDataChannelHandlerClient* webkit_client_; | 108 blink::WebRTCDataChannelHandlerClient* webkit_client_; |
106 }; | 109 }; |
107 | 110 |
108 } // namespace content | 111 } // namespace content |
109 | 112 |
110 #endif // CONTENT_RENDERER_MEDIA_RTC_DATA_CHANNEL_HANDLER_H_ | 113 #endif // CONTENT_RENDERER_MEDIA_RTC_DATA_CHANNEL_HANDLER_H_ |
OLD | NEW |