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

Side by Side Diff: third_party/WebKit/Source/core/html/track/vtt/BufferedLineReader.h

Issue 2003433005: Reland "media/track: Replace wtf/Assertions.h macros in favor of base/logging.h macros" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 7 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) 2013, Opera Software ASA. All rights reserved. 2 * Copyright (C) 2013, Opera Software ASA. 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 DISALLOW_NEW(); 48 DISALLOW_NEW();
49 WTF_MAKE_NONCOPYABLE(BufferedLineReader); 49 WTF_MAKE_NONCOPYABLE(BufferedLineReader);
50 public: 50 public:
51 BufferedLineReader() 51 BufferedLineReader()
52 : m_endOfStream(false) 52 : m_endOfStream(false)
53 , m_maybeSkipLF(false) { } 53 , m_maybeSkipLF(false) { }
54 54
55 // Append data to the internal buffer. 55 // Append data to the internal buffer.
56 void append(const String& data) 56 void append(const String& data)
57 { 57 {
58 ASSERT(!m_endOfStream); 58 DCHECK(!m_endOfStream);
59 m_buffer.append(SegmentedString(data)); 59 m_buffer.append(SegmentedString(data));
60 } 60 }
61 61
62 // Indicate that no more data will be appended. This will cause any 62 // Indicate that no more data will be appended. This will cause any
63 // potentially "unterminated" line to be returned from getLine. 63 // potentially "unterminated" line to be returned from getLine.
64 void setEndOfStream() { m_endOfStream = true; } 64 void setEndOfStream() { m_endOfStream = true; }
65 65
66 // Attempt to read a line from the internal buffer (fed via append). 66 // Attempt to read a line from the internal buffer (fed via append).
67 // If successful, true is returned and |line| is set to the line that was 67 // If successful, true is returned and |line| is set to the line that was
68 // read. If no line could be read false is returned. 68 // read. If no line could be read false is returned.
69 bool getLine(String& line); 69 bool getLine(String& line);
70 70
71 // Returns true if EOS has been reached proper. 71 // Returns true if EOS has been reached proper.
72 bool isAtEndOfStream() const { return m_endOfStream && m_buffer.isEmpty(); } 72 bool isAtEndOfStream() const { return m_endOfStream && m_buffer.isEmpty(); }
73 73
74 private: 74 private:
75 // Consume the next character the buffer if it is the character |c|. 75 // Consume the next character the buffer if it is the character |c|.
76 void scanCharacter(UChar c) 76 void scanCharacter(UChar c)
77 { 77 {
78 ASSERT(!m_buffer.isEmpty()); 78 DCHECK(!m_buffer.isEmpty());
79 if (m_buffer.currentChar() == c) 79 if (m_buffer.currentChar() == c)
80 m_buffer.advance(); 80 m_buffer.advance();
81 } 81 }
82 82
83 SegmentedString m_buffer; 83 SegmentedString m_buffer;
84 StringBuilder m_lineBuffer; 84 StringBuilder m_lineBuffer;
85 bool m_endOfStream; 85 bool m_endOfStream;
86 bool m_maybeSkipLF; 86 bool m_maybeSkipLF;
87 }; 87 };
88 88
89 } // namespace blink 89 } // namespace blink
90 90
91 #endif 91 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698