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 "ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h" | 5 #include "ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "native_client/src/include/checked_cast.h" | 10 #include "native_client/src/include/checked_cast.h" |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 pexe_bytes_compiled_, pexe_size_); | 437 pexe_bytes_compiled_, pexe_size_); |
438 } | 438 } |
439 } | 439 } |
440 | 440 |
441 void PnaclCoordinator::BitcodeStreamGotData(int32_t pp_error, | 441 void PnaclCoordinator::BitcodeStreamGotData(int32_t pp_error, |
442 FileStreamData data) { | 442 FileStreamData data) { |
443 PLUGIN_PRINTF(("PnaclCoordinator::BitcodeStreamGotData (pp_error=%" | 443 PLUGIN_PRINTF(("PnaclCoordinator::BitcodeStreamGotData (pp_error=%" |
444 NACL_PRId32 ", data=%p)\n", pp_error, data ? &(*data)[0] : 0)); | 444 NACL_PRId32 ", data=%p)\n", pp_error, data ? &(*data)[0] : 0)); |
445 DCHECK(translate_thread_.get()); | 445 DCHECK(translate_thread_.get()); |
446 | 446 |
447 translate_thread_->PutBytes(data, pp_error); | 447 // When we have received data, pp_error is set to the number of bytes |
448 // If pp_error > 0, then it represents the number of bytes received. | 448 // received. |
449 if (data && pp_error > 0) | 449 if (pp_error > 0) { |
| 450 CHECK(data); |
| 451 translate_thread_->PutBytes(data, pp_error); |
450 pexe_size_ += pp_error; | 452 pexe_size_ += pp_error; |
| 453 } else { |
| 454 translate_thread_->EndStream(); |
| 455 } |
451 } | 456 } |
452 | 457 |
453 StreamCallback PnaclCoordinator::GetCallback() { | 458 StreamCallback PnaclCoordinator::GetCallback() { |
454 return callback_factory_.NewCallbackWithOutput( | 459 return callback_factory_.NewCallbackWithOutput( |
455 &PnaclCoordinator::BitcodeStreamGotData); | 460 &PnaclCoordinator::BitcodeStreamGotData); |
456 } | 461 } |
457 | 462 |
458 void PnaclCoordinator::BitcodeGotCompiled(int32_t pp_error, | 463 void PnaclCoordinator::BitcodeGotCompiled(int32_t pp_error, |
459 int64_t bytes_compiled) { | 464 int64_t bytes_compiled) { |
460 DCHECK(pp_error == PP_OK); | 465 DCHECK(pp_error == PP_OK); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 invalid_desc_wrapper_.get(), | 519 invalid_desc_wrapper_.get(), |
515 &error_info_, | 520 &error_info_, |
516 resources_.get(), | 521 resources_.get(), |
517 &pnacl_options_, | 522 &pnacl_options_, |
518 architecture_attributes_, | 523 architecture_attributes_, |
519 this, | 524 this, |
520 plugin_); | 525 plugin_); |
521 } | 526 } |
522 | 527 |
523 } // namespace plugin | 528 } // namespace plugin |
OLD | NEW |