OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/pepper/pepper_plugin_instance_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bit_cast.h" | 10 #include "base/bit_cast.h" |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 | 401 |
402 PepperPluginInstanceImpl::ExternalDocumentLoader::ExternalDocumentLoader() | 402 PepperPluginInstanceImpl::ExternalDocumentLoader::ExternalDocumentLoader() |
403 : finished_loading_(false) {} | 403 : finished_loading_(false) {} |
404 | 404 |
405 PepperPluginInstanceImpl::ExternalDocumentLoader::~ExternalDocumentLoader() {} | 405 PepperPluginInstanceImpl::ExternalDocumentLoader::~ExternalDocumentLoader() {} |
406 | 406 |
407 void PepperPluginInstanceImpl::ExternalDocumentLoader::ReplayReceivedData( | 407 void PepperPluginInstanceImpl::ExternalDocumentLoader::ReplayReceivedData( |
408 WebURLLoaderClient* document_loader) { | 408 WebURLLoaderClient* document_loader) { |
409 for (std::list<std::string>::iterator it = data_.begin(); it != data_.end(); | 409 for (std::list<std::string>::iterator it = data_.begin(); it != data_.end(); |
410 ++it) { | 410 ++it) { |
411 document_loader->didReceiveData( | 411 document_loader->didReceiveData(NULL, it->c_str(), it->length(), |
412 NULL, it->c_str(), it->length(), 0 /* encoded_data_length */); | 412 0 /* encoded_data_length */, it->length()); |
413 } | 413 } |
414 if (finished_loading_) { | 414 if (finished_loading_) { |
415 document_loader->didFinishLoading( | 415 document_loader->didFinishLoading( |
416 NULL, | 416 NULL, |
417 0 /* finish_time */, | 417 0 /* finish_time */, |
418 blink::WebURLLoaderClient::kUnknownEncodedDataLength); | 418 blink::WebURLLoaderClient::kUnknownEncodedDataLength); |
419 } else if (error_.get()) { | 419 } else if (error_.get()) { |
420 DCHECK(!finished_loading_); | 420 DCHECK(!finished_loading_); |
421 document_loader->didFail(NULL, *error_); | 421 document_loader->didFail(NULL, *error_); |
422 } | 422 } |
423 } | 423 } |
424 | 424 |
425 void PepperPluginInstanceImpl::ExternalDocumentLoader::didReceiveData( | 425 void PepperPluginInstanceImpl::ExternalDocumentLoader::didReceiveData( |
426 WebURLLoader* loader, | 426 WebURLLoader* loader, |
427 const char* data, | 427 const char* data, |
428 int data_length, | 428 int data_length, |
429 int encoded_data_length) { | 429 int encoded_data_length, |
| 430 int encoded_body_length) { |
430 data_.push_back(std::string(data, data_length)); | 431 data_.push_back(std::string(data, data_length)); |
431 } | 432 } |
432 | 433 |
433 void PepperPluginInstanceImpl::ExternalDocumentLoader::didFinishLoading( | 434 void PepperPluginInstanceImpl::ExternalDocumentLoader::didFinishLoading( |
434 WebURLLoader* loader, | 435 WebURLLoader* loader, |
435 double finish_time, | 436 double finish_time, |
436 int64_t total_encoded_data_length) { | 437 int64_t total_encoded_data_length) { |
437 DCHECK(!finished_loading_); | 438 DCHECK(!finished_loading_); |
438 | 439 |
439 if (error_.get()) | 440 if (error_.get()) |
(...skipping 2979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3419 const cc::TextureMailbox& mailbox) const { | 3420 const cc::TextureMailbox& mailbox) const { |
3420 auto it = | 3421 auto it = |
3421 std::find_if(texture_ref_counts_.begin(), texture_ref_counts_.end(), | 3422 std::find_if(texture_ref_counts_.begin(), texture_ref_counts_.end(), |
3422 [&mailbox](const TextureMailboxRefCount& ref_count) { | 3423 [&mailbox](const TextureMailboxRefCount& ref_count) { |
3423 return ref_count.first.mailbox() == mailbox.mailbox(); | 3424 return ref_count.first.mailbox() == mailbox.mailbox(); |
3424 }); | 3425 }); |
3425 return it != texture_ref_counts_.end(); | 3426 return it != texture_ref_counts_.end(); |
3426 } | 3427 } |
3427 | 3428 |
3428 } // namespace content | 3429 } // namespace content |
OLD | NEW |