Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: content/common/font_config_ipc_linux.cc

Issue 1146813011: Move UnixDomainSocket to base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 size_t familyNameLen = familyName ? strlen(familyName) : 0; 89 size_t familyNameLen = familyName ? strlen(familyName) : 0;
90 if (familyNameLen > kMaxFontFamilyLength) 90 if (familyNameLen > kMaxFontFamilyLength)
91 return false; 91 return false;
92 92
93 Pickle request; 93 Pickle request;
94 request.WriteInt(METHOD_MATCH); 94 request.WriteInt(METHOD_MATCH);
95 request.WriteData(familyName, familyNameLen); 95 request.WriteData(familyName, familyNameLen);
96 request.WriteUInt32(requestedStyle); 96 request.WriteUInt32(requestedStyle);
97 97
98 uint8_t reply_buf[2048]; 98 uint8_t reply_buf[2048];
99 const ssize_t r = UnixDomainSocket::SendRecvMsg(fd_, reply_buf, 99 const ssize_t r = base::UnixDomainSocket::SendRecvMsg(
100 sizeof(reply_buf), NULL, 100 fd_, reply_buf, sizeof(reply_buf), NULL, request);
101 request);
102 if (r == -1) 101 if (r == -1)
103 return false; 102 return false;
104 103
105 Pickle reply(reinterpret_cast<char*>(reply_buf), r); 104 Pickle reply(reinterpret_cast<char*>(reply_buf), r);
106 PickleIterator iter(reply); 105 PickleIterator iter(reply);
107 bool result; 106 bool result;
108 if (!iter.ReadBool(&result)) 107 if (!iter.ReadBool(&result))
109 return false; 108 return false;
110 if (!result) 109 if (!result)
111 return false; 110 return false;
(...skipping 26 matching lines...) Expand all
138 if (mapped_font_files_it != mapped_font_files_.end()) 137 if (mapped_font_files_it != mapped_font_files_.end())
139 return mapped_font_files_it->second->CreateMemoryStream(); 138 return mapped_font_files_it->second->CreateMemoryStream();
140 } 139 }
141 140
142 Pickle request; 141 Pickle request;
143 request.WriteInt(METHOD_OPEN); 142 request.WriteInt(METHOD_OPEN);
144 request.WriteUInt32(identity.fID); 143 request.WriteUInt32(identity.fID);
145 144
146 int result_fd = -1; 145 int result_fd = -1;
147 uint8_t reply_buf[256]; 146 uint8_t reply_buf[256];
148 const ssize_t r = UnixDomainSocket::SendRecvMsg(fd_, reply_buf, 147 const ssize_t r = base::UnixDomainSocket::SendRecvMsg(
149 sizeof(reply_buf), 148 fd_, reply_buf, sizeof(reply_buf), &result_fd, request);
150 &result_fd, request);
151
152 if (r == -1) 149 if (r == -1)
153 return NULL; 150 return NULL;
154 151
155 Pickle reply(reinterpret_cast<char*>(reply_buf), r); 152 Pickle reply(reinterpret_cast<char*>(reply_buf), r);
156 bool result; 153 bool result;
157 PickleIterator iter(reply); 154 PickleIterator iter(reply);
158 if (!iter.ReadBool(&result) || !result) { 155 if (!iter.ReadBool(&result) || !result) {
159 if (result_fd) 156 if (result_fd)
160 CloseFD(result_fd); 157 CloseFD(result_fd);
161 return NULL; 158 return NULL;
(...skipping 13 matching lines...) Expand all
175 } 172 }
176 } 173 }
177 174
178 void FontConfigIPC::RemoveMappedFontFile(MappedFontFile* mapped_font_file) { 175 void FontConfigIPC::RemoveMappedFontFile(MappedFontFile* mapped_font_file) {
179 base::AutoLock lock(lock_); 176 base::AutoLock lock(lock_);
180 mapped_font_files_.erase(mapped_font_file->font_id()); 177 mapped_font_files_.erase(mapped_font_file->font_id());
181 } 178 }
182 179
183 } // namespace content 180 } // namespace content
184 181
OLDNEW
« no previous file with comments | « content/common/child_process_sandbox_support_impl_shm_linux.cc ('k') | content/common/send_zygote_child_ping_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698