| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/render_sandbox_host_linux.h" | 5 #include "content/browser/renderer_host/render_sandbox_host_linux.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <fontconfig/fontconfig.h> | 8 #include <fontconfig/fontconfig.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <unistd.h> | 10 #include <unistd.h> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "base/memory/scoped_ptr.h" | 22 #include "base/memory/scoped_ptr.h" |
| 23 #include "base/memory/singleton.h" | 23 #include "base/memory/singleton.h" |
| 24 #include "base/pickle.h" | 24 #include "base/pickle.h" |
| 25 #include "base/process_util.h" | 25 #include "base/process_util.h" |
| 26 #include "base/shared_memory.h" | 26 #include "base/shared_memory.h" |
| 27 #include "base/string_number_conversions.h" | 27 #include "base/string_number_conversions.h" |
| 28 #include "base/string_util.h" | 28 #include "base/string_util.h" |
| 29 #include "content/common/font_config_ipc_linux.h" | 29 #include "content/common/font_config_ipc_linux.h" |
| 30 #include "content/common/sandbox_methods_linux.h" | 30 #include "content/common/sandbox_methods_linux.h" |
| 31 #include "content/common/unix_domain_socket_posix.h" | 31 #include "content/common/unix_domain_socket_posix.h" |
| 32 #include "content/common/webkitplatformsupport_impl.h" |
| 32 #include "skia/ext/SkFontHost_fontconfig_direct.h" | 33 #include "skia/ext/SkFontHost_fontconfig_direct.h" |
| 33 #include "third_party/npapi/bindings/npapi_extensions.h" | 34 #include "third_party/npapi/bindings/npapi_extensions.h" |
| 34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
| 35 #include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebFontInfo.h" | 36 #include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebFontInfo.h" |
| 36 #include "webkit/glue/webkitplatformsupport_impl.h" | |
| 37 | 37 |
| 38 using WebKit::WebCString; | 38 using WebKit::WebCString; |
| 39 using WebKit::WebFontInfo; | 39 using WebKit::WebFontInfo; |
| 40 using WebKit::WebUChar; | 40 using WebKit::WebUChar; |
| 41 | 41 |
| 42 // http://code.google.com/p/chromium/wiki/LinuxSandboxIPC | 42 // http://code.google.com/p/chromium/wiki/LinuxSandboxIPC |
| 43 | 43 |
| 44 // BEWARE: code in this file run across *processes* (not just threads). | 44 // BEWARE: code in this file run across *processes* (not just threads). |
| 45 | 45 |
| 46 // This code runs in a child process | 46 // This code runs in a child process |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 if (HANDLE_EINTR(sendmsg(fds[0], &msg, MSG_DONTWAIT)) < 0) | 642 if (HANDLE_EINTR(sendmsg(fds[0], &msg, MSG_DONTWAIT)) < 0) |
| 643 PLOG(ERROR) << "sendmsg"; | 643 PLOG(ERROR) << "sendmsg"; |
| 644 } | 644 } |
| 645 | 645 |
| 646 // --------------------------------------------------------------------------- | 646 // --------------------------------------------------------------------------- |
| 647 | 647 |
| 648 const int lifeline_fd_; | 648 const int lifeline_fd_; |
| 649 const int browser_socket_; | 649 const int browser_socket_; |
| 650 FontConfigDirect* const font_config_; | 650 FontConfigDirect* const font_config_; |
| 651 std::vector<std::string> sandbox_cmd_; | 651 std::vector<std::string> sandbox_cmd_; |
| 652 scoped_ptr<webkit_glue::WebKitPlatformSupportImpl> webkit_platform_support_; | 652 scoped_ptr<content::WebKitPlatformSupportImpl> webkit_platform_support_; |
| 653 }; | 653 }; |
| 654 | 654 |
| 655 SandboxIPCProcess::~SandboxIPCProcess() { | 655 SandboxIPCProcess::~SandboxIPCProcess() { |
| 656 if (webkit_platform_support_.get()) | 656 if (webkit_platform_support_.get()) |
| 657 WebKit::shutdown(); | 657 WebKit::shutdown(); |
| 658 } | 658 } |
| 659 | 659 |
| 660 void SandboxIPCProcess::EnsureWebKitInitialized() { | 660 void SandboxIPCProcess::EnsureWebKitInitialized() { |
| 661 if (webkit_platform_support_.get()) | 661 if (webkit_platform_support_.get()) |
| 662 return; | 662 return; |
| 663 webkit_platform_support_.reset(new webkit_glue::WebKitPlatformSupportImpl); | 663 webkit_platform_support_.reset(new content::WebKitPlatformSupportImpl); |
| 664 WebKit::initialize(webkit_platform_support_.get()); | 664 WebKit::initialize(webkit_platform_support_.get()); |
| 665 } | 665 } |
| 666 | 666 |
| 667 // ----------------------------------------------------------------------------- | 667 // ----------------------------------------------------------------------------- |
| 668 | 668 |
| 669 // Runs on the main thread at startup. | 669 // Runs on the main thread at startup. |
| 670 RenderSandboxHostLinux::RenderSandboxHostLinux() | 670 RenderSandboxHostLinux::RenderSandboxHostLinux() |
| 671 : initialized_(false), | 671 : initialized_(false), |
| 672 renderer_socket_(0), | 672 renderer_socket_(0), |
| 673 childs_lifeline_fd_(0), | 673 childs_lifeline_fd_(0), |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 } | 716 } |
| 717 | 717 |
| 718 RenderSandboxHostLinux::~RenderSandboxHostLinux() { | 718 RenderSandboxHostLinux::~RenderSandboxHostLinux() { |
| 719 if (initialized_) { | 719 if (initialized_) { |
| 720 if (HANDLE_EINTR(close(renderer_socket_)) < 0) | 720 if (HANDLE_EINTR(close(renderer_socket_)) < 0) |
| 721 PLOG(ERROR) << "close"; | 721 PLOG(ERROR) << "close"; |
| 722 if (HANDLE_EINTR(close(childs_lifeline_fd_)) < 0) | 722 if (HANDLE_EINTR(close(childs_lifeline_fd_)) < 0) |
| 723 PLOG(ERROR) << "close"; | 723 PLOG(ERROR) << "close"; |
| 724 } | 724 } |
| 725 } | 725 } |
| OLD | NEW |