Index: ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc |
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc b/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc |
index fff5382ce2e6a30fb1b0966d84d4604edec24941..f8150fe6026878593adde9660ea99f6d6121711f 100644 |
--- a/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc |
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc |
@@ -111,27 +111,14 @@ void PnaclTranslateThread::RunTranslate( |
} |
// Called from main thread to send bytes to the translator. |
-void PnaclTranslateThread::PutBytes(std::vector<char>* bytes, int count) { |
- PLUGIN_PRINTF(("PutBytes (this=%p, bytes=%p, size=%" NACL_PRIuS |
- ", count=%d)\n", |
- this, bytes, bytes ? bytes->size() : 0, count)); |
- size_t buffer_size = 0; |
+void PnaclTranslateThread::PutBytes(const void* bytes, int32_t count) { |
CHECK(bytes != NULL); |
- // Ensure that the buffer we send to the translation thread is the right size |
- // (count can be < the buffer size). This can be done without the lock. |
- buffer_size = bytes->size(); |
- bytes->resize(count); |
- |
+ std::vector<char> v(static_cast<const char*>(bytes), |
+ static_cast<const char*>(bytes) + count); |
NaClXMutexLock(&cond_mu_); |
- |
- data_buffers_.push_back(std::vector<char>()); |
- bytes->swap(data_buffers_.back()); // Avoid copying the buffer data. |
- |
+ data_buffers_.push_back(v); |
dmichael (off chromium)
2014/07/17 16:13:21
How big is this array? You're copying it twice whe
teravest
2014/07/21 18:33:21
Done.
|
NaClXCondVarSignal(&buffer_cond_); |
NaClXMutexUnlock(&cond_mu_); |
- |
- // Ensure the buffer we send back to the coordinator is the expected size |
- bytes->resize(buffer_size); |
} |
void PnaclTranslateThread::EndStream() { |