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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 399 |
400 PepperPluginInstanceImpl::ExternalDocumentLoader::ExternalDocumentLoader() | 400 PepperPluginInstanceImpl::ExternalDocumentLoader::ExternalDocumentLoader() |
401 : finished_loading_(false) {} | 401 : finished_loading_(false) {} |
402 | 402 |
403 PepperPluginInstanceImpl::ExternalDocumentLoader::~ExternalDocumentLoader() {} | 403 PepperPluginInstanceImpl::ExternalDocumentLoader::~ExternalDocumentLoader() {} |
404 | 404 |
405 void PepperPluginInstanceImpl::ExternalDocumentLoader::ReplayReceivedData( | 405 void PepperPluginInstanceImpl::ExternalDocumentLoader::ReplayReceivedData( |
406 WebURLLoaderClient* document_loader) { | 406 WebURLLoaderClient* document_loader) { |
407 for (std::list<std::string>::iterator it = data_.begin(); it != data_.end(); | 407 for (std::list<std::string>::iterator it = data_.begin(); it != data_.end(); |
408 ++it) { | 408 ++it) { |
409 document_loader->didReceiveData( | 409 document_loader->didReceiveData(NULL, it->c_str(), it->length(), |
410 NULL, it->c_str(), it->length(), 0 /* encoded_data_length */); | 410 0 /* encoded_data_length */, it->length()); |
411 } | 411 } |
412 if (finished_loading_) { | 412 if (finished_loading_) { |
413 document_loader->didFinishLoading( | 413 document_loader->didFinishLoading( |
414 NULL, | 414 NULL, |
415 0 /* finish_time */, | 415 0 /* finish_time */, |
416 blink::WebURLLoaderClient::kUnknownEncodedDataLength); | 416 blink::WebURLLoaderClient::kUnknownEncodedDataLength); |
417 } else if (error_.get()) { | 417 } else if (error_.get()) { |
418 DCHECK(!finished_loading_); | 418 DCHECK(!finished_loading_); |
419 document_loader->didFail(NULL, *error_); | 419 document_loader->didFail(NULL, *error_); |
420 } | 420 } |
421 } | 421 } |
422 | 422 |
423 void PepperPluginInstanceImpl::ExternalDocumentLoader::didReceiveData( | 423 void PepperPluginInstanceImpl::ExternalDocumentLoader::didReceiveData( |
424 WebURLLoader* loader, | 424 WebURLLoader* loader, |
425 const char* data, | 425 const char* data, |
426 int data_length, | 426 int data_length, |
427 int encoded_data_length) { | 427 int encoded_data_length, |
| 428 int encoded_body_length) { |
428 data_.push_back(std::string(data, data_length)); | 429 data_.push_back(std::string(data, data_length)); |
429 } | 430 } |
430 | 431 |
431 void PepperPluginInstanceImpl::ExternalDocumentLoader::didFinishLoading( | 432 void PepperPluginInstanceImpl::ExternalDocumentLoader::didFinishLoading( |
432 WebURLLoader* loader, | 433 WebURLLoader* loader, |
433 double finish_time, | 434 double finish_time, |
434 int64_t total_encoded_data_length) { | 435 int64_t total_encoded_data_length) { |
435 DCHECK(!finished_loading_); | 436 DCHECK(!finished_loading_); |
436 | 437 |
437 if (error_.get()) | 438 if (error_.get()) |
(...skipping 2967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3405 const cc::TextureMailbox& mailbox) const { | 3406 const cc::TextureMailbox& mailbox) const { |
3406 auto it = | 3407 auto it = |
3407 std::find_if(texture_ref_counts_.begin(), texture_ref_counts_.end(), | 3408 std::find_if(texture_ref_counts_.begin(), texture_ref_counts_.end(), |
3408 [&mailbox](const TextureMailboxRefCount& ref_count) { | 3409 [&mailbox](const TextureMailboxRefCount& ref_count) { |
3409 return ref_count.first.mailbox() == mailbox.mailbox(); | 3410 return ref_count.first.mailbox() == mailbox.mailbox(); |
3410 }); | 3411 }); |
3411 return it != texture_ref_counts_.end(); | 3412 return it != texture_ref_counts_.end(); |
3412 } | 3413 } |
3413 | 3414 |
3414 } // namespace content | 3415 } // namespace content |
OLD | NEW |