| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/spdy/spdy_write_queue.h" | 5 #include "net/spdy/spdy_write_queue.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 if (!queue_[i].empty()) | 39 if (!queue_[i].empty()) |
| 40 return false; | 40 return false; |
| 41 } | 41 } |
| 42 return true; | 42 return true; |
| 43 } | 43 } |
| 44 | 44 |
| 45 void SpdyWriteQueue::Enqueue(RequestPriority priority, | 45 void SpdyWriteQueue::Enqueue(RequestPriority priority, |
| 46 SpdyFrameType frame_type, | 46 SpdyFrameType frame_type, |
| 47 scoped_ptr<SpdyBufferProducer> frame_producer, | 47 scoped_ptr<SpdyBufferProducer> frame_producer, |
| 48 const base::WeakPtr<SpdyStream>& stream) { | 48 const base::WeakPtr<SpdyStream>& stream) { |
| 49 CHECK(!removing_writes_); |
| 49 CHECK_GE(priority, MINIMUM_PRIORITY); | 50 CHECK_GE(priority, MINIMUM_PRIORITY); |
| 50 CHECK_LE(priority, MAXIMUM_PRIORITY); | 51 CHECK_LE(priority, MAXIMUM_PRIORITY); |
| 51 if (stream.get()) | 52 if (stream.get()) |
| 52 DCHECK_EQ(stream->priority(), priority); | 53 DCHECK_EQ(stream->priority(), priority); |
| 53 queue_[priority].push_back( | 54 queue_[priority].push_back( |
| 54 PendingWrite(frame_type, frame_producer.release(), stream)); | 55 PendingWrite(frame_type, frame_producer.release(), stream)); |
| 55 } | 56 } |
| 56 | 57 |
| 57 bool SpdyWriteQueue::Dequeue(SpdyFrameType* frame_type, | 58 bool SpdyWriteQueue::Dequeue(SpdyFrameType* frame_type, |
| 58 scoped_ptr<SpdyBufferProducer>* frame_producer, | 59 scoped_ptr<SpdyBufferProducer>* frame_producer, |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 it != queue_[i].end(); ++it) { | 153 it != queue_[i].end(); ++it) { |
| 153 erased_buffer_producers.push_back(it->frame_producer); | 154 erased_buffer_producers.push_back(it->frame_producer); |
| 154 } | 155 } |
| 155 queue_[i].clear(); | 156 queue_[i].clear(); |
| 156 } | 157 } |
| 157 removing_writes_ = false; | 158 removing_writes_ = false; |
| 158 STLDeleteElements(&erased_buffer_producers); // Invokes callbacks. | 159 STLDeleteElements(&erased_buffer_producers); // Invokes callbacks. |
| 159 } | 160 } |
| 160 | 161 |
| 161 } // namespace net | 162 } // namespace net |
| OLD | NEW |