Skip to content

Commit

Permalink
Revert of media/track: Replace wtf/Assertions.h macros in favor of ba…
Browse files Browse the repository at this point in the history
…se/logging.h macros (patchset #3 id:40001 of https://codereview.chromium.org/2003543002/ )

Reason for revert:
Crash build http://build.chromium.org/p/chromium.mac/builders/Mac%20Builder/builds/44237.

https://chromium.googlesource.com/chromium/src/+blame/master/third_party/WebKit/Source/core/html/track/vtt/VTTCue.cpp#783

DCHECKs are removed from Release build.

Original issue's description:
> media/track: Replace wtf/Assertions.h macros in favor of base/logging.h macros
>
> Replaced wtf/Assertions.h macros in favor of base/logging.h
> macros in core/html/track folder.
>
> ASSERT, ASSERT_UNUSED -> DCHECK
> ASSERT_NOT_REACHED -> NOTREACHED
> ASSERT_WITH_SECURITY_IMPLICATION -> SECURITY_DCHECK
>
> BUG=596522
>
> Committed: https://crrev.com/63fee82a587cce7057768670d4b98a6d1660f515
> Cr-Commit-Position: refs/heads/master@{#395078}

[email protected],[email protected]
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=596522

Review-Url: https://codereview.chromium.org/1999813002
Cr-Commit-Position: refs/heads/master@{#395080}
  • Loading branch information
gogerald authored and Commit bot committed May 20, 2016
1 parent 5ac34c9 commit 45983aa
Show file tree
Hide file tree
Showing 21 changed files with 96 additions and 94 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const AtomicString& AutomaticTrackSelection::preferredTrackKind() const

void AutomaticTrackSelection::performAutomaticTextTrackSelection(const TrackGroup& group)
{
DCHECK(group.tracks.size());
ASSERT(group.tracks.size());

// First, find the track in the group that should be enabled (if any).
HeapVector<Member<TextTrack>> currentlyEnabledTracks;
Expand Down Expand Up @@ -142,7 +142,7 @@ void AutomaticTrackSelection::performAutomaticTextTrackSelection(const TrackGrou

void AutomaticTrackSelection::enableDefaultMetadataTextTracks(const TrackGroup& group)
{
DCHECK(group.tracks.size());
ASSERT(group.tracks.size());

// https://html.spec.whatwg.org/multipage/embedded-content.html#honor-user-preferences-for-automatic-text-track-selection

Expand Down Expand Up @@ -180,7 +180,7 @@ void AutomaticTrackSelection::perform(TextTrackList& textTracks)
} else if (kind == TextTrack::chaptersKeyword()) {
currentGroup = &chapterTracks;
} else {
DCHECK_EQ(kind, TextTrack::metadataKeyword());
ASSERT(kind == TextTrack::metadataKeyword());
currentGroup = &metadataTracks;
}

Expand Down
10 changes: 5 additions & 5 deletions third_party/WebKit/Source/core/html/track/CueTimeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ CueTimeline::CueTimeline(HTMLMediaElement& mediaElement)

void CueTimeline::addCues(TextTrack* track, const TextTrackCueList* cues)
{
DCHECK_NE(track->mode(), TextTrack::disabledKeyword());
ASSERT(track->mode() != TextTrack::disabledKeyword());
for (size_t i = 0; i < cues->length(); ++i)
addCueInternal(cues->anonymousIndexedGetter(i));
updateActiveCues(mediaElement().currentTime());
}

void CueTimeline::addCue(TextTrack* track, TextTrackCue* cue)
{
DCHECK_NE(track->mode(), TextTrack::disabledKeyword());
ASSERT(track->mode() != TextTrack::disabledKeyword());
addCueInternal(cue);
updateActiveCues(mediaElement().currentTime());
}
Expand Down Expand Up @@ -72,7 +72,7 @@ void CueTimeline::removeCueInternal(TextTrackCue* cue)

size_t index = m_currentlyActiveCues.find(interval);
if (index != kNotFound) {
DCHECK(cue->isActive());
ASSERT(cue->isActive());
m_currentlyActiveCues.remove(index);
cue->setIsActive(false);
// Since the cue will be removed from the media element and likely the
Expand Down Expand Up @@ -320,7 +320,7 @@ void CueTimeline::updateActiveCues(double movieTime)
// simple event named cuechange at the track element as well.
if (affectedTracks[i]->trackType() == TextTrack::TrackElement) {
HTMLTrackElement* trackElement = static_cast<LoadableTextTrack*>(affectedTracks[i].get())->trackElement();
DCHECK(trackElement);
ASSERT(trackElement);
mediaElement.scheduleEvent(createEventWithTarget(EventTypeNames::cuechange, trackElement));
}
}
Expand Down Expand Up @@ -351,7 +351,7 @@ void CueTimeline::beginIgnoringUpdateRequests()

void CueTimeline::endIgnoringUpdateRequests()
{
DCHECK(m_ignoreUpdate);
ASSERT(m_ignoreUpdate);
--m_ignoreUpdate;
if (!m_ignoreUpdate)
updateActiveCues(mediaElement().currentTime());
Expand Down
2 changes: 1 addition & 1 deletion third_party/WebKit/Source/core/html/track/CueTimeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class TrackDisplayUpdateScope {
}
~TrackDisplayUpdateScope()
{
DCHECK(m_cueTimeline);
ASSERT(m_cueTimeline);
m_cueTimeline->endIgnoringUpdateRequests();
}

Expand Down
6 changes: 3 additions & 3 deletions third_party/WebKit/Source/core/html/track/InbandTextTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const AtomicString& textTrackKindToString(WebInbandTextTrack::Kind kind)
default:
break;
}
NOTREACHED();
ASSERT_NOT_REACHED();
return TextTrack::subtitlesKeyword();
}

Expand Down Expand Up @@ -84,15 +84,15 @@ void InbandTextTrack::setTrackList(TextTrackList* trackList)
if (trackList)
return;

DCHECK(m_webTrack);
ASSERT(m_webTrack);
m_webTrack->setClient(nullptr);
m_webTrack = nullptr;
}

void InbandTextTrack::addWebVTTCue(double start, double end, const WebString& id, const WebString& content, const WebString& settings)
{
HTMLMediaElement* owner = mediaElement();
DCHECK(owner);
ASSERT(owner);
VTTCue* cue = VTTCue::create(owner->document(), start, end, content);
cue->setId(id);
cue->parseSettings(settings);
Expand Down
21 changes: 11 additions & 10 deletions third_party/WebKit/Source/core/html/track/TextTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ bool TextTrack::isVisualKind() const

void TextTrack::setMode(const AtomicString& mode)
{
DCHECK(mode == disabledKeyword() || mode == hiddenKeyword() || mode == showingKeyword());
ASSERT(mode == disabledKeyword() || mode == hiddenKeyword() || mode == showingKeyword());

// On setting, if the new value isn't equal to what the attribute would currently
// return, the new value must be processed as follows ...
Expand Down Expand Up @@ -230,7 +230,7 @@ TextTrackCueList* TextTrack::activeCues()

void TextTrack::addCue(TextTrackCue* cue)
{
DCHECK(cue);
ASSERT(cue);

// TODO(93143): Add spec-compliant behavior for negative time values.
if (std::isnan(cue->startTime()) || std::isnan(cue->endTime()) || cue->startTime() < 0 || cue->endTime() < 0)
Expand All @@ -257,7 +257,7 @@ void TextTrack::addCue(TextTrackCue* cue)

void TextTrack::removeCue(TextTrackCue* cue, ExceptionState& exceptionState)
{
DCHECK(cue);
ASSERT(cue);

// https://html.spec.whatwg.org/multipage/embedded-content.html#dom-texttrack-removecue

Expand All @@ -273,13 +273,14 @@ void TextTrack::removeCue(TextTrackCue* cue, ExceptionState& exceptionState)
// cue->track() == this implies that cue is in this track's list of cues,
// so this track should have a list of cues and the cue being removed
// should be in it.
DCHECK(m_cues);
ASSERT(m_cues);

// 2. Remove cue from the method's TextTrack object's text track's text track list of cues.
DCHECK(m_cues->remove(cue));
bool wasRemoved = m_cues->remove(cue);
ASSERT_UNUSED(wasRemoved, wasRemoved);

// If the cue is active, a timeline needs to be available.
DCHECK(!cue->isActive() || cueTimeline());
ASSERT(!cue->isActive() || cueTimeline());

cue->setTrack(0);

Expand Down Expand Up @@ -369,7 +370,7 @@ void TextTrack::cueDidChange(TextTrackCue* cue)
{
// This method is called through cue->track(), which should imply that this
// track has a list of cues.
DCHECK(m_cues && cue->track() == this);
ASSERT(m_cues && cue->track() == this);

// Make sure the TextTrackCueList order is up-to-date.
// FIXME: Only need to do this if the change was to any of the timestamps.
Expand All @@ -378,7 +379,7 @@ void TextTrack::cueDidChange(TextTrackCue* cue)
// Since a call to cueDidChange is always preceded by a call to
// cueWillChange, the cue should no longer be active when we reach this
// point (since it was removed from the timeline in cueWillChange).
DCHECK(!cue->isActive());
ASSERT(!cue->isActive());

if (m_mode == disabledKeyword())
return;
Expand All @@ -390,7 +391,7 @@ void TextTrack::cueDidChange(TextTrackCue* cue)

int TextTrack::trackIndex()
{
DCHECK(m_trackList);
ASSERT(m_trackList);

if (m_trackIndex == invalidTrackIndex)
m_trackIndex = m_trackList->getTrackIndex(this);
Expand Down Expand Up @@ -425,7 +426,7 @@ TextTrackCueList* TextTrack::ensureTextTrackCueList()

int TextTrack::trackIndexRelativeToRenderedTracks()
{
DCHECK(m_trackList);
ASSERT(m_trackList);

if (m_renderedTrackIndex == invalidTrackIndex)
m_renderedTrackIndex = m_trackList->getTrackIndexRelativeToRenderedTracks(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void TextTrackContainer::updateDisplay(HTMLMediaElement& mediaElement, ExposingC
for (size_t i = 0; i < activeCues.size(); ++i) {
TextTrackCue* cue = activeCues[i].data();

DCHECK(cue->isActive());
ASSERT(cue->isActive());
if (!cue->track() || !cue->track()->isRendered() || !cue->isActive())
continue;

Expand Down
2 changes: 1 addition & 1 deletion third_party/WebKit/Source/core/html/track/TextTrackCue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ unsigned TextTrackCue::cueIndex()
{
// This method can only be called on cues while they are associated with
// a(n enabled) track (and hence that track's list of cues should exist.)
DCHECK(track() && track()->cues());
ASSERT(track() && track()->cues());
TextTrackCueList* cueList = track()->cues();
if (!cueList->isCueIndexValid(m_cueIndex))
cueList->validateCueIndexes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ void TextTrackCueList::collectActiveCues(TextTrackCueList& activeCues) const

bool TextTrackCueList::add(TextTrackCue* cue)
{
DCHECK_GE(cue->startTime(), 0);
DCHECK_GE(cue->endTime(), 0);
ASSERT(cue->startTime() >= 0);
ASSERT(cue->endTime() >= 0);

// Maintain text track cue order:
// https://html.spec.whatwg.org/#text-track-cue-order
Expand All @@ -95,7 +95,7 @@ size_t TextTrackCueList::findInsertionIndex(const TextTrackCue* cueToInsert) con
{
auto it = std::upper_bound(m_list.begin(), m_list.end(), cueToInsert, cueIsBefore);
size_t index = safeCast<size_t>(it - m_list.begin());
SECURITY_DCHECK(index <= m_list.size());
ASSERT_WITH_SECURITY_IMPLICATION(index <= m_list.size());
return index;
}

Expand Down
16 changes: 8 additions & 8 deletions third_party/WebKit/Source/core/html/track/TextTrackList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int TextTrackList::getTrackIndex(TextTrack *textTrack)
if (textTrack->trackType() == TextTrack::InBand)
return m_elementTracks.size() + m_addTrackTracks.size() + m_inbandTracks.find(textTrack);

NOTREACHED();
ASSERT_NOT_REACHED();

return -1;
}
Expand Down Expand Up @@ -98,7 +98,7 @@ int TextTrackList::getTrackIndexRelativeToRenderedTracks(TextTrack *textTrack)
++trackIndex;
}

NOTREACHED();
ASSERT_NOT_REACHED();

return -1;
}
Expand Down Expand Up @@ -159,7 +159,7 @@ void TextTrackList::invalidateTrackIndexesAfterTrack(TextTrack* track)
} else if (track->trackType() == TextTrack::InBand) {
tracks = &m_inbandTracks;
} else {
NOTREACHED();
ASSERT_NOT_REACHED();
}

size_t index = tracks->find(track);
Expand All @@ -181,12 +181,12 @@ void TextTrackList::append(TextTrack* track)
} else if (track->trackType() == TextTrack::InBand) {
m_inbandTracks.append(track);
} else {
NOTREACHED();
ASSERT_NOT_REACHED();
}

invalidateTrackIndexesAfterTrack(track);

DCHECK(!track->trackList());
ASSERT(!track->trackList());
track->setTrackList(this);

scheduleAddTrackEvent(track);
Expand All @@ -203,7 +203,7 @@ void TextTrackList::remove(TextTrack* track)
} else if (track->trackType() == TextTrack::InBand) {
tracks = &m_inbandTracks;
} else {
NOTREACHED();
ASSERT_NOT_REACHED();
}

size_t index = tracks->find(track);
Expand All @@ -212,7 +212,7 @@ void TextTrackList::remove(TextTrack* track)

invalidateTrackIndexesAfterTrack(track);

DCHECK_EQ(track->trackList(), this);
ASSERT(track->trackList() == this);
track->setTrackList(0);

tracks->remove(index);
Expand All @@ -239,7 +239,7 @@ bool TextTrackList::contains(TextTrack* track) const
else if (track->trackType() == TextTrack::InBand)
tracks = &m_inbandTracks;
else
NOTREACHED();
ASSERT_NOT_REACHED();

return tracks->find(track) != kNotFound;
}
Expand Down
4 changes: 2 additions & 2 deletions third_party/WebKit/Source/core/html/track/TrackEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ TrackEvent::TrackEvent(const AtomicString& type, const TrackEventInit& initializ
else if (track.isTextTrack())
m_track = track.getAsTextTrack();
else
NOTREACHED();
ASSERT_NOT_REACHED();
}

TrackEvent::~TrackEvent()
Expand Down Expand Up @@ -79,7 +79,7 @@ void TrackEvent::track(VideoTrackOrAudioTrackOrTextTrack& returnValue)
returnValue.setVideoTrack(toVideoTrack(m_track.get()));
break;
default:
NOTREACHED();
ASSERT_NOT_REACHED();
}
}

Expand Down
2 changes: 1 addition & 1 deletion third_party/WebKit/Source/core/html/track/TrackListBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class TrackListBase : public EventTargetWithInlineData {
m_tracks.remove(i);
return;
}
NOTREACHED();
ASSERT_NOT_REACHED();
}

void removeAll()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void VideoTrackList::trackSelected(WebMediaPlayer::TrackId selectedTrackId)
if (track->trackId() != selectedTrackId)
track->clearSelected();
else
DCHECK(track->selected());
ASSERT(track->selected());
}

scheduleChangeEvent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ bool BufferedLineReader::getLine(String& line)
return true;
}

DCHECK(m_buffer.isEmpty());
ASSERT(m_buffer.isEmpty());
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class CORE_EXPORT BufferedLineReader {
// Append data to the internal buffer.
void append(const String& data)
{
DCHECK(!m_endOfStream);
ASSERT(!m_endOfStream);
m_buffer.append(SegmentedString(data));
}

Expand All @@ -75,7 +75,7 @@ class CORE_EXPORT BufferedLineReader {
// Consume the next character the buffer if it is the character |c|.
void scanCharacter(UChar c)
{
DCHECK(!m_buffer.isEmpty());
ASSERT(!m_buffer.isEmpty());
if (m_buffer.currentChar() == c)
m_buffer.advance();
}
Expand Down
Loading

0 comments on commit 45983aa

Please sign in to comment.