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

Side by Side Diff: webrtc/base/stream.h

Issue 1677333002: Added thread annotations to FifoBuffer. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | webrtc/base/stream.cc » ('j') | 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 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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 const void* GetReadData(size_t* data_len) override; 535 const void* GetReadData(size_t* data_len) override;
536 void ConsumeReadData(size_t used) override; 536 void ConsumeReadData(size_t used) override;
537 void* GetWriteBuffer(size_t* buf_len) override; 537 void* GetWriteBuffer(size_t* buf_len) override;
538 void ConsumeWriteBuffer(size_t used) override; 538 void ConsumeWriteBuffer(size_t used) override;
539 bool GetWriteRemaining(size_t* size) const override; 539 bool GetWriteRemaining(size_t* size) const override;
540 540
541 private: 541 private:
542 // Helper method that implements ReadOffset. Caller must acquire a lock 542 // Helper method that implements ReadOffset. Caller must acquire a lock
543 // when calling this method. 543 // when calling this method.
544 StreamResult ReadOffsetLocked(void* buffer, size_t bytes, size_t offset, 544 StreamResult ReadOffsetLocked(void* buffer, size_t bytes, size_t offset,
545 size_t* bytes_read); 545 size_t* bytes_read)
546 EXCLUSIVE_LOCKS_REQUIRED(crit_);
546 547
547 // Helper method that implements WriteOffset. Caller must acquire a lock 548 // Helper method that implements WriteOffset. Caller must acquire a lock
548 // when calling this method. 549 // when calling this method.
549 StreamResult WriteOffsetLocked(const void* buffer, size_t bytes, 550 StreamResult WriteOffsetLocked(const void* buffer, size_t bytes,
550 size_t offset, size_t* bytes_written); 551 size_t offset, size_t* bytes_written)
552 EXCLUSIVE_LOCKS_REQUIRED(crit_);
551 553
552 StreamState state_; // keeps the opened/closed state of the stream 554 // keeps the opened/closed state of the stream
553 scoped_ptr<char[]> buffer_; // the allocated buffer 555 StreamState state_ GUARDED_BY(crit_);
554 size_t buffer_length_; // size of the allocated buffer 556 // the allocated buffer
555 size_t data_length_; // amount of readable data in the buffer 557 scoped_ptr<char[]> buffer_ GUARDED_BY(crit_);
556 size_t read_position_; // offset to the readable data 558 // size of the allocated buffer
557 Thread* owner_; // stream callbacks are dispatched on this thread 559 size_t buffer_length_ GUARDED_BY(crit_);
558 CriticalSection crit_; // object lock 560 // amount of readable data in the buffer
561 size_t data_length_ GUARDED_BY(crit_);
562 // offset to the readable data
563 size_t read_position_ GUARDED_BY(crit_);
564 // stream callbacks are dispatched on this thread
565 Thread* owner_;
566 // object lock
567 CriticalSection crit_;
559 RTC_DISALLOW_COPY_AND_ASSIGN(FifoBuffer); 568 RTC_DISALLOW_COPY_AND_ASSIGN(FifoBuffer);
560 }; 569 };
561 570
562 /////////////////////////////////////////////////////////////////////////////// 571 ///////////////////////////////////////////////////////////////////////////////
563 572
564 class LoggingAdapter : public StreamAdapterInterface { 573 class LoggingAdapter : public StreamAdapterInterface {
565 public: 574 public:
566 LoggingAdapter(StreamInterface* stream, LoggingSeverity level, 575 LoggingAdapter(StreamInterface* stream, LoggingSeverity level,
567 const std::string& label, bool hex_mode = false); 576 const std::string& label, bool hex_mode = false);
568 577
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 // as a pass in parameter, it indicates data in buffer that should move to sink 703 // as a pass in parameter, it indicates data in buffer that should move to sink
695 StreamResult Flow(StreamInterface* source, 704 StreamResult Flow(StreamInterface* source,
696 char* buffer, size_t buffer_len, 705 char* buffer, size_t buffer_len,
697 StreamInterface* sink, size_t* data_len = NULL); 706 StreamInterface* sink, size_t* data_len = NULL);
698 707
699 /////////////////////////////////////////////////////////////////////////////// 708 ///////////////////////////////////////////////////////////////////////////////
700 709
701 } // namespace rtc 710 } // namespace rtc
702 711
703 #endif // WEBRTC_BASE_STREAM_H_ 712 #endif // WEBRTC_BASE_STREAM_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/base/stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698