OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/glue/media/buffered_resource_loader.h" | 5 #include "webkit/glue/media/buffered_resource_loader.h" |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 instance_size_ = content_length_; | 315 instance_size_ = content_length_; |
316 | 316 |
317 // Calls with a successful response. | 317 // Calls with a successful response. |
318 DoneStart(net::OK); | 318 DoneStart(net::OK); |
319 } | 319 } |
320 | 320 |
321 void BufferedResourceLoader::didReceiveData( | 321 void BufferedResourceLoader::didReceiveData( |
322 WebURLLoader* loader, | 322 WebURLLoader* loader, |
323 const char* data, | 323 const char* data, |
324 int data_length, | 324 int data_length, |
325 int length_received) { | 325 int raw_data_length) { |
326 DCHECK(!completed_); | 326 DCHECK(!completed_); |
327 DCHECK_GT(data_length, 0); | 327 DCHECK_GT(data_length, 0); |
328 | 328 |
329 // If this loader has been stopped, |buffer_| would be destroyed. | 329 // If this loader has been stopped, |buffer_| would be destroyed. |
330 // In this case we shouldn't do anything. | 330 // In this case we shouldn't do anything. |
331 if (!buffer_.get()) | 331 if (!buffer_.get()) |
332 return; | 332 return; |
333 | 333 |
334 // Writes more data to |buffer_|. | 334 // Writes more data to |buffer_|. |
335 buffer_->Append(reinterpret_cast<const uint8*>(data), data_length); | 335 buffer_->Append(reinterpret_cast<const uint8*>(data), data_length); |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 start_callback_->RunWithParams(Tuple1<int>(error)); | 623 start_callback_->RunWithParams(Tuple1<int>(error)); |
624 start_callback_.reset(); | 624 start_callback_.reset(); |
625 } | 625 } |
626 | 626 |
627 void BufferedResourceLoader::NotifyNetworkEvent() { | 627 void BufferedResourceLoader::NotifyNetworkEvent() { |
628 if (event_callback_.get()) | 628 if (event_callback_.get()) |
629 event_callback_->Run(); | 629 event_callback_->Run(); |
630 } | 630 } |
631 | 631 |
632 } // namespace webkit_glue | 632 } // namespace webkit_glue |
OLD | NEW |