Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: Source/modules/mediastream/RTCDataChannel.h

Issue 1171553002: Initial implementation of onbufferedamountlow (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove reference to file that no longer exists Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/events/EventTypeNames.in ('k') | Source/modules/mediastream/RTCDataChannel.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 24 matching lines...) Expand all
35 35
36 class Blob; 36 class Blob;
37 class DOMArrayBuffer; 37 class DOMArrayBuffer;
38 class DOMArrayBufferView; 38 class DOMArrayBufferView;
39 class ExceptionState; 39 class ExceptionState;
40 class RTCPeerConnection; 40 class RTCPeerConnection;
41 class WebRTCDataChannelHandler; 41 class WebRTCDataChannelHandler;
42 class WebRTCPeerConnectionHandler; 42 class WebRTCPeerConnectionHandler;
43 struct WebRTCDataChannelInit; 43 struct WebRTCDataChannelInit;
44 44
45 class RTCDataChannel final 45 class MODULES_EXPORT RTCDataChannel final
46 : public RefCountedGarbageCollectedEventTargetWithInlineData<RTCDataChannel> 46 : public RefCountedGarbageCollectedEventTargetWithInlineData<RTCDataChannel>
47 , public WebRTCDataChannelHandlerClient { 47 , public WebRTCDataChannelHandlerClient {
48 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(RTCDataChannel); 48 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(RTCDataChannel);
49 DEFINE_WRAPPERTYPEINFO(); 49 DEFINE_WRAPPERTYPEINFO();
50 public: 50 public:
51 static RTCDataChannel* create(ExecutionContext*, RTCPeerConnection*, PassOwn Ptr<WebRTCDataChannelHandler>); 51 static RTCDataChannel* create(ExecutionContext*, RTCPeerConnection*, PassOwn Ptr<WebRTCDataChannelHandler>);
52 static RTCDataChannel* create(ExecutionContext*, RTCPeerConnection*, WebRTCP eerConnectionHandler*, const String& label, const WebRTCDataChannelInit&, Except ionState&); 52 static RTCDataChannel* create(ExecutionContext*, RTCPeerConnection*, WebRTCP eerConnectionHandler*, const String& label, const WebRTCDataChannelInit&, Except ionState&);
53 ~RTCDataChannel() override; 53 ~RTCDataChannel() override;
54 54
55 ReadyState getHandlerState() const; 55 ReadyState getHandlerState() const;
56 56
57 String label() const; 57 String label() const;
58 58
59 // DEPRECATED 59 // DEPRECATED
60 bool reliable() const; 60 bool reliable() const;
61 61
62 bool ordered() const; 62 bool ordered() const;
63 unsigned short maxRetransmitTime() const; 63 unsigned short maxRetransmitTime() const;
64 unsigned short maxRetransmits() const; 64 unsigned short maxRetransmits() const;
65 String protocol() const; 65 String protocol() const;
66 bool negotiated() const; 66 bool negotiated() const;
67 unsigned short id() const; 67 unsigned short id() const;
68 String readyState() const; 68 String readyState() const;
69 unsigned bufferedAmount() const; 69 unsigned bufferedAmount() const;
70 70
71 unsigned bufferedAmountLowThreshold() const;
72 void setBufferedAmountLowThreshold(unsigned);
73
71 String binaryType() const; 74 String binaryType() const;
72 void setBinaryType(const String&, ExceptionState&); 75 void setBinaryType(const String&, ExceptionState&);
73 76
74 void send(const String&, ExceptionState&); 77 void send(const String&, ExceptionState&);
75 void send(PassRefPtr<DOMArrayBuffer>, ExceptionState&); 78 void send(PassRefPtr<DOMArrayBuffer>, ExceptionState&);
76 void send(PassRefPtr<DOMArrayBufferView>, ExceptionState&); 79 void send(PassRefPtr<DOMArrayBufferView>, ExceptionState&);
77 void send(Blob*, ExceptionState&); 80 void send(Blob*, ExceptionState&);
78 81
79 void close(); 82 void close();
80 83
81 DEFINE_ATTRIBUTE_EVENT_LISTENER(open); 84 DEFINE_ATTRIBUTE_EVENT_LISTENER(open);
85 DEFINE_ATTRIBUTE_EVENT_LISTENER(bufferedamountlow);
82 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); 86 DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
83 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); 87 DEFINE_ATTRIBUTE_EVENT_LISTENER(close);
84 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); 88 DEFINE_ATTRIBUTE_EVENT_LISTENER(message);
85 89
86 void stop(); 90 void stop();
87 91
88 // EventTarget 92 // EventTarget
89 const AtomicString& interfaceName() const override; 93 const AtomicString& interfaceName() const override;
90 ExecutionContext* executionContext() const override; 94 ExecutionContext* executionContext() const override;
91 95
92 void clearWeakMembers(Visitor*); 96 void clearWeakMembers(Visitor*);
93 97
94 // Oilpan: need to eagerly finalize m_handler 98 // Oilpan: need to eagerly finalize m_handler
95 EAGERLY_FINALIZE(); 99 EAGERLY_FINALIZE();
96 DECLARE_VIRTUAL_TRACE(); 100 DECLARE_VIRTUAL_TRACE();
97 101
98 // WebRTCDataChannelHandlerClient 102 // WebRTCDataChannelHandlerClient
99 void didChangeReadyState(WebRTCDataChannelHandlerClient::ReadyState) overrid e; 103 void didChangeReadyState(WebRTCDataChannelHandlerClient::ReadyState) overrid e;
104 void didDecreaseBufferedAmount(unsigned) override;
100 void didReceiveStringData(const WebString&) override; 105 void didReceiveStringData(const WebString&) override;
101 void didReceiveRawData(const char*, size_t) override; 106 void didReceiveRawData(const char*, size_t) override;
102 void didDetectError() override; 107 void didDetectError() override;
103 108
104 private: 109 private:
105 RTCDataChannel(ExecutionContext*, RTCPeerConnection*, PassOwnPtr<WebRTCDataC hannelHandler>); 110 RTCDataChannel(ExecutionContext*, RTCPeerConnection*, PassOwnPtr<WebRTCDataC hannelHandler>);
106 111
107 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>); 112 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>);
108 void scheduledEventTimerFired(Timer<RTCDataChannel>*); 113 void scheduledEventTimerFired(Timer<RTCDataChannel>*);
109 114
110 RawPtrWillBeMember<ExecutionContext> m_executionContext; 115 RawPtrWillBeMember<ExecutionContext> m_executionContext;
111 116
112 OwnPtr<WebRTCDataChannelHandler> m_handler; 117 OwnPtr<WebRTCDataChannelHandler> m_handler;
113 118
114 bool m_stopped; 119 bool m_stopped;
115 120
116 WebRTCDataChannelHandlerClient::ReadyState m_readyState; 121 WebRTCDataChannelHandlerClient::ReadyState m_readyState;
117 122
118 enum BinaryType { 123 enum BinaryType {
119 BinaryTypeBlob, 124 BinaryTypeBlob,
120 BinaryTypeArrayBuffer 125 BinaryTypeArrayBuffer
121 }; 126 };
122 BinaryType m_binaryType; 127 BinaryType m_binaryType;
123 128
124 Timer<RTCDataChannel> m_scheduledEventTimer; 129 Timer<RTCDataChannel> m_scheduledEventTimer;
125 WillBeHeapVector<RefPtrWillBeMember<Event>> m_scheduledEvents; 130 WillBeHeapVector<RefPtrWillBeMember<Event>> m_scheduledEvents;
126 131
127 WeakMember<RTCPeerConnection> m_connection; 132 WeakMember<RTCPeerConnection> m_connection;
133
134 unsigned m_bufferedAmountLowThreshold;
135
136 // TODO(tkent): Use FRIEND_TEST macro provided by gtest_prod.h
137 friend class RTCDataChannelTest_BufferedAmountLow_Test; // NOLINT
128 }; 138 };
129 139
130 } // namespace blink 140 } // namespace blink
131 141
132 #endif // RTCDataChannel_h 142 #endif // RTCDataChannel_h
OLDNEW
« no previous file with comments | « Source/core/events/EventTypeNames.in ('k') | Source/modules/mediastream/RTCDataChannel.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698