| 125 | } |
| 126 | |
| 127 | int _read(void *data_out, int bytes_to_read, int *bytes_read, cef_resource_read_callback_t *callback) |
| 128 | { |
| 129 | if ((client_->response_length_ > 0 && bytes_read_ >= client_->response_length_) || (bytes_read_ >= (int64)data_.length() && client_->done_)) |
| 130 | { |
| 131 | *bytes_read = 0; |
| 132 | return false; |
| 133 | } |
| 134 | |
| 135 | int read = min_(bytes_to_read, static_cast<int>(data_.length() - bytes_read_)); |
| 136 | memcpy(data_out, data_.c_str() + bytes_read_, read); |
| 137 | |
| 138 | bytes_read_ += read; |
| 139 | *bytes_read = read; |
| 140 | return true; |
| 141 | } |
| 142 | |
| 143 | static inline int min_(int a, int b) |
| 144 | { |