Chromium Code Reviews| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 392 ++it) { | 392 ++it) { |
| 393 document_loader->didReceiveData( | 393 document_loader->didReceiveData( |
| 394 NULL, it->c_str(), it->length(), 0 /* encoded_data_length */); | 394 NULL, it->c_str(), it->length(), 0 /* encoded_data_length */); |
| 395 } | 395 } |
| 396 if (finished_loading_) { | 396 if (finished_loading_) { |
| 397 document_loader->didFinishLoading( | 397 document_loader->didFinishLoading( |
| 398 NULL, | 398 NULL, |
| 399 0 /* finish_time */, | 399 0 /* finish_time */, |
| 400 blink::WebURLLoaderClient::kUnknownEncodedDataLength); | 400 blink::WebURLLoaderClient::kUnknownEncodedDataLength); |
| 401 } | 401 } |
| 402 if (error_.get()) { | 402 if (error_.get()) { |
|
hiroshige
2015/08/03 07:25:17
Changing this |if| into |else if| might be better
tyoshino (SeeGerritForStatus)
2015/08/03 07:59:05
Done.
| |
| 403 document_loader->didFail(NULL, *error_); | 403 document_loader->didFail(NULL, *error_); |
| 404 } | 404 } |
| 405 } | 405 } |
| 406 | 406 |
| 407 void PepperPluginInstanceImpl::ExternalDocumentLoader::didReceiveData( | 407 void PepperPluginInstanceImpl::ExternalDocumentLoader::didReceiveData( |
| 408 WebURLLoader* loader, | 408 WebURLLoader* loader, |
| 409 const char* data, | 409 const char* data, |
| 410 int data_length, | 410 int data_length, |
| 411 int encoded_data_length) { | 411 int encoded_data_length) { |
| 412 data_.push_back(std::string(data, data_length)); | 412 data_.push_back(std::string(data, data_length)); |
| 413 } | 413 } |
| 414 | 414 |
| 415 void PepperPluginInstanceImpl::ExternalDocumentLoader::didFinishLoading( | 415 void PepperPluginInstanceImpl::ExternalDocumentLoader::didFinishLoading( |
| 416 WebURLLoader* loader, | 416 WebURLLoader* loader, |
| 417 double finish_time, | 417 double finish_time, |
| 418 int64_t total_encoded_data_length) { | 418 int64_t total_encoded_data_length) { |
| 419 DCHECK(!finished_loading_); | 419 DCHECK(!finished_loading_); |
| 420 | |
| 421 if (error_.get()) | |
| 422 return; | |
| 423 | |
| 420 finished_loading_ = true; | 424 finished_loading_ = true; |
| 421 } | 425 } |
| 422 | 426 |
| 423 void PepperPluginInstanceImpl::ExternalDocumentLoader::didFail( | 427 void PepperPluginInstanceImpl::ExternalDocumentLoader::didFail( |
| 424 WebURLLoader* loader, | 428 WebURLLoader* loader, |
| 425 const WebURLError& error) { | 429 const WebURLError& error) { |
| 426 DCHECK(!error_.get()); | 430 DCHECK(!error_.get()); |
|
hiroshige
2015/08/03 07:25:17
Should we also add if(finished_loading_) return; h
tyoshino (SeeGerritForStatus)
2015/08/03 07:59:05
Done.
| |
| 427 error_.reset(new WebURLError(error)); | 431 error_.reset(new WebURLError(error)); |
| 428 } | 432 } |
| 429 | 433 |
| 430 PepperPluginInstanceImpl::GamepadImpl::GamepadImpl() | 434 PepperPluginInstanceImpl::GamepadImpl::GamepadImpl() |
| 431 : Resource(ppapi::Resource::Untracked()) {} | 435 : Resource(ppapi::Resource::Untracked()) {} |
| 432 | 436 |
| 433 PepperPluginInstanceImpl::GamepadImpl::~GamepadImpl() {} | 437 PepperPluginInstanceImpl::GamepadImpl::~GamepadImpl() {} |
| 434 | 438 |
| 435 PPB_Gamepad_API* PepperPluginInstanceImpl::GamepadImpl::AsPPB_Gamepad_API() { | 439 PPB_Gamepad_API* PepperPluginInstanceImpl::GamepadImpl::AsPPB_Gamepad_API() { |
| 436 return this; | 440 return this; |
| (...skipping 2825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3262 | 3266 |
| 3263 void PepperPluginInstanceImpl::RecordFlashJavaScriptUse() { | 3267 void PepperPluginInstanceImpl::RecordFlashJavaScriptUse() { |
| 3264 if (initialized_ && !javascript_used_ && is_flash_plugin_) { | 3268 if (initialized_ && !javascript_used_ && is_flash_plugin_) { |
| 3265 javascript_used_ = true; | 3269 javascript_used_ = true; |
| 3266 RenderThread::Get()->RecordAction( | 3270 RenderThread::Get()->RecordAction( |
| 3267 base::UserMetricsAction("Flash.JavaScriptUsed")); | 3271 base::UserMetricsAction("Flash.JavaScriptUsed")); |
| 3268 } | 3272 } |
| 3269 } | 3273 } |
| 3270 | 3274 |
| 3271 } // namespace content | 3275 } // namespace content |
| OLD | NEW |