| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/renderer_host/sandbox_ipc_linux.h" | 5 #include "content/browser/renderer_host/sandbox_ipc_linux.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <fontconfig/fontconfig.h> | 8 #include <fontconfig/fontconfig.h> |
| 9 #include <sys/poll.h> | 9 #include <sys/poll.h> |
| 10 #include <sys/socket.h> | 10 #include <sys/socket.h> |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // default: | 122 // default: |
| 123 // Don't add any languages in that case that we don't recognise the | 123 // Don't add any languages in that case that we don't recognise the |
| 124 // constant. | 124 // constant. |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace | 128 } // namespace |
| 129 | 129 |
| 130 namespace content { | 130 namespace content { |
| 131 | 131 |
| 132 SandboxIPCProcess::SandboxIPCProcess(int lifeline_fd, | 132 SandboxIPCHandler::SandboxIPCHandler(int browser_socket, |
| 133 int browser_socket, | |
| 134 std::string sandbox_cmd) | 133 std::string sandbox_cmd) |
| 135 : lifeline_fd_(lifeline_fd), browser_socket_(browser_socket) { | 134 : browser_socket_(browser_socket) { |
| 136 if (!sandbox_cmd.empty()) { | 135 if (!sandbox_cmd.empty()) { |
| 137 sandbox_cmd_.push_back(sandbox_cmd); | 136 sandbox_cmd_.push_back(sandbox_cmd); |
| 138 sandbox_cmd_.push_back(base::kFindInodeSwitch); | 137 sandbox_cmd_.push_back(base::kFindInodeSwitch); |
| 139 } | 138 } |
| 140 | 139 |
| 141 // FontConfig doesn't provide a standard property to control subpixel | 140 // FontConfig doesn't provide a standard property to control subpixel |
| 142 // positioning, so we pass the current setting through to WebKit. | 141 // positioning, so we pass the current setting through to WebKit. |
| 143 WebFontInfo::setSubpixelPositioning( | 142 WebFontInfo::setSubpixelPositioning( |
| 144 gfx::GetDefaultWebkitSubpixelPositioning()); | 143 gfx::GetDefaultWebkitSubpixelPositioning()); |
| 145 | |
| 146 CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
| 147 command_line.AppendSwitchASCII(switches::kProcessType, | |
| 148 switches::kSandboxIPCProcess); | |
| 149 | |
| 150 // Update the process title. The argv was already cached by the call to | |
| 151 // SetProcessTitleFromCommandLine in content_main_runner.cc, so we can pass | |
| 152 // NULL here (we don't have the original argv at this point). | |
| 153 SetProcessTitleFromCommandLine(NULL); | |
| 154 } | 144 } |
| 155 | 145 |
| 156 void SandboxIPCProcess::Run() { | 146 void SandboxIPCHandler::Run() { |
| 157 struct pollfd pfds[2]; | 147 struct pollfd pfds[1]; |
| 158 pfds[0].fd = lifeline_fd_; | 148 pfds[0].fd = browser_socket_; |
| 159 pfds[0].events = POLLIN; | 149 pfds[0].events = POLLIN; |
| 160 pfds[1].fd = browser_socket_; | |
| 161 pfds[1].events = POLLIN; | |
| 162 | 150 |
| 163 int failed_polls = 0; | 151 int failed_polls = 0; |
| 164 for (;;) { | 152 for (;;) { |
| 165 const int r = HANDLE_EINTR(poll(pfds, 2, -1 /* no timeout */)); | 153 const int r = |
| 154 HANDLE_EINTR(poll(pfds, arraysize(pfds), -1 /* no timeout */)); |
| 166 // '0' is not a possible return value with no timeout. | 155 // '0' is not a possible return value with no timeout. |
| 167 DCHECK_NE(0, r); | 156 DCHECK_NE(0, r); |
| 168 if (r < 0) { | 157 if (r < 0) { |
| 169 PLOG(WARNING) << "poll"; | 158 PLOG(WARNING) << "poll"; |
| 170 if (failed_polls++ == 3) { | 159 if (failed_polls++ == 3) { |
| 171 LOG(FATAL) << "poll(2) failing. RenderSandboxHostLinux aborting."; | 160 LOG(FATAL) << "poll(2) failing. SandboxIPCHandler aborting."; |
| 172 return; | 161 return; |
| 173 } | 162 } |
| 174 continue; | 163 continue; |
| 175 } | 164 } |
| 176 | 165 |
| 177 failed_polls = 0; | 166 failed_polls = 0; |
| 178 | 167 |
| 179 if (pfds[0].revents) { | 168 // If poll(2) reports an error condition in the fd, |
| 180 // our parent died so we should too. | 169 // we assume the zygote is gone and we return. |
| 181 _exit(0); | 170 if (pfds[0].revents & (POLLERR | POLLHUP)) { |
| 171 VLOG(1) << "SandboxIPCHandler stopping."; |
| 172 return; |
| 182 } | 173 } |
| 183 | 174 |
| 184 if (pfds[1].revents) { | 175 if (pfds[0].revents & POLLIN) { |
| 185 HandleRequestFromRenderer(browser_socket_); | 176 HandleRequestFromRenderer(browser_socket_); |
| 186 } | 177 } |
| 187 } | 178 } |
| 188 } | 179 } |
| 189 | 180 |
| 190 void SandboxIPCProcess::HandleRequestFromRenderer(int fd) { | 181 void SandboxIPCHandler::HandleRequestFromRenderer(int fd) { |
| 191 ScopedVector<base::ScopedFD> fds; | 182 ScopedVector<base::ScopedFD> fds; |
| 192 | 183 |
| 193 // A FontConfigIPC::METHOD_MATCH message could be kMaxFontFamilyLength | 184 // A FontConfigIPC::METHOD_MATCH message could be kMaxFontFamilyLength |
| 194 // bytes long (this is the largest message type). | 185 // bytes long (this is the largest message type). |
| 195 // 128 bytes padding are necessary so recvmsg() does not return MSG_TRUNC | 186 // 128 bytes padding are necessary so recvmsg() does not return MSG_TRUNC |
| 196 // error for a maximum length message. | 187 // error for a maximum length message. |
| 197 char buf[FontConfigIPC::kMaxFontFamilyLength + 128]; | 188 char buf[FontConfigIPC::kMaxFontFamilyLength + 128]; |
| 198 | 189 |
| 199 const ssize_t len = UnixDomainSocket::RecvMsg(fd, buf, sizeof(buf), &fds); | 190 const ssize_t len = UnixDomainSocket::RecvMsg(fd, buf, sizeof(buf), &fds); |
| 200 if (len == -1) { | 191 if (len == -1) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 224 HandleGetChildWithInode(fd, pickle, iter, fds.get()); | 215 HandleGetChildWithInode(fd, pickle, iter, fds.get()); |
| 225 } else if (kind == LinuxSandbox::METHOD_GET_STYLE_FOR_STRIKE) { | 216 } else if (kind == LinuxSandbox::METHOD_GET_STYLE_FOR_STRIKE) { |
| 226 HandleGetStyleForStrike(fd, pickle, iter, fds.get()); | 217 HandleGetStyleForStrike(fd, pickle, iter, fds.get()); |
| 227 } else if (kind == LinuxSandbox::METHOD_MAKE_SHARED_MEMORY_SEGMENT) { | 218 } else if (kind == LinuxSandbox::METHOD_MAKE_SHARED_MEMORY_SEGMENT) { |
| 228 HandleMakeSharedMemorySegment(fd, pickle, iter, fds.get()); | 219 HandleMakeSharedMemorySegment(fd, pickle, iter, fds.get()); |
| 229 } else if (kind == LinuxSandbox::METHOD_MATCH_WITH_FALLBACK) { | 220 } else if (kind == LinuxSandbox::METHOD_MATCH_WITH_FALLBACK) { |
| 230 HandleMatchWithFallback(fd, pickle, iter, fds.get()); | 221 HandleMatchWithFallback(fd, pickle, iter, fds.get()); |
| 231 } | 222 } |
| 232 } | 223 } |
| 233 | 224 |
| 234 int SandboxIPCProcess::FindOrAddPath(const SkString& path) { | 225 int SandboxIPCHandler::FindOrAddPath(const SkString& path) { |
| 235 int count = paths_.count(); | 226 int count = paths_.count(); |
| 236 for (int i = 0; i < count; ++i) { | 227 for (int i = 0; i < count; ++i) { |
| 237 if (path == *paths_[i]) | 228 if (path == *paths_[i]) |
| 238 return i; | 229 return i; |
| 239 } | 230 } |
| 240 *paths_.append() = new SkString(path); | 231 *paths_.append() = new SkString(path); |
| 241 return count; | 232 return count; |
| 242 } | 233 } |
| 243 | 234 |
| 244 void SandboxIPCProcess::HandleFontMatchRequest( | 235 void SandboxIPCHandler::HandleFontMatchRequest( |
| 245 int fd, | 236 int fd, |
| 246 const Pickle& pickle, | 237 const Pickle& pickle, |
| 247 PickleIterator iter, | 238 PickleIterator iter, |
| 248 const std::vector<base::ScopedFD*>& fds) { | 239 const std::vector<base::ScopedFD*>& fds) { |
| 249 uint32_t requested_style; | 240 uint32_t requested_style; |
| 250 std::string family; | 241 std::string family; |
| 251 if (!pickle.ReadString(&iter, &family) || | 242 if (!pickle.ReadString(&iter, &family) || |
| 252 !pickle.ReadUInt32(&iter, &requested_style)) | 243 !pickle.ReadUInt32(&iter, &requested_style)) |
| 253 return; | 244 return; |
| 254 | 245 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 274 result_identity.fID = static_cast<uint32_t>(index); | 265 result_identity.fID = static_cast<uint32_t>(index); |
| 275 | 266 |
| 276 reply.WriteBool(true); | 267 reply.WriteBool(true); |
| 277 skia::WriteSkString(&reply, result_family); | 268 skia::WriteSkString(&reply, result_family); |
| 278 skia::WriteSkFontIdentity(&reply, result_identity); | 269 skia::WriteSkFontIdentity(&reply, result_identity); |
| 279 reply.WriteUInt32(result_style); | 270 reply.WriteUInt32(result_style); |
| 280 } | 271 } |
| 281 SendRendererReply(fds, reply, -1); | 272 SendRendererReply(fds, reply, -1); |
| 282 } | 273 } |
| 283 | 274 |
| 284 void SandboxIPCProcess::HandleFontOpenRequest( | 275 void SandboxIPCHandler::HandleFontOpenRequest( |
| 285 int fd, | 276 int fd, |
| 286 const Pickle& pickle, | 277 const Pickle& pickle, |
| 287 PickleIterator iter, | 278 PickleIterator iter, |
| 288 const std::vector<base::ScopedFD*>& fds) { | 279 const std::vector<base::ScopedFD*>& fds) { |
| 289 uint32_t index; | 280 uint32_t index; |
| 290 if (!pickle.ReadUInt32(&iter, &index)) | 281 if (!pickle.ReadUInt32(&iter, &index)) |
| 291 return; | 282 return; |
| 292 if (index >= static_cast<uint32_t>(paths_.count())) | 283 if (index >= static_cast<uint32_t>(paths_.count())) |
| 293 return; | 284 return; |
| 294 const int result_fd = open(paths_[index]->c_str(), O_RDONLY); | 285 const int result_fd = open(paths_[index]->c_str(), O_RDONLY); |
| 295 | 286 |
| 296 Pickle reply; | 287 Pickle reply; |
| 297 if (result_fd == -1) { | 288 if (result_fd == -1) { |
| 298 reply.WriteBool(false); | 289 reply.WriteBool(false); |
| 299 } else { | 290 } else { |
| 300 reply.WriteBool(true); | 291 reply.WriteBool(true); |
| 301 } | 292 } |
| 302 | 293 |
| 303 // The receiver will have its own access to the file, so we will close it | 294 // The receiver will have its own access to the file, so we will close it |
| 304 // after this send. | 295 // after this send. |
| 305 SendRendererReply(fds, reply, result_fd); | 296 SendRendererReply(fds, reply, result_fd); |
| 306 | 297 |
| 307 if (result_fd >= 0) { | 298 if (result_fd >= 0) { |
| 308 int err = IGNORE_EINTR(close(result_fd)); | 299 int err = IGNORE_EINTR(close(result_fd)); |
| 309 DCHECK(!err); | 300 DCHECK(!err); |
| 310 } | 301 } |
| 311 } | 302 } |
| 312 | 303 |
| 313 void SandboxIPCProcess::HandleGetFontFamilyForChar( | 304 void SandboxIPCHandler::HandleGetFontFamilyForChar( |
| 314 int fd, | 305 int fd, |
| 315 const Pickle& pickle, | 306 const Pickle& pickle, |
| 316 PickleIterator iter, | 307 PickleIterator iter, |
| 317 const std::vector<base::ScopedFD*>& fds) { | 308 const std::vector<base::ScopedFD*>& fds) { |
| 318 // The other side of this call is | 309 // The other side of this call is |
| 319 // chrome/renderer/renderer_sandbox_support_linux.cc | 310 // content/common/child_process_sandbox_support_impl_linux.cc |
| 320 | 311 |
| 321 EnsureWebKitInitialized(); | 312 EnsureWebKitInitialized(); |
| 322 WebUChar32 c; | 313 WebUChar32 c; |
| 323 if (!pickle.ReadInt(&iter, &c)) | 314 if (!pickle.ReadInt(&iter, &c)) |
| 324 return; | 315 return; |
| 325 | 316 |
| 326 std::string preferred_locale; | 317 std::string preferred_locale; |
| 327 if (!pickle.ReadString(&iter, &preferred_locale)) | 318 if (!pickle.ReadString(&iter, &preferred_locale)) |
| 328 return; | 319 return; |
| 329 | 320 |
| 330 blink::WebFontFamily family; | 321 blink::WebFontFamily family; |
| 331 WebFontInfo::familyForChar(c, preferred_locale.c_str(), &family); | 322 WebFontInfo::familyForChar(c, preferred_locale.c_str(), &family); |
| 332 | 323 |
| 333 Pickle reply; | 324 Pickle reply; |
| 334 if (family.name.data()) { | 325 if (family.name.data()) { |
| 335 reply.WriteString(family.name.data()); | 326 reply.WriteString(family.name.data()); |
| 336 } else { | 327 } else { |
| 337 reply.WriteString(std::string()); | 328 reply.WriteString(std::string()); |
| 338 } | 329 } |
| 339 reply.WriteBool(family.isBold); | 330 reply.WriteBool(family.isBold); |
| 340 reply.WriteBool(family.isItalic); | 331 reply.WriteBool(family.isItalic); |
| 341 SendRendererReply(fds, reply, -1); | 332 SendRendererReply(fds, reply, -1); |
| 342 } | 333 } |
| 343 | 334 |
| 344 void SandboxIPCProcess::HandleGetStyleForStrike( | 335 void SandboxIPCHandler::HandleGetStyleForStrike( |
| 345 int fd, | 336 int fd, |
| 346 const Pickle& pickle, | 337 const Pickle& pickle, |
| 347 PickleIterator iter, | 338 PickleIterator iter, |
| 348 const std::vector<base::ScopedFD*>& fds) { | 339 const std::vector<base::ScopedFD*>& fds) { |
| 349 std::string family; | 340 std::string family; |
| 350 int sizeAndStyle; | 341 int sizeAndStyle; |
| 351 | 342 |
| 352 if (!pickle.ReadString(&iter, &family) || | 343 if (!pickle.ReadString(&iter, &family) || |
| 353 !pickle.ReadInt(&iter, &sizeAndStyle)) { | 344 !pickle.ReadInt(&iter, &sizeAndStyle)) { |
| 354 return; | 345 return; |
| 355 } | 346 } |
| 356 | 347 |
| 357 EnsureWebKitInitialized(); | 348 EnsureWebKitInitialized(); |
| 358 blink::WebFontRenderStyle style; | 349 blink::WebFontRenderStyle style; |
| 359 WebFontInfo::renderStyleForStrike(family.c_str(), sizeAndStyle, &style); | 350 WebFontInfo::renderStyleForStrike(family.c_str(), sizeAndStyle, &style); |
| 360 | 351 |
| 361 Pickle reply; | 352 Pickle reply; |
| 362 reply.WriteInt(style.useBitmaps); | 353 reply.WriteInt(style.useBitmaps); |
| 363 reply.WriteInt(style.useAutoHint); | 354 reply.WriteInt(style.useAutoHint); |
| 364 reply.WriteInt(style.useHinting); | 355 reply.WriteInt(style.useHinting); |
| 365 reply.WriteInt(style.hintStyle); | 356 reply.WriteInt(style.hintStyle); |
| 366 reply.WriteInt(style.useAntiAlias); | 357 reply.WriteInt(style.useAntiAlias); |
| 367 reply.WriteInt(style.useSubpixelRendering); | 358 reply.WriteInt(style.useSubpixelRendering); |
| 368 reply.WriteInt(style.useSubpixelPositioning); | 359 reply.WriteInt(style.useSubpixelPositioning); |
| 369 | 360 |
| 370 SendRendererReply(fds, reply, -1); | 361 SendRendererReply(fds, reply, -1); |
| 371 } | 362 } |
| 372 | 363 |
| 373 void SandboxIPCProcess::HandleLocaltime( | 364 void SandboxIPCHandler::HandleLocaltime( |
| 374 int fd, | 365 int fd, |
| 375 const Pickle& pickle, | 366 const Pickle& pickle, |
| 376 PickleIterator iter, | 367 PickleIterator iter, |
| 377 const std::vector<base::ScopedFD*>& fds) { | 368 const std::vector<base::ScopedFD*>& fds) { |
| 378 // The other side of this call is in zygote_main_linux.cc | 369 // The other side of this call is in zygote_main_linux.cc |
| 379 | 370 |
| 380 std::string time_string; | 371 std::string time_string; |
| 381 if (!pickle.ReadString(&iter, &time_string) || | 372 if (!pickle.ReadString(&iter, &time_string) || |
| 382 time_string.size() != sizeof(time_t)) { | 373 time_string.size() != sizeof(time_t)) { |
| 383 return; | 374 return; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 396 sizeof(struct tm)); | 387 sizeof(struct tm)); |
| 397 time_zone_string = expanded_time->tm_zone; | 388 time_zone_string = expanded_time->tm_zone; |
| 398 } | 389 } |
| 399 | 390 |
| 400 Pickle reply; | 391 Pickle reply; |
| 401 reply.WriteString(result_string); | 392 reply.WriteString(result_string); |
| 402 reply.WriteString(time_zone_string); | 393 reply.WriteString(time_zone_string); |
| 403 SendRendererReply(fds, reply, -1); | 394 SendRendererReply(fds, reply, -1); |
| 404 } | 395 } |
| 405 | 396 |
| 406 void SandboxIPCProcess::HandleGetChildWithInode( | 397 void SandboxIPCHandler::HandleGetChildWithInode( |
| 407 int fd, | 398 int fd, |
| 408 const Pickle& pickle, | 399 const Pickle& pickle, |
| 409 PickleIterator iter, | 400 PickleIterator iter, |
| 410 const std::vector<base::ScopedFD*>& fds) { | 401 const std::vector<base::ScopedFD*>& fds) { |
| 411 // The other side of this call is in zygote_main_linux.cc | 402 // The other side of this call is in zygote_main_linux.cc |
| 412 if (sandbox_cmd_.empty()) { | 403 if (sandbox_cmd_.empty()) { |
| 413 LOG(ERROR) << "Not in the sandbox, this should not be called"; | 404 LOG(ERROR) << "Not in the sandbox, this should not be called"; |
| 414 return; | 405 return; |
| 415 } | 406 } |
| 416 | 407 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 431 // Even though the pid is invalid, we still need to reply to the zygote | 422 // Even though the pid is invalid, we still need to reply to the zygote |
| 432 // and not just return here. | 423 // and not just return here. |
| 433 LOG(ERROR) << "Could not get pid"; | 424 LOG(ERROR) << "Could not get pid"; |
| 434 } | 425 } |
| 435 | 426 |
| 436 Pickle reply; | 427 Pickle reply; |
| 437 reply.WriteInt(pid); | 428 reply.WriteInt(pid); |
| 438 SendRendererReply(fds, reply, -1); | 429 SendRendererReply(fds, reply, -1); |
| 439 } | 430 } |
| 440 | 431 |
| 441 void SandboxIPCProcess::HandleMakeSharedMemorySegment( | 432 void SandboxIPCHandler::HandleMakeSharedMemorySegment( |
| 442 int fd, | 433 int fd, |
| 443 const Pickle& pickle, | 434 const Pickle& pickle, |
| 444 PickleIterator iter, | 435 PickleIterator iter, |
| 445 const std::vector<base::ScopedFD*>& fds) { | 436 const std::vector<base::ScopedFD*>& fds) { |
| 446 base::SharedMemoryCreateOptions options; | 437 base::SharedMemoryCreateOptions options; |
| 447 uint32_t size; | 438 uint32_t size; |
| 448 if (!pickle.ReadUInt32(&iter, &size)) | 439 if (!pickle.ReadUInt32(&iter, &size)) |
| 449 return; | 440 return; |
| 450 options.size = size; | 441 options.size = size; |
| 451 if (!pickle.ReadBool(&iter, &options.executable)) | 442 if (!pickle.ReadBool(&iter, &options.executable)) |
| 452 return; | 443 return; |
| 453 int shm_fd = -1; | 444 int shm_fd = -1; |
| 454 base::SharedMemory shm; | 445 base::SharedMemory shm; |
| 455 if (shm.Create(options)) | 446 if (shm.Create(options)) |
| 456 shm_fd = shm.handle().fd; | 447 shm_fd = shm.handle().fd; |
| 457 Pickle reply; | 448 Pickle reply; |
| 458 SendRendererReply(fds, reply, shm_fd); | 449 SendRendererReply(fds, reply, shm_fd); |
| 459 } | 450 } |
| 460 | 451 |
| 461 void SandboxIPCProcess::HandleMatchWithFallback( | 452 void SandboxIPCHandler::HandleMatchWithFallback( |
| 462 int fd, | 453 int fd, |
| 463 const Pickle& pickle, | 454 const Pickle& pickle, |
| 464 PickleIterator iter, | 455 PickleIterator iter, |
| 465 const std::vector<base::ScopedFD*>& fds) { | 456 const std::vector<base::ScopedFD*>& fds) { |
| 466 // Unlike the other calls, for which we are an indirection in front of | 457 // Unlike the other calls, for which we are an indirection in front of |
| 467 // WebKit or Skia, this call is always made via this sandbox helper | 458 // WebKit or Skia, this call is always made via this sandbox helper |
| 468 // process. Therefore the fontconfig code goes in here directly. | 459 // process. Therefore the fontconfig code goes in here directly. |
| 469 | 460 |
| 470 std::string face; | 461 std::string face; |
| 471 bool is_bold, is_italic; | 462 bool is_bold, is_italic; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 | 602 |
| 612 Pickle reply; | 603 Pickle reply; |
| 613 SendRendererReply(fds, reply, font_fd); | 604 SendRendererReply(fds, reply, font_fd); |
| 614 | 605 |
| 615 if (font_fd >= 0) { | 606 if (font_fd >= 0) { |
| 616 if (IGNORE_EINTR(close(font_fd)) < 0) | 607 if (IGNORE_EINTR(close(font_fd)) < 0) |
| 617 PLOG(ERROR) << "close"; | 608 PLOG(ERROR) << "close"; |
| 618 } | 609 } |
| 619 } | 610 } |
| 620 | 611 |
| 621 void SandboxIPCProcess::SendRendererReply( | 612 void SandboxIPCHandler::SendRendererReply( |
| 622 const std::vector<base::ScopedFD*>& fds, | 613 const std::vector<base::ScopedFD*>& fds, |
| 623 const Pickle& reply, | 614 const Pickle& reply, |
| 624 int reply_fd) { | 615 int reply_fd) { |
| 625 struct msghdr msg; | 616 struct msghdr msg; |
| 626 memset(&msg, 0, sizeof(msg)); | 617 memset(&msg, 0, sizeof(msg)); |
| 627 struct iovec iov = {const_cast<void*>(reply.data()), reply.size()}; | 618 struct iovec iov = {const_cast<void*>(reply.data()), reply.size()}; |
| 628 msg.msg_iov = &iov; | 619 msg.msg_iov = &iov; |
| 629 msg.msg_iovlen = 1; | 620 msg.msg_iovlen = 1; |
| 630 | 621 |
| 631 char control_buffer[CMSG_SPACE(sizeof(int))]; | 622 char control_buffer[CMSG_SPACE(sizeof(int))]; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 647 cmsg->cmsg_type = SCM_RIGHTS; | 638 cmsg->cmsg_type = SCM_RIGHTS; |
| 648 cmsg->cmsg_len = CMSG_LEN(sizeof(int)); | 639 cmsg->cmsg_len = CMSG_LEN(sizeof(int)); |
| 649 memcpy(CMSG_DATA(cmsg), &reply_fd, sizeof(reply_fd)); | 640 memcpy(CMSG_DATA(cmsg), &reply_fd, sizeof(reply_fd)); |
| 650 msg.msg_controllen = cmsg->cmsg_len; | 641 msg.msg_controllen = cmsg->cmsg_len; |
| 651 } | 642 } |
| 652 | 643 |
| 653 if (HANDLE_EINTR(sendmsg(fds[0]->get(), &msg, MSG_DONTWAIT)) < 0) | 644 if (HANDLE_EINTR(sendmsg(fds[0]->get(), &msg, MSG_DONTWAIT)) < 0) |
| 654 PLOG(ERROR) << "sendmsg"; | 645 PLOG(ERROR) << "sendmsg"; |
| 655 } | 646 } |
| 656 | 647 |
| 657 SandboxIPCProcess::~SandboxIPCProcess() { | 648 SandboxIPCHandler::~SandboxIPCHandler() { |
| 658 paths_.deleteAll(); | 649 paths_.deleteAll(); |
| 659 if (webkit_platform_support_) | 650 if (webkit_platform_support_) |
| 660 blink::shutdownWithoutV8(); | 651 blink::shutdownWithoutV8(); |
| 661 } | 652 } |
| 662 | 653 |
| 663 void SandboxIPCProcess::EnsureWebKitInitialized() { | 654 void SandboxIPCHandler::EnsureWebKitInitialized() { |
| 664 if (webkit_platform_support_) | 655 if (webkit_platform_support_) |
| 665 return; | 656 return; |
| 666 webkit_platform_support_.reset(new BlinkPlatformImpl); | 657 webkit_platform_support_.reset(new BlinkPlatformImpl); |
| 667 blink::initializeWithoutV8(webkit_platform_support_.get()); | 658 blink::initializeWithoutV8(webkit_platform_support_.get()); |
| 668 } | 659 } |
| 669 | 660 |
| 670 } // namespace content | 661 } // namespace content |
| OLD | NEW |