summaryrefslogtreecommitdiffstats
path: root/skia/ext
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-18 00:44:42 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-18 00:44:42 +0000
commit43235a0aeb0a8de53bd6a7184fa1f4a71f5be083 (patch)
tree438c31b2bdf7a10e347c5dd0d0bb9c86f082ad4c /skia/ext
parent5f948943cc7581a276b2c4eb632af874a8fe469e (diff)
downloadchromium_src-43235a0aeb0a8de53bd6a7184fa1f4a71f5be083.zip
chromium_src-43235a0aeb0a8de53bd6a7184fa1f4a71f5be083.tar.gz
chromium_src-43235a0aeb0a8de53bd6a7184fa1f4a71f5be083.tar.bz2
Linux: move SyncIPC function from Skia to base.
I'll be needing in some pending WebKit changes. http://codereview.chromium.org/131006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18676 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/ext')
-rw-r--r--skia/ext/SkFontHost_fontconfig_ipc.cpp47
1 files changed, 4 insertions, 43 deletions
diff --git a/skia/ext/SkFontHost_fontconfig_ipc.cpp b/skia/ext/SkFontHost_fontconfig_ipc.cpp
index 1705aed..e3868f4 100644
--- a/skia/ext/SkFontHost_fontconfig_ipc.cpp
+++ b/skia/ext/SkFontHost_fontconfig_ipc.cpp
@@ -36,47 +36,6 @@ FontConfigIPC::~FontConfigIPC() {
close(fd_);
}
-static ssize_t SyncIPC(int fd, uint8_t* reply, unsigned reply_len, int* result_fd,
- const Pickle& request) {
- int fds[2];
- if (socketpair(AF_UNIX, SOCK_DGRAM, 0, fds) == -1)
- return false;
-
- std::vector<int> fd_vector;
- fd_vector.push_back(fds[1]);
- if (!base::SendMsg(fd, request.data(), request.size(), fd_vector)) {
- close(fds[0]);
- close(fds[1]);
- return -1;
- }
- close(fds[1]);
-
- fd_vector.clear();
- const ssize_t r = base::RecvMsg(fds[0], reply, reply_len, &fd_vector);
- close(fds[0]);
- if (r == -1)
- return -1;
-
- if ((fd_vector.size() > 0 && result_fd == NULL) || fd_vector.size() > 1) {
- for (std::vector<int>::const_iterator
- i = fd_vector.begin(); i != fd_vector.end(); ++i) {
- close(*i);
- }
-
- return -1;
- }
-
- if (result_fd) {
- if (fd_vector.size() == 0) {
- *result_fd = -1;
- } else {
- *result_fd = fd_vector[0];
- }
- }
-
- return r;
-}
-
bool FontConfigIPC::Match(std::string* result_family,
unsigned* result_fileid,
bool fileid_valid, unsigned fileid,
@@ -92,7 +51,8 @@ bool FontConfigIPC::Match(std::string* result_family,
request.WriteString(family);
uint8_t reply_buf[512];
- const ssize_t r = SyncIPC(fd_, reply_buf, sizeof(reply_buf), NULL, request);
+ const ssize_t r = base::SendRecvMsg(fd_, reply_buf, sizeof(reply_buf), NULL,
+ request);
if (r == -1)
return false;
@@ -125,7 +85,8 @@ int FontConfigIPC::Open(unsigned fileid) {
int result_fd = -1;
uint8_t reply_buf[256];
- const ssize_t r = SyncIPC(fd_, reply_buf, sizeof(reply_buf), &result_fd, request);
+ const ssize_t r = base::SendRecvMsg(fd_, reply_buf, sizeof(reply_buf),
+ &result_fd, request);
if (r == -1)
return -1;