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

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

Issue 10540038: linux: Pass subpixel positioning setting to WebKit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 8 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 | Annotate | Revision Log
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/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 16 matching lines...) Expand all
27 #include "base/shared_memory.h" 27 #include "base/shared_memory.h"
28 #include "base/string_number_conversions.h" 28 #include "base/string_number_conversions.h"
29 #include "base/string_util.h" 29 #include "base/string_util.h"
30 #include "content/common/font_config_ipc_linux.h" 30 #include "content/common/font_config_ipc_linux.h"
31 #include "content/common/sandbox_methods_linux.h" 31 #include "content/common/sandbox_methods_linux.h"
32 #include "content/common/webkitplatformsupport_impl.h" 32 #include "content/common/webkitplatformsupport_impl.h"
33 #include "skia/ext/SkFontHost_fontconfig_direct.h" 33 #include "skia/ext/SkFontHost_fontconfig_direct.h"
34 #include "third_party/npapi/bindings/npapi_extensions.h" 34 #include "third_party/npapi/bindings/npapi_extensions.h"
35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" 35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
36 #include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebFontInfo.h" 36 #include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebFontInfo.h"
37 #include "ui/base/ui_base_switches.h"
37 38
38 using WebKit::WebCString; 39 using WebKit::WebCString;
39 using WebKit::WebFontInfo; 40 using WebKit::WebFontInfo;
40 using WebKit::WebUChar; 41 using WebKit::WebUChar;
41 42
42 // http://code.google.com/p/chromium/wiki/LinuxSandboxIPC 43 // http://code.google.com/p/chromium/wiki/LinuxSandboxIPC
43 44
44 // BEWARE: code in this file run across *processes* (not just threads). 45 // BEWARE: code in this file run across *processes* (not just threads).
45 46
46 // This code runs in a child process 47 // This code runs in a child process
47 class SandboxIPCProcess { 48 class SandboxIPCProcess {
48 public: 49 public:
49 // lifeline_fd: this is the read end of a pipe which the browser process 50 // lifeline_fd: this is the read end of a pipe which the browser process
50 // holds the other end of. If the browser process dies, its descriptors are 51 // holds the other end of. If the browser process dies, its descriptors are
51 // closed and we will noticed an EOF on the pipe. That's our signal to exit. 52 // closed and we will noticed an EOF on the pipe. That's our signal to exit.
52 // browser_socket: the browser's end of the sandbox IPC socketpair. From the 53 // browser_socket: the browser's end of the sandbox IPC socketpair. From the
53 // point of view of the renderer, it's talking to the browser but this 54 // point of view of the renderer, it's talking to the browser but this
54 // object actually services the requests. 55 // object actually services the requests.
55 // sandbox_cmd: the path of the sandbox executable 56 // sandbox_cmd: the path of the sandbox executable
56 SandboxIPCProcess(int lifeline_fd, int browser_socket, 57 SandboxIPCProcess(int lifeline_fd, int browser_socket,
57 std::string sandbox_cmd) 58 std::string sandbox_cmd)
58 : lifeline_fd_(lifeline_fd), 59 : lifeline_fd_(lifeline_fd),
59 browser_socket_(browser_socket), 60 browser_socket_(browser_socket),
60 font_config_(new FontConfigDirect()) { 61 font_config_(new FontConfigDirect()) {
61 if (!sandbox_cmd.empty()) { 62 if (!sandbox_cmd.empty()) {
62 sandbox_cmd_.push_back(sandbox_cmd); 63 sandbox_cmd_.push_back(sandbox_cmd);
63 sandbox_cmd_.push_back(base::kFindInodeSwitch); 64 sandbox_cmd_.push_back(base::kFindInodeSwitch);
64 } 65 }
66
67 // FontConfig doesn't provide a standard property to control subpixel
68 // positioning, so we pass a UI flag through to WebKit.
69 WebFontInfo::setSubpixelPositioning(
70 CommandLine::ForCurrentProcess()->HasSwitch(
71 switches::kEnableTextSubpixelPositioning));
65 } 72 }
66 73
67 ~SandboxIPCProcess(); 74 ~SandboxIPCProcess();
68 75
69 void Run() { 76 void Run() {
70 struct pollfd pfds[2]; 77 struct pollfd pfds[2];
71 pfds[0].fd = lifeline_fd_; 78 pfds[0].fd = lifeline_fd_;
72 pfds[0].events = POLLIN; 79 pfds[0].events = POLLIN;
73 pfds[1].fd = browser_socket_; 80 pfds[1].fd = browser_socket_;
74 pfds[1].events = POLLIN; 81 pfds[1].events = POLLIN;
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 EnsureWebKitInitialized(); 300 EnsureWebKitInitialized();
294 WebKit::WebFontRenderStyle style; 301 WebKit::WebFontRenderStyle style;
295 WebFontInfo::renderStyleForStrike(family.c_str(), sizeAndStyle, &style); 302 WebFontInfo::renderStyleForStrike(family.c_str(), sizeAndStyle, &style);
296 303
297 Pickle reply; 304 Pickle reply;
298 reply.WriteInt(style.useBitmaps); 305 reply.WriteInt(style.useBitmaps);
299 reply.WriteInt(style.useAutoHint); 306 reply.WriteInt(style.useAutoHint);
300 reply.WriteInt(style.useHinting); 307 reply.WriteInt(style.useHinting);
301 reply.WriteInt(style.hintStyle); 308 reply.WriteInt(style.hintStyle);
302 reply.WriteInt(style.useAntiAlias); 309 reply.WriteInt(style.useAntiAlias);
303 reply.WriteInt(style.useSubpixel); 310 reply.WriteInt(style.useSubpixelRendering);
311 reply.WriteInt(style.useSubpixelPositioning);
304 312
305 SendRendererReply(fds, reply, -1); 313 SendRendererReply(fds, reply, -1);
306 } 314 }
307 315
308 void HandleLocaltime(int fd, const Pickle& pickle, PickleIterator iter, 316 void HandleLocaltime(int fd, const Pickle& pickle, PickleIterator iter,
309 std::vector<int>& fds) { 317 std::vector<int>& fds) {
310 // The other side of this call is in zygote_main_linux.cc 318 // The other side of this call is in zygote_main_linux.cc
311 319
312 std::string time_string; 320 std::string time_string;
313 if (!pickle.ReadString(&iter, &time_string) || 321 if (!pickle.ReadString(&iter, &time_string) ||
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 } 730 }
723 731
724 RenderSandboxHostLinux::~RenderSandboxHostLinux() { 732 RenderSandboxHostLinux::~RenderSandboxHostLinux() {
725 if (initialized_) { 733 if (initialized_) {
726 if (HANDLE_EINTR(close(renderer_socket_)) < 0) 734 if (HANDLE_EINTR(close(renderer_socket_)) < 0)
727 PLOG(ERROR) << "close"; 735 PLOG(ERROR) << "close";
728 if (HANDLE_EINTR(close(childs_lifeline_fd_)) < 0) 736 if (HANDLE_EINTR(close(childs_lifeline_fd_)) < 0)
729 PLOG(ERROR) << "close"; 737 PLOG(ERROR) << "close";
730 } 738 }
731 } 739 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_preferences_util.cc ('k') | content/common/child_process_sandbox_support_impl_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698