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