| 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 "components/printing/renderer/print_web_view_helper.h" | 5 #include "components/printing/renderer/print_web_view_helper.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "components/printing/common/print_messages.h" | 9 #include "components/printing/common/print_messages.h" |
| 10 #include "content/public/renderer/render_thread.h" | 10 #include "content/public/renderer/render_thread.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 Send(new PrintHostMsg_TempFileForPrintingWritten(routing_id(), | 111 Send(new PrintHostMsg_TempFileForPrintingWritten(routing_id(), |
| 112 sequence_number)); | 112 sequence_number)); |
| 113 return true; | 113 return true; |
| 114 #else | 114 #else |
| 115 PrintHostMsg_DidPrintPage_Params printed_page_params; | 115 PrintHostMsg_DidPrintPage_Params printed_page_params; |
| 116 printed_page_params.data_size = 0; | 116 printed_page_params.data_size = 0; |
| 117 printed_page_params.document_cookie = params.params.document_cookie; | 117 printed_page_params.document_cookie = params.params.document_cookie; |
| 118 | 118 |
| 119 { | 119 { |
| 120 scoped_ptr<base::SharedMemory> shared_mem( | 120 scoped_ptr<base::SharedMemory> shared_mem( |
| 121 content::RenderThread::Get()->HostAllocateSharedMemoryBuffer( | 121 content::RenderThread::Get() |
| 122 buf_size).release()); | 122 ->HostAllocateSharedMemoryBuffer(buf_size) |
| 123 .release()); |
| 123 if (!shared_mem.get()) { | 124 if (!shared_mem.get()) { |
| 124 NOTREACHED() << "AllocateSharedMemoryBuffer failed"; | 125 NOTREACHED() << "AllocateSharedMemoryBuffer failed"; |
| 125 return false; | 126 return false; |
| 126 } | 127 } |
| 127 | 128 |
| 128 if (!shared_mem->Map(buf_size)) { | 129 if (!shared_mem->Map(buf_size)) { |
| 129 NOTREACHED() << "Map failed"; | 130 NOTREACHED() << "Map failed"; |
| 130 return false; | 131 return false; |
| 131 } | 132 } |
| 132 metafile.GetData(shared_mem->memory(), buf_size); | 133 metafile.GetData(shared_mem->memory(), buf_size); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 183 |
| 183 RenderPageContent(frame, params.page_number, canvas_area, content_area, | 184 RenderPageContent(frame, params.page_number, canvas_area, content_area, |
| 184 scale_factor, canvas); | 185 scale_factor, canvas); |
| 185 | 186 |
| 186 // Done printing. Close the canvas to retrieve the compiled metafile. | 187 // Done printing. Close the canvas to retrieve the compiled metafile. |
| 187 if (!metafile->FinishPage()) | 188 if (!metafile->FinishPage()) |
| 188 NOTREACHED() << "metafile failed"; | 189 NOTREACHED() << "metafile failed"; |
| 189 } | 190 } |
| 190 | 191 |
| 191 } // namespace printing | 192 } // namespace printing |
| OLD | NEW |