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 "content/browser/streams/stream.h" | 5 #include "content/browser/streams/stream.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
9 #include "content/browser/streams/stream_read_observer.h" | 9 #include "content/browser/streams/stream_read_observer.h" |
10 #include "content/browser/streams/stream_registry.h" | 10 #include "content/browser/streams/stream_registry.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 bytes_read_ += to_read; | 98 bytes_read_ += to_read; |
99 if (bytes_read_ >= data_length_) | 99 if (bytes_read_ >= data_length_) |
100 data_ = NULL; | 100 data_ = NULL; |
101 | 101 |
102 *bytes_read = to_read; | 102 *bytes_read = to_read; |
103 return STREAM_HAS_DATA; | 103 return STREAM_HAS_DATA; |
104 } | 104 } |
105 | 105 |
106 void Stream::OnSpaceAvailable() { | 106 void Stream::OnSpaceAvailable() { |
107 can_add_data_ = true; | 107 can_add_data_ = true; |
108 write_observer_->OnSpaceAvailable(this); | 108 if (write_observer_) |
| 109 write_observer_->OnSpaceAvailable(this); |
109 } | 110 } |
110 | 111 |
111 void Stream::OnDataAvailable() { | 112 void Stream::OnDataAvailable() { |
112 if (read_observer_) | 113 if (read_observer_) |
113 read_observer_->OnDataAvailable(this); | 114 read_observer_->OnDataAvailable(this); |
114 } | 115 } |
115 | 116 |
116 } // namespace content | 117 } // namespace content |
117 | 118 |
OLD | NEW |