OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 void Close() override; | 532 void Close() override; |
533 const void* GetReadData(size_t* data_len) override; | 533 const void* GetReadData(size_t* data_len) override; |
534 void ConsumeReadData(size_t used) override; | 534 void ConsumeReadData(size_t used) override; |
535 void* GetWriteBuffer(size_t* buf_len) override; | 535 void* GetWriteBuffer(size_t* buf_len) override; |
536 void ConsumeWriteBuffer(size_t used) override; | 536 void ConsumeWriteBuffer(size_t used) override; |
537 bool GetWriteRemaining(size_t* size) const override; | 537 bool GetWriteRemaining(size_t* size) const override; |
538 | 538 |
539 private: | 539 private: |
540 // Helper method that implements ReadOffset. Caller must acquire a lock | 540 // Helper method that implements ReadOffset. Caller must acquire a lock |
541 // when calling this method. | 541 // when calling this method. |
542 StreamResult ReadOffsetLocked(void* buffer, size_t bytes, size_t offset, | 542 StreamResult ReadOffsetLocked(void* buffer, |
| 543 size_t bytes, |
| 544 size_t offset, |
543 size_t* bytes_read) | 545 size_t* bytes_read) |
544 EXCLUSIVE_LOCKS_REQUIRED(crit_); | 546 RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); |
545 | 547 |
546 // Helper method that implements WriteOffset. Caller must acquire a lock | 548 // Helper method that implements WriteOffset. Caller must acquire a lock |
547 // when calling this method. | 549 // when calling this method. |
548 StreamResult WriteOffsetLocked(const void* buffer, size_t bytes, | 550 StreamResult WriteOffsetLocked(const void* buffer, |
549 size_t offset, size_t* bytes_written) | 551 size_t bytes, |
550 EXCLUSIVE_LOCKS_REQUIRED(crit_); | 552 size_t offset, |
| 553 size_t* bytes_written) |
| 554 RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); |
551 | 555 |
552 // keeps the opened/closed state of the stream | 556 // keeps the opened/closed state of the stream |
553 StreamState state_ GUARDED_BY(crit_); | 557 StreamState state_ RTC_GUARDED_BY(crit_); |
554 // the allocated buffer | 558 // the allocated buffer |
555 std::unique_ptr<char[]> buffer_ GUARDED_BY(crit_); | 559 std::unique_ptr<char[]> buffer_ RTC_GUARDED_BY(crit_); |
556 // size of the allocated buffer | 560 // size of the allocated buffer |
557 size_t buffer_length_ GUARDED_BY(crit_); | 561 size_t buffer_length_ RTC_GUARDED_BY(crit_); |
558 // amount of readable data in the buffer | 562 // amount of readable data in the buffer |
559 size_t data_length_ GUARDED_BY(crit_); | 563 size_t data_length_ RTC_GUARDED_BY(crit_); |
560 // offset to the readable data | 564 // offset to the readable data |
561 size_t read_position_ GUARDED_BY(crit_); | 565 size_t read_position_ RTC_GUARDED_BY(crit_); |
562 // stream callbacks are dispatched on this thread | 566 // stream callbacks are dispatched on this thread |
563 Thread* owner_; | 567 Thread* owner_; |
564 // object lock | 568 // object lock |
565 CriticalSection crit_; | 569 CriticalSection crit_; |
566 RTC_DISALLOW_COPY_AND_ASSIGN(FifoBuffer); | 570 RTC_DISALLOW_COPY_AND_ASSIGN(FifoBuffer); |
567 }; | 571 }; |
568 | 572 |
569 /////////////////////////////////////////////////////////////////////////////// | 573 /////////////////////////////////////////////////////////////////////////////// |
570 | 574 |
571 class LoggingAdapter : public StreamAdapterInterface { | 575 class LoggingAdapter : public StreamAdapterInterface { |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 char* buffer, | 707 char* buffer, |
704 size_t buffer_len, | 708 size_t buffer_len, |
705 StreamInterface* sink, | 709 StreamInterface* sink, |
706 size_t* data_len = nullptr); | 710 size_t* data_len = nullptr); |
707 | 711 |
708 /////////////////////////////////////////////////////////////////////////////// | 712 /////////////////////////////////////////////////////////////////////////////// |
709 | 713 |
710 } // namespace rtc | 714 } // namespace rtc |
711 | 715 |
712 #endif // WEBRTC_RTC_BASE_STREAM_H_ | 716 #endif // WEBRTC_RTC_BASE_STREAM_H_ |
OLD | NEW |