| 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 "printing/pdf_metafile_skia.h" | 5 #include "printing/pdf_metafile_skia.h" |
| 6 | 6 |
| 7 #include "base/containers/hash_tables.h" | 7 #include "base/containers/hash_tables.h" |
| 8 #include "base/file_descriptor_posix.h" | 8 #include "base/file_descriptor_posix.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 SkAutoDataUnref data(data_->pdf_stream_.copyToData()); | 205 SkAutoDataUnref data(data_->pdf_stream_.copyToData()); |
| 206 if (file_util::WriteFileDescriptor(fd.fd, | 206 if (file_util::WriteFileDescriptor(fd.fd, |
| 207 reinterpret_cast<const char*>(data->data())
, | 207 reinterpret_cast<const char*>(data->data())
, |
| 208 GetDataSize()) != | 208 GetDataSize()) != |
| 209 static_cast<int>(GetDataSize())) { | 209 static_cast<int>(GetDataSize())) { |
| 210 DLOG(ERROR) << "Failed to save file with fd " << fd.fd; | 210 DLOG(ERROR) << "Failed to save file with fd " << fd.fd; |
| 211 result = false; | 211 result = false; |
| 212 } | 212 } |
| 213 | 213 |
| 214 if (fd.auto_close) { | 214 if (fd.auto_close) { |
| 215 if (HANDLE_EINTR(close(fd.fd)) < 0) { | 215 if (IGNORE_EINTR(close(fd.fd)) < 0) { |
| 216 DPLOG(WARNING) << "close"; | 216 DPLOG(WARNING) << "close"; |
| 217 result = false; | 217 result = false; |
| 218 } | 218 } |
| 219 } | 219 } |
| 220 return result; | 220 return result; |
| 221 } | 221 } |
| 222 #endif | 222 #endif |
| 223 | 223 |
| 224 PdfMetafileSkia::PdfMetafileSkia() | 224 PdfMetafileSkia::PdfMetafileSkia() |
| 225 : data_(new PdfMetafileSkiaData), | 225 : data_(new PdfMetafileSkiaData), |
| (...skipping 13 matching lines...) Expand all Loading... |
| 239 if (data->size() == 0) | 239 if (data->size() == 0) |
| 240 return NULL; | 240 return NULL; |
| 241 | 241 |
| 242 PdfMetafileSkia* metafile = new PdfMetafileSkia; | 242 PdfMetafileSkia* metafile = new PdfMetafileSkia; |
| 243 metafile->InitFromData(data->bytes(), | 243 metafile->InitFromData(data->bytes(), |
| 244 base::checked_numeric_cast<uint32>(data->size())); | 244 base::checked_numeric_cast<uint32>(data->size())); |
| 245 return metafile; | 245 return metafile; |
| 246 } | 246 } |
| 247 | 247 |
| 248 } // namespace printing | 248 } // namespace printing |
| OLD | NEW |