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

Side by Side Diff: third_party/WebKit/Source/modules/mediastream/RTCDTMFSender.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 16 matching lines...) Expand all
27 27
28 #include "bindings/core/v8/ExceptionMessages.h" 28 #include "bindings/core/v8/ExceptionMessages.h"
29 #include "bindings/core/v8/ExceptionState.h" 29 #include "bindings/core/v8/ExceptionState.h"
30 #include "core/dom/ExceptionCode.h" 30 #include "core/dom/ExceptionCode.h"
31 #include "core/dom/ExecutionContext.h" 31 #include "core/dom/ExecutionContext.h"
32 #include "modules/mediastream/MediaStreamTrack.h" 32 #include "modules/mediastream/MediaStreamTrack.h"
33 #include "modules/mediastream/RTCDTMFToneChangeEvent.h" 33 #include "modules/mediastream/RTCDTMFToneChangeEvent.h"
34 #include "public/platform/WebMediaStreamTrack.h" 34 #include "public/platform/WebMediaStreamTrack.h"
35 #include "public/platform/WebRTCDTMFSenderHandler.h" 35 #include "public/platform/WebRTCDTMFSenderHandler.h"
36 #include "public/platform/WebRTCPeerConnectionHandler.h" 36 #include "public/platform/WebRTCPeerConnectionHandler.h"
37 #include "wtf/PtrUtil.h"
38 #include <memory>
37 39
38 namespace blink { 40 namespace blink {
39 41
40 static const int minToneDurationMs = 70; 42 static const int minToneDurationMs = 70;
41 static const int defaultToneDurationMs = 100; 43 static const int defaultToneDurationMs = 100;
42 static const int maxToneDurationMs = 6000; 44 static const int maxToneDurationMs = 6000;
43 static const int minInterToneGapMs = 50; 45 static const int minInterToneGapMs = 50;
44 static const int defaultInterToneGapMs = 50; 46 static const int defaultInterToneGapMs = 50;
45 47
46 RTCDTMFSender* RTCDTMFSender::create(ExecutionContext* context, WebRTCPeerConnec tionHandler* peerConnectionHandler, MediaStreamTrack* track, ExceptionState& exc eptionState) 48 RTCDTMFSender* RTCDTMFSender::create(ExecutionContext* context, WebRTCPeerConnec tionHandler* peerConnectionHandler, MediaStreamTrack* track, ExceptionState& exc eptionState)
47 { 49 {
48 OwnPtr<WebRTCDTMFSenderHandler> handler = adoptPtr(peerConnectionHandler->cr eateDTMFSender(track->component())); 50 std::unique_ptr<WebRTCDTMFSenderHandler> handler = wrapUnique(peerConnection Handler->createDTMFSender(track->component()));
49 if (!handler) { 51 if (!handler) {
50 exceptionState.throwDOMException(NotSupportedError, "The MediaStreamTrac k provided is not an element of a MediaStream that's currently in the local stre ams set."); 52 exceptionState.throwDOMException(NotSupportedError, "The MediaStreamTrac k provided is not an element of a MediaStream that's currently in the local stre ams set.");
51 return nullptr; 53 return nullptr;
52 } 54 }
53 55
54 RTCDTMFSender* dtmfSender = new RTCDTMFSender(context, track, std::move(hand ler)); 56 RTCDTMFSender* dtmfSender = new RTCDTMFSender(context, track, std::move(hand ler));
55 dtmfSender->suspendIfNeeded(); 57 dtmfSender->suspendIfNeeded();
56 return dtmfSender; 58 return dtmfSender;
57 } 59 }
58 60
59 RTCDTMFSender::RTCDTMFSender(ExecutionContext* context, MediaStreamTrack* track, PassOwnPtr<WebRTCDTMFSenderHandler> handler) 61 RTCDTMFSender::RTCDTMFSender(ExecutionContext* context, MediaStreamTrack* track, std::unique_ptr<WebRTCDTMFSenderHandler> handler)
60 : ActiveDOMObject(context) 62 : ActiveDOMObject(context)
61 , m_track(track) 63 , m_track(track)
62 , m_duration(defaultToneDurationMs) 64 , m_duration(defaultToneDurationMs)
63 , m_interToneGap(defaultInterToneGapMs) 65 , m_interToneGap(defaultInterToneGapMs)
64 , m_handler(std::move(handler)) 66 , m_handler(std::move(handler))
65 , m_stopped(false) 67 , m_stopped(false)
66 , m_scheduledEventTimer(this, &RTCDTMFSender::scheduledEventTimerFired) 68 , m_scheduledEventTimer(this, &RTCDTMFSender::scheduledEventTimerFired)
67 { 69 {
68 ThreadState::current()->registerPreFinalizer(this); 70 ThreadState::current()->registerPreFinalizer(this);
69 m_handler->setClient(this); 71 m_handler->setClient(this);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 176
175 DEFINE_TRACE(RTCDTMFSender) 177 DEFINE_TRACE(RTCDTMFSender)
176 { 178 {
177 visitor->trace(m_track); 179 visitor->trace(m_track);
178 visitor->trace(m_scheduledEvents); 180 visitor->trace(m_scheduledEvents);
179 EventTargetWithInlineData::trace(visitor); 181 EventTargetWithInlineData::trace(visitor);
180 ActiveDOMObject::trace(visitor); 182 ActiveDOMObject::trace(visitor);
181 } 183 }
182 184
183 } // namespace blink 185 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698