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

Side by Side Diff: content/browser/renderer_host/sandbox_ipc_linux.cc

Issue 1761853002: Shut down all threads before the main thread shuts down (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // we assume the zygote is gone and we exit the loop. 113 // we assume the zygote is gone and we exit the loop.
114 if (pfds[1].revents & (POLLERR | POLLHUP)) { 114 if (pfds[1].revents & (POLLERR | POLLHUP)) {
115 break; 115 break;
116 } 116 }
117 117
118 if (pfds[1].revents & POLLIN) { 118 if (pfds[1].revents & POLLIN) {
119 HandleRequestFromRenderer(browser_socket_); 119 HandleRequestFromRenderer(browser_socket_);
120 } 120 }
121 } 121 }
122 122
123 if (blink_platform_impl_)
124 blink::shutdownWithoutV8();
kinuko 2016/03/07 06:36:56 Yeah this'd work.
sof 2016/03/07 07:54:03 naive question: would things break horribly if thi
haraken 2016/03/07 08:02:34 Do you mean we should call blink::initialize() and
sof 2016/03/07 08:20:38 ok, thanks. And allocating via Oilpan is an unavoi
haraken 2016/03/07 08:24:03 Yes. Heap::init was already in initializeWithoutV8
125
123 VLOG(1) << "SandboxIPCHandler stopping."; 126 VLOG(1) << "SandboxIPCHandler stopping.";
124 } 127 }
125 128
126 void SandboxIPCHandler::HandleRequestFromRenderer(int fd) { 129 void SandboxIPCHandler::HandleRequestFromRenderer(int fd) {
127 std::vector<base::ScopedFD> fds; 130 std::vector<base::ScopedFD> fds;
128 131
129 // A FontConfigIPC::METHOD_MATCH message could be kMaxFontFamilyLength 132 // A FontConfigIPC::METHOD_MATCH message could be kMaxFontFamilyLength
130 // bytes long (this is the largest message type). 133 // bytes long (this is the largest message type).
131 // 128 bytes padding are necessary so recvmsg() does not return MSG_TRUNC 134 // 128 bytes padding are necessary so recvmsg() does not return MSG_TRUNC
132 // error for a maximum length message. 135 // error for a maximum length message.
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 cmsg->cmsg_len = CMSG_LEN(sizeof(int)); 430 cmsg->cmsg_len = CMSG_LEN(sizeof(int));
428 memcpy(CMSG_DATA(cmsg), &reply_fd, sizeof(reply_fd)); 431 memcpy(CMSG_DATA(cmsg), &reply_fd, sizeof(reply_fd));
429 msg.msg_controllen = cmsg->cmsg_len; 432 msg.msg_controllen = cmsg->cmsg_len;
430 } 433 }
431 434
432 if (HANDLE_EINTR(sendmsg(fds[0].get(), &msg, MSG_DONTWAIT)) < 0) 435 if (HANDLE_EINTR(sendmsg(fds[0].get(), &msg, MSG_DONTWAIT)) < 0)
433 PLOG(ERROR) << "sendmsg"; 436 PLOG(ERROR) << "sendmsg";
434 } 437 }
435 438
436 SandboxIPCHandler::~SandboxIPCHandler() { 439 SandboxIPCHandler::~SandboxIPCHandler() {
437 if (blink_platform_impl_)
438 blink::shutdownWithoutV8();
439
440 if (IGNORE_EINTR(close(lifeline_fd_)) < 0) 440 if (IGNORE_EINTR(close(lifeline_fd_)) < 0)
441 PLOG(ERROR) << "close"; 441 PLOG(ERROR) << "close";
442 if (IGNORE_EINTR(close(browser_socket_)) < 0) 442 if (IGNORE_EINTR(close(browser_socket_)) < 0)
443 PLOG(ERROR) << "close"; 443 PLOG(ERROR) << "close";
444 } 444 }
445 445
446 void SandboxIPCHandler::EnsureWebKitInitialized() { 446 void SandboxIPCHandler::EnsureWebKitInitialized() {
447 if (blink_platform_impl_) 447 if (blink_platform_impl_)
448 return; 448 return;
449 blink_platform_impl_.reset(new BlinkPlatformImpl); 449 blink_platform_impl_.reset(new BlinkPlatformImpl);
450 blink::initializeWithoutV8(blink_platform_impl_.get()); 450 blink::initializeWithoutV8(blink_platform_impl_.get());
451 } 451 }
452 452
453 } // namespace content 453 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/Init.h » ('j') | third_party/WebKit/Source/web/WebKit.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698