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

Side by Side Diff: third_party/WebKit/Source/platform/mediastream/MediaStreamSource.cpp

Issue 2741663004: MediaStreamSource: verify unlocked state when finalizing. (Closed)
Patch Set: Created 3 years, 9 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 | « third_party/WebKit/Source/platform/mediastream/MediaStreamSource.h ('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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 bool remote, 48 bool remote,
49 ReadyState readyState, 49 ReadyState readyState,
50 bool requiresConsumer) 50 bool requiresConsumer)
51 : m_id(id), 51 : m_id(id),
52 m_type(type), 52 m_type(type),
53 m_name(name), 53 m_name(name),
54 m_remote(remote), 54 m_remote(remote),
55 m_readyState(readyState), 55 m_readyState(readyState),
56 m_requiresConsumer(requiresConsumer) {} 56 m_requiresConsumer(requiresConsumer) {}
57 57
58 MediaStreamSource::~MediaStreamSource() {
59 // Verify that the audio thread isn't consuming audio.
60 // TODO(sof): remove once crbug.com/682945 has been diagnosed.
61 MutexTryLocker tryLocker(m_audioConsumersLock);
62 CHECK(tryLocker.locked());
63 }
64
58 void MediaStreamSource::setReadyState(ReadyState readyState) { 65 void MediaStreamSource::setReadyState(ReadyState readyState) {
59 if (m_readyState != ReadyStateEnded && m_readyState != readyState) { 66 if (m_readyState != ReadyStateEnded && m_readyState != readyState) {
60 m_readyState = readyState; 67 m_readyState = readyState;
61 68
62 // Observers may dispatch events which create and add new Observers; 69 // Observers may dispatch events which create and add new Observers;
63 // take a snapshot so as to safely iterate. 70 // take a snapshot so as to safely iterate.
64 HeapVector<Member<Observer>> observers; 71 HeapVector<Member<Observer>> observers;
65 copyToVector(m_observers, observers); 72 copyToVector(m_observers, observers);
66 for (auto observer : observers) 73 for (auto observer : observers)
67 observer->sourceChangedState(); 74 observer->sourceChangedState();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 it != m_audioConsumers.end(); ++it) 119 it != m_audioConsumers.end(); ++it)
113 (*it)->consumeAudio(bus, numberOfFrames); 120 (*it)->consumeAudio(bus, numberOfFrames);
114 } 121 }
115 122
116 DEFINE_TRACE(MediaStreamSource) { 123 DEFINE_TRACE(MediaStreamSource) {
117 visitor->trace(m_observers); 124 visitor->trace(m_observers);
118 visitor->trace(m_audioConsumers); 125 visitor->trace(m_audioConsumers);
119 } 126 }
120 127
121 } // namespace blink 128 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/mediastream/MediaStreamSource.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698