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 "content/common/font_config_ipc_linux.h" | 5 #include "content/common/font_config_ipc_linux.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <sys/mman.h> | 9 #include <sys/mman.h> |
10 #include <sys/socket.h> | 10 #include <sys/socket.h> |
(...skipping 15 matching lines...) Expand all Loading... |
26 // Return a stream from the file descriptor, or NULL on failure. | 26 // Return a stream from the file descriptor, or NULL on failure. |
27 SkStream* StreamFromFD(int fd) { | 27 SkStream* StreamFromFD(int fd) { |
28 skia::RefPtr<SkData> data = skia::AdoptRef(SkData::NewFromFD(fd)); | 28 skia::RefPtr<SkData> data = skia::AdoptRef(SkData::NewFromFD(fd)); |
29 if (!data) { | 29 if (!data) { |
30 return NULL; | 30 return NULL; |
31 } | 31 } |
32 return new SkMemoryStream(data.get()); | 32 return new SkMemoryStream(data.get()); |
33 } | 33 } |
34 | 34 |
35 void CloseFD(int fd) { | 35 void CloseFD(int fd) { |
36 int err = HANDLE_EINTR(close(fd)); | 36 int err = IGNORE_EINTR(close(fd)); |
37 DCHECK(!err); | 37 DCHECK(!err); |
38 } | 38 } |
39 | 39 |
40 FontConfigIPC::FontConfigIPC(int fd) | 40 FontConfigIPC::FontConfigIPC(int fd) |
41 : fd_(fd) { | 41 : fd_(fd) { |
42 } | 42 } |
43 | 43 |
44 FontConfigIPC::~FontConfigIPC() { | 44 FontConfigIPC::~FontConfigIPC() { |
45 CloseFD(fd_); | 45 CloseFD(fd_); |
46 } | 46 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 return NULL; | 119 return NULL; |
120 } | 120 } |
121 | 121 |
122 SkStream* stream = StreamFromFD(result_fd); | 122 SkStream* stream = StreamFromFD(result_fd); |
123 CloseFD(result_fd); | 123 CloseFD(result_fd); |
124 return stream; | 124 return stream; |
125 } | 125 } |
126 | 126 |
127 } // namespace content | 127 } // namespace content |
128 | 128 |
OLD | NEW |