| OLD | NEW |
| 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 delete this; | 123 delete this; |
| 124 } | 124 } |
| 125 | 125 |
| 126 Persistent<ScriptPromiseResolver> m_resolver; | 126 Persistent<ScriptPromiseResolver> m_resolver; |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 } // namespace | 129 } // namespace |
| 130 | 130 |
| 131 RTCPeerConnection::EventWrapper::EventWrapper( | 131 RTCPeerConnection::EventWrapper::EventWrapper( |
| 132 PassRefPtrWillBeRawPtr<Event> event, | 132 PassRefPtrWillBeRawPtr<Event> event, |
| 133 PassOwnPtrWillBeRawPtr<BoolFunction> function) | 133 PassOwnPtr<BoolFunction> function) |
| 134 : m_event(event) | 134 : m_event(event) |
| 135 , m_setupFunction(function) | 135 , m_setupFunction(function) |
| 136 { | 136 { |
| 137 } | 137 } |
| 138 | 138 |
| 139 bool RTCPeerConnection::EventWrapper::setup() | 139 bool RTCPeerConnection::EventWrapper::setup() |
| 140 { | 140 { |
| 141 if (m_setupFunction) { | 141 if (m_setupFunction) { |
| 142 return (*m_setupFunction)(); | 142 return (*m_setupFunction)(); |
| 143 } | 143 } |
| 144 return true; | 144 return true; |
| 145 } | 145 } |
| 146 | 146 |
| 147 DEFINE_TRACE(RTCPeerConnection::EventWrapper) |
| 148 { |
| 149 visitor->trace(m_event); |
| 150 } |
| 151 |
| 147 RTCConfiguration* RTCPeerConnection::parseConfiguration(const Dictionary& config
uration, ExceptionState& exceptionState) | 152 RTCConfiguration* RTCPeerConnection::parseConfiguration(const Dictionary& config
uration, ExceptionState& exceptionState) |
| 148 { | 153 { |
| 149 if (configuration.isUndefinedOrNull()) | 154 if (configuration.isUndefinedOrNull()) |
| 150 return 0; | 155 return 0; |
| 151 | 156 |
| 152 RTCIceTransports iceTransports = RTCIceTransportsAll; | 157 RTCIceTransports iceTransports = RTCIceTransportsAll; |
| 153 String iceTransportsString; | 158 String iceTransportsString; |
| 154 if (DictionaryHelper::get(configuration, "iceTransports", iceTransportsStrin
g)) { | 159 if (DictionaryHelper::get(configuration, "iceTransports", iceTransportsStrin
g)) { |
| 155 if (iceTransportsString == "none") { | 160 if (iceTransportsString == "none") { |
| 156 iceTransports = RTCIceTransportsNone; | 161 iceTransports = RTCIceTransportsNone; |
| (...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 changeIceGatheringState(ICEGatheringStateComplete); | 1007 changeIceGatheringState(ICEGatheringStateComplete); |
| 1003 changeSignalingState(SignalingStateClosed); | 1008 changeSignalingState(SignalingStateClosed); |
| 1004 } | 1009 } |
| 1005 | 1010 |
| 1006 void RTCPeerConnection::scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event> even
t) | 1011 void RTCPeerConnection::scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event> even
t) |
| 1007 { | 1012 { |
| 1008 scheduleDispatchEvent(event, nullptr); | 1013 scheduleDispatchEvent(event, nullptr); |
| 1009 } | 1014 } |
| 1010 | 1015 |
| 1011 void RTCPeerConnection::scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event> even
t, | 1016 void RTCPeerConnection::scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event> even
t, |
| 1012 PassOwnPtrWillBeRawPtr<BoolFunction> setupFunction) | 1017 PassOwnPtr<BoolFunction> setupFunction) |
| 1013 { | 1018 { |
| 1014 m_scheduledEvents.append(EventWrapper(event, setupFunction)); | 1019 m_scheduledEvents.append(new EventWrapper(event, setupFunction)); |
| 1015 | 1020 |
| 1016 m_dispatchScheduledEventRunner.runAsync(); | 1021 m_dispatchScheduledEventRunner.runAsync(); |
| 1017 } | 1022 } |
| 1018 | 1023 |
| 1019 void RTCPeerConnection::dispatchScheduledEvent() | 1024 void RTCPeerConnection::dispatchScheduledEvent() |
| 1020 { | 1025 { |
| 1021 if (m_stopped) | 1026 if (m_stopped) |
| 1022 return; | 1027 return; |
| 1023 | 1028 |
| 1024 WillBeHeapVector<EventWrapper> events; | 1029 HeapVector<Member<EventWrapper>> events; |
| 1025 events.swap(m_scheduledEvents); | 1030 events.swap(m_scheduledEvents); |
| 1026 | 1031 |
| 1027 WillBeHeapVector<EventWrapper>::iterator it = events.begin(); | 1032 HeapVector<Member<EventWrapper>>::iterator it = events.begin(); |
| 1028 for (; it != events.end(); ++it) { | 1033 for (; it != events.end(); ++it) { |
| 1029 if ((*it).setup()) { | 1034 if ((*it)->setup()) { |
| 1030 dispatchEvent((*it).m_event.release()); | 1035 dispatchEvent((*it)->m_event.release()); |
| 1031 } | 1036 } |
| 1032 } | 1037 } |
| 1033 | 1038 |
| 1034 events.clear(); | 1039 events.clear(); |
| 1035 } | 1040 } |
| 1036 | 1041 |
| 1037 DEFINE_TRACE(RTCPeerConnection) | 1042 DEFINE_TRACE(RTCPeerConnection) |
| 1038 { | 1043 { |
| 1039 visitor->trace(m_localStreams); | 1044 visitor->trace(m_localStreams); |
| 1040 visitor->trace(m_remoteStreams); | 1045 visitor->trace(m_remoteStreams); |
| 1041 visitor->trace(m_dataChannels); | 1046 visitor->trace(m_dataChannels); |
| 1042 visitor->trace(m_scheduledEvents); | 1047 visitor->trace(m_scheduledEvents); |
| 1043 RefCountedGarbageCollectedEventTargetWithInlineData<RTCPeerConnection>::trac
e(visitor); | 1048 RefCountedGarbageCollectedEventTargetWithInlineData<RTCPeerConnection>::trac
e(visitor); |
| 1044 ActiveDOMObject::trace(visitor); | 1049 ActiveDOMObject::trace(visitor); |
| 1045 } | 1050 } |
| 1046 | 1051 |
| 1047 } // namespace blink | 1052 } // namespace blink |
| OLD | NEW |