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

Side by Side Diff: third_party/WebKit/Source/modules/mediastream/RTCDataChannel.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) 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 15 matching lines...) Expand all
26 26
27 #include "bindings/core/v8/ExceptionState.h" 27 #include "bindings/core/v8/ExceptionState.h"
28 #include "core/dom/DOMArrayBuffer.h" 28 #include "core/dom/DOMArrayBuffer.h"
29 #include "core/dom/DOMArrayBufferView.h" 29 #include "core/dom/DOMArrayBufferView.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 "core/events/MessageEvent.h" 32 #include "core/events/MessageEvent.h"
33 #include "core/fileapi/Blob.h" 33 #include "core/fileapi/Blob.h"
34 #include "modules/mediastream/RTCPeerConnection.h" 34 #include "modules/mediastream/RTCPeerConnection.h"
35 #include "public/platform/WebRTCPeerConnectionHandler.h" 35 #include "public/platform/WebRTCPeerConnectionHandler.h"
36 #include "wtf/PtrUtil.h"
37 #include <memory>
36 38
37 namespace blink { 39 namespace blink {
38 40
39 static void throwNotOpenException(ExceptionState& exceptionState) 41 static void throwNotOpenException(ExceptionState& exceptionState)
40 { 42 {
41 exceptionState.throwDOMException(InvalidStateError, "RTCDataChannel.readySta te is not 'open'"); 43 exceptionState.throwDOMException(InvalidStateError, "RTCDataChannel.readySta te is not 'open'");
42 } 44 }
43 45
44 static void throwCouldNotSendDataException(ExceptionState& exceptionState) 46 static void throwCouldNotSendDataException(ExceptionState& exceptionState)
45 { 47 {
46 exceptionState.throwDOMException(NetworkError, "Could not send data"); 48 exceptionState.throwDOMException(NetworkError, "Could not send data");
47 } 49 }
48 50
49 static void throwNoBlobSupportException(ExceptionState& exceptionState) 51 static void throwNoBlobSupportException(ExceptionState& exceptionState)
50 { 52 {
51 exceptionState.throwDOMException(NotSupportedError, "Blob support not implem ented yet"); 53 exceptionState.throwDOMException(NotSupportedError, "Blob support not implem ented yet");
52 } 54 }
53 55
54 RTCDataChannel* RTCDataChannel::create(ExecutionContext* context, PassOwnPtr<Web RTCDataChannelHandler> handler) 56 RTCDataChannel* RTCDataChannel::create(ExecutionContext* context, std::unique_pt r<WebRTCDataChannelHandler> handler)
55 { 57 {
56 DCHECK(handler); 58 DCHECK(handler);
57 RTCDataChannel* channel = new RTCDataChannel(context, std::move(handler)); 59 RTCDataChannel* channel = new RTCDataChannel(context, std::move(handler));
58 channel->suspendIfNeeded(); 60 channel->suspendIfNeeded();
59 61
60 return channel; 62 return channel;
61 } 63 }
62 64
63 RTCDataChannel* RTCDataChannel::create(ExecutionContext* context, WebRTCPeerConn ectionHandler* peerConnectionHandler, const String& label, const WebRTCDataChann elInit& init, ExceptionState& exceptionState) 65 RTCDataChannel* RTCDataChannel::create(ExecutionContext* context, WebRTCPeerConn ectionHandler* peerConnectionHandler, const String& label, const WebRTCDataChann elInit& init, ExceptionState& exceptionState)
64 { 66 {
65 OwnPtr<WebRTCDataChannelHandler> handler = adoptPtr(peerConnectionHandler->c reateDataChannel(label, init)); 67 std::unique_ptr<WebRTCDataChannelHandler> handler = wrapUnique(peerConnectio nHandler->createDataChannel(label, init));
66 if (!handler) { 68 if (!handler) {
67 exceptionState.throwDOMException(NotSupportedError, "RTCDataChannel is n ot supported"); 69 exceptionState.throwDOMException(NotSupportedError, "RTCDataChannel is n ot supported");
68 return nullptr; 70 return nullptr;
69 } 71 }
70 RTCDataChannel* channel = new RTCDataChannel(context, std::move(handler)); 72 RTCDataChannel* channel = new RTCDataChannel(context, std::move(handler));
71 channel->suspendIfNeeded(); 73 channel->suspendIfNeeded();
72 74
73 return channel; 75 return channel;
74 } 76 }
75 77
76 RTCDataChannel::RTCDataChannel(ExecutionContext* context, PassOwnPtr<WebRTCDataC hannelHandler> handler) 78 RTCDataChannel::RTCDataChannel(ExecutionContext* context, std::unique_ptr<WebRTC DataChannelHandler> handler)
77 : ActiveScriptWrappable(this) 79 : ActiveScriptWrappable(this)
78 , ActiveDOMObject(context) 80 , ActiveDOMObject(context)
79 , m_handler(std::move(handler)) 81 , m_handler(std::move(handler))
80 , m_readyState(ReadyStateConnecting) 82 , m_readyState(ReadyStateConnecting)
81 , m_binaryType(BinaryTypeArrayBuffer) 83 , m_binaryType(BinaryTypeArrayBuffer)
82 , m_scheduledEventTimer(this, &RTCDataChannel::scheduledEventTimerFired) 84 , m_scheduledEventTimer(this, &RTCDataChannel::scheduledEventTimerFired)
83 , m_bufferedAmountLowThreshold(0U) 85 , m_bufferedAmountLowThreshold(0U)
84 , m_stopped(false) 86 , m_stopped(false)
85 { 87 {
86 ThreadState::current()->registerPreFinalizer(this); 88 ThreadState::current()->registerPreFinalizer(this);
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 } 391 }
390 392
391 DEFINE_TRACE(RTCDataChannel) 393 DEFINE_TRACE(RTCDataChannel)
392 { 394 {
393 visitor->trace(m_scheduledEvents); 395 visitor->trace(m_scheduledEvents);
394 EventTargetWithInlineData::trace(visitor); 396 EventTargetWithInlineData::trace(visitor);
395 ActiveDOMObject::trace(visitor); 397 ActiveDOMObject::trace(visitor);
396 } 398 }
397 399
398 } // namespace blink 400 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698