| Index: chrome/browser/printing/print_preview_message_handler.cc
|
| diff --git a/chrome/browser/printing/print_preview_message_handler.cc b/chrome/browser/printing/print_preview_message_handler.cc
|
| index 99be3f5e6257255683cb89165809b25d0a072aa6..75aa54c11e7975cf9c52d8d1aa87360201e0774b 100644
|
| --- a/chrome/browser/printing/print_preview_message_handler.cc
|
| +++ b/chrome/browser/printing/print_preview_message_handler.cc
|
| @@ -141,14 +141,15 @@ void PrintPreviewMessageHandler::OnPagesReadyForPreview(
|
|
|
| wrapper->print_view_manager()->OverrideTitle(tab_contents());
|
|
|
| - char* preview_data = static_cast<char*>(shared_buf->memory());
|
| + const unsigned char* preview_data =
|
| + static_cast<unsigned char*>(shared_buf->memory());
|
| uint32 preview_data_size = params.data_size;
|
|
|
| + // TODO(joth): This seems like a good match for using RefCountedStaticMemory
|
| + // to avoid the memory copy, but the SetPrintPreviewData call chain below
|
| + // needs updating to accept the RefCountedMemory* base class.
|
| scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes);
|
| - html_bytes->data.resize(preview_data_size);
|
| - std::vector<unsigned char>::iterator it = html_bytes->data.begin();
|
| - for (uint32 i = 0; i < preview_data_size; ++i, ++it)
|
| - *it = *(preview_data + i);
|
| + html_bytes->data().assign(preview_data, preview_data + preview_data_size);
|
|
|
| print_preview_ui->SetPrintPreviewData(html_bytes.get());
|
| print_preview_ui->OnPreviewDataIsAvailable(
|
|
|