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

Side by Side Diff: third_party/WebKit/Source/modules/mediasource/MediaSource.cpp

Issue 2572603002: ABANDONED CL: Rename readyState() to getReadyState(). (Closed)
Patch Set: Created 4 years 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 // Return an empty range if all ranges are empty. 385 // Return an empty range if all ranges are empty.
386 if (highestEndTime < 0) 386 if (highestEndTime < 0)
387 return TimeRanges::create(); 387 return TimeRanges::create();
388 388
389 // 4. Let intersection ranges equal a TimeRange object containing a single 389 // 4. Let intersection ranges equal a TimeRange object containing a single
390 // range from 0 to highest end time. 390 // range from 0 to highest end time.
391 TimeRanges* intersectionRanges = TimeRanges::create(0, highestEndTime); 391 TimeRanges* intersectionRanges = TimeRanges::create(0, highestEndTime);
392 392
393 // 5. For each SourceBuffer object in activeSourceBuffers run the following 393 // 5. For each SourceBuffer object in activeSourceBuffers run the following
394 // steps: 394 // steps:
395 bool ended = readyState() == endedKeyword(); 395 bool ended = getReadyState() == endedKeyword();
396 for (size_t i = 0; i < ranges.size(); ++i) { 396 for (size_t i = 0; i < ranges.size(); ++i) {
397 // 5.1 Let source ranges equal the ranges returned by the buffered attribute 397 // 5.1 Let source ranges equal the ranges returned by the buffered attribute
398 // on the current SourceBuffer. 398 // on the current SourceBuffer.
399 TimeRanges* sourceRanges = ranges[i].get(); 399 TimeRanges* sourceRanges = ranges[i].get();
400 400
401 // 5.2 If readyState is "ended", then set the end time on the last range in 401 // 5.2 If readyState is "ended", then set the end time on the last range in
402 // source ranges to highest end time. 402 // source ranges to highest end time.
403 if (ended && sourceRanges->length()) 403 if (ended && sourceRanges->length())
404 sourceRanges->add( 404 sourceRanges->add(
405 sourceRanges->start(sourceRanges->length() - 1, ASSERT_NO_EXCEPTION), 405 sourceRanges->start(sourceRanges->length() - 1, ASSERT_NO_EXCEPTION),
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 579
580 // 6. Update the media controller duration to new duration and run the 580 // 6. Update the media controller duration to new duration and run the
581 // HTMLMediaElement duration change algorithm. 581 // HTMLMediaElement duration change algorithm.
582 m_attachedElement->durationChanged(newDuration, requestSeek); 582 m_attachedElement->durationChanged(newDuration, requestSeek);
583 } 583 }
584 584
585 void MediaSource::setReadyState(const AtomicString& state) { 585 void MediaSource::setReadyState(const AtomicString& state) {
586 DCHECK(state == openKeyword() || state == closedKeyword() || 586 DCHECK(state == openKeyword() || state == closedKeyword() ||
587 state == endedKeyword()); 587 state == endedKeyword());
588 588
589 AtomicString oldState = readyState(); 589 AtomicString oldState = getReadyState();
590 BLINK_MSLOG << __func__ << " this=" << this << " : " << oldState << " -> " 590 BLINK_MSLOG << __func__ << " this=" << this << " : " << oldState << " -> "
591 << state; 591 << state;
592 592
593 if (state == closedKeyword()) { 593 if (state == closedKeyword()) {
594 m_webMediaSource.reset(); 594 m_webMediaSource.reset();
595 } 595 }
596 596
597 if (oldState == state) 597 if (oldState == state)
598 return; 598 return;
599 599
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 // 1. Change the readyState attribute value to "ended". 688 // 1. Change the readyState attribute value to "ended".
689 // 2. Queue a task to fire a simple event named sourceended at the 689 // 2. Queue a task to fire a simple event named sourceended at the
690 // MediaSource. 690 // MediaSource.
691 setReadyState(endedKeyword()); 691 setReadyState(endedKeyword());
692 692
693 // 3. Do various steps based on |eosStatus|. 693 // 3. Do various steps based on |eosStatus|.
694 m_webMediaSource->markEndOfStream(eosStatus); 694 m_webMediaSource->markEndOfStream(eosStatus);
695 } 695 }
696 696
697 bool MediaSource::isOpen() const { 697 bool MediaSource::isOpen() const {
698 return readyState() == openKeyword(); 698 return getReadyState() == openKeyword();
699 } 699 }
700 700
701 void MediaSource::setSourceBufferActive(SourceBuffer* sourceBuffer, 701 void MediaSource::setSourceBufferActive(SourceBuffer* sourceBuffer,
702 bool isActive) { 702 bool isActive) {
703 if (!isActive) { 703 if (!isActive) {
704 DCHECK(m_activeSourceBuffers->contains(sourceBuffer)); 704 DCHECK(m_activeSourceBuffers->contains(sourceBuffer));
705 m_activeSourceBuffers->remove(sourceBuffer); 705 m_activeSourceBuffers->remove(sourceBuffer);
706 return; 706 return;
707 } 707 }
708 708
(...skipping 17 matching lines...) Expand all
726 } 726 }
727 727
728 m_activeSourceBuffers->insert(insertPosition, sourceBuffer); 728 m_activeSourceBuffers->insert(insertPosition, sourceBuffer);
729 } 729 }
730 730
731 HTMLMediaElement* MediaSource::mediaElement() const { 731 HTMLMediaElement* MediaSource::mediaElement() const {
732 return m_attachedElement.get(); 732 return m_attachedElement.get();
733 } 733 }
734 734
735 bool MediaSource::isClosed() const { 735 bool MediaSource::isClosed() const {
736 return readyState() == closedKeyword(); 736 return getReadyState() == closedKeyword();
737 } 737 }
738 738
739 void MediaSource::close() { 739 void MediaSource::close() {
740 setReadyState(closedKeyword()); 740 setReadyState(closedKeyword());
741 } 741 }
742 742
743 bool MediaSource::attachToElement(HTMLMediaElement* element) { 743 bool MediaSource::attachToElement(HTMLMediaElement* element) {
744 if (m_attachedElement) 744 if (m_attachedElement)
745 return false; 745 return false;
746 746
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 event->setTarget(this); 815 event->setTarget(this);
816 816
817 m_asyncEventQueue->enqueueEvent(event); 817 m_asyncEventQueue->enqueueEvent(event);
818 } 818 }
819 819
820 URLRegistry& MediaSource::registry() const { 820 URLRegistry& MediaSource::registry() const {
821 return MediaSourceRegistry::registry(); 821 return MediaSourceRegistry::registry();
822 } 822 }
823 823
824 } // namespace blink 824 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698