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

Side by Side Diff: third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp

Issue 2772283002: Destroy WebRTCStatsReportCallbackResolver on main thread, fixes crash. (Closed)
Patch Set: DCHECK that the callback is invoked and destroyed on the expected thread Created 3 years, 8 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 | « content/renderer/media/rtc_peer_connection_handler.cc ('k') | no next file » | 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 * 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 // |RTCPeerConnection::getStats(ScriptState*, MediaStreamTrack*)| 386 // |RTCPeerConnection::getStats(ScriptState*, MediaStreamTrack*)|
387 class WebRTCStatsReportCallbackResolver : public WebRTCStatsReportCallback { 387 class WebRTCStatsReportCallbackResolver : public WebRTCStatsReportCallback {
388 public: 388 public:
389 // Takes ownership of |resolver|. 389 // Takes ownership of |resolver|.
390 static std::unique_ptr<WebRTCStatsReportCallback> create( 390 static std::unique_ptr<WebRTCStatsReportCallback> create(
391 ScriptPromiseResolver* resolver) { 391 ScriptPromiseResolver* resolver) {
392 return std::unique_ptr<WebRTCStatsReportCallback>( 392 return std::unique_ptr<WebRTCStatsReportCallback>(
393 new WebRTCStatsReportCallbackResolver(resolver)); 393 new WebRTCStatsReportCallbackResolver(resolver));
394 } 394 }
395 395
396 ~WebRTCStatsReportCallbackResolver() override {} 396 ~WebRTCStatsReportCallbackResolver() override {
397 DCHECK(
398 m_resolver->getScriptState()->getExecutionContext()->isContextThread());
399 }
397 400
398 private: 401 private:
399 WebRTCStatsReportCallbackResolver(ScriptPromiseResolver* resolver) 402 WebRTCStatsReportCallbackResolver(ScriptPromiseResolver* resolver)
400 : m_resolver(resolver) {} 403 : m_resolver(resolver) {}
401 404
402 void OnStatsDelivered(std::unique_ptr<WebRTCStatsReport> report) override { 405 void OnStatsDelivered(std::unique_ptr<WebRTCStatsReport> report) override {
406 DCHECK(
407 m_resolver->getScriptState()->getExecutionContext()->isContextThread());
403 m_resolver->resolve(new RTCStatsReport(std::move(report))); 408 m_resolver->resolve(new RTCStatsReport(std::move(report)));
404 } 409 }
405 410
406 Persistent<ScriptPromiseResolver> m_resolver; 411 Persistent<ScriptPromiseResolver> m_resolver;
407 }; 412 };
408 413
409 } // namespace 414 } // namespace
410 415
411 RTCPeerConnection::EventWrapper::EventWrapper( 416 RTCPeerConnection::EventWrapper::EventWrapper(
412 Event* event, 417 Event* event,
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 DEFINE_TRACE(RTCPeerConnection) { 1505 DEFINE_TRACE(RTCPeerConnection) {
1501 visitor->trace(m_localStreams); 1506 visitor->trace(m_localStreams);
1502 visitor->trace(m_remoteStreams); 1507 visitor->trace(m_remoteStreams);
1503 visitor->trace(m_dispatchScheduledEventRunner); 1508 visitor->trace(m_dispatchScheduledEventRunner);
1504 visitor->trace(m_scheduledEvents); 1509 visitor->trace(m_scheduledEvents);
1505 EventTargetWithInlineData::trace(visitor); 1510 EventTargetWithInlineData::trace(visitor);
1506 SuspendableObject::trace(visitor); 1511 SuspendableObject::trace(visitor);
1507 } 1512 }
1508 1513
1509 } // namespace blink 1514 } // namespace blink
OLDNEW
« no previous file with comments | « content/renderer/media/rtc_peer_connection_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698