| Index: content/browser/byte_stream.cc
|
| diff --git a/content/browser/byte_stream.cc b/content/browser/byte_stream.cc
|
| index a8b8f29e9e63b326229b8c09aa3818eefd98adbd..dc13f3f2395f08bf26aa76f79dd7a2e0933dcaf6 100644
|
| --- a/content/browser/byte_stream.cc
|
| +++ b/content/browser/byte_stream.cc
|
| @@ -61,6 +61,7 @@ class ByteStreamWriterImpl : public ByteStreamWriter {
|
| virtual void Flush() OVERRIDE;
|
| virtual void Close(int status) OVERRIDE;
|
| virtual void RegisterCallback(const base::Closure& source_callback) OVERRIDE;
|
| + virtual size_t TotalBufferedBytes() const OVERRIDE;
|
|
|
| // PostTask target from |ByteStreamReaderImpl::MaybeUpdateInput|.
|
| static void UpdateWindow(scoped_refptr<LifetimeFlag> lifetime_flag,
|
| @@ -193,6 +194,7 @@ ByteStreamWriterImpl::ByteStreamWriterImpl(
|
| }
|
|
|
| ByteStreamWriterImpl::~ByteStreamWriterImpl() {
|
| + DCHECK(my_task_runner_->RunsTasksOnCurrentThread());
|
| my_lifetime_flag_->is_alive = false;
|
| }
|
|
|
| @@ -216,7 +218,7 @@ bool ByteStreamWriterImpl::Write(
|
| if (input_contents_size_ > total_buffer_size_ / kFractionBufferBeforeSending)
|
| PostToPeer(false, 0);
|
|
|
| - return (input_contents_size_ + output_size_used_ <= total_buffer_size_);
|
| + return (TotalBufferedBytes() <= total_buffer_size_);
|
| }
|
|
|
| void ByteStreamWriterImpl::Flush() {
|
| @@ -236,6 +238,11 @@ void ByteStreamWriterImpl::RegisterCallback(
|
| space_available_callback_ = source_callback;
|
| }
|
|
|
| +size_t ByteStreamWriterImpl::TotalBufferedBytes() const {
|
| + DCHECK(my_task_runner_->RunsTasksOnCurrentThread());
|
| + return input_contents_size_ + output_size_used_;
|
| +}
|
| +
|
| // static
|
| void ByteStreamWriterImpl::UpdateWindow(
|
| scoped_refptr<LifetimeFlag> lifetime_flag, ByteStreamWriterImpl* target,
|
| @@ -302,6 +309,7 @@ ByteStreamReaderImpl::ByteStreamReaderImpl(
|
| }
|
|
|
| ByteStreamReaderImpl::~ByteStreamReaderImpl() {
|
| + DCHECK(my_task_runner_->RunsTasksOnCurrentThread());
|
| my_lifetime_flag_->is_alive = false;
|
| }
|
|
|
|
|