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

Side by Side Diff: chrome/renderer/renderer_main_platform_delegate_mac.mm

Issue 341033: Sandbox Worker process on the Mac. (Closed)
Patch Set: Fix latest round of comments Created 11 years, 1 month 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
« no previous file with comments | « chrome/common/sandbox_mac.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/renderer/renderer_main_platform_delegate.h" 5 #include "chrome/renderer/renderer_main_platform_delegate.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/command_line.h"
10 #include "chrome/common/chrome_switches.h"
9 #include "chrome/common/sandbox_mac.h" 11 #include "chrome/common/sandbox_mac.h"
10 #include "third_party/WebKit/WebKit/mac/WebCoreSupport/WebSystemInterface.h" 12 #include "third_party/WebKit/WebKit/mac/WebCoreSupport/WebSystemInterface.h"
11 13
12 RendererMainPlatformDelegate::RendererMainPlatformDelegate( 14 RendererMainPlatformDelegate::RendererMainPlatformDelegate(
13 const MainFunctionParams& parameters) 15 const MainFunctionParams& parameters)
14 : parameters_(parameters) { 16 : parameters_(parameters) {
15 } 17 }
16 18
17 RendererMainPlatformDelegate::~RendererMainPlatformDelegate() { 19 RendererMainPlatformDelegate::~RendererMainPlatformDelegate() {
18 } 20 }
19 21
20 // TODO(mac-port): Any code needed to initialize a process for 22 // TODO(mac-port): Any code needed to initialize a process for
21 // purposes of running a renderer needs to also be reflected in 23 // purposes of running a renderer needs to also be reflected in
22 // chrome_dll_main.cc for --single-process support. 24 // chrome_dll_main.cc for --single-process support.
23 void RendererMainPlatformDelegate::PlatformInitialize() { 25 void RendererMainPlatformDelegate::PlatformInitialize() {
24 // Load WebKit system interfaces. 26 // Load WebKit system interfaces.
25 InitWebCoreSystemInterface(); 27 InitWebCoreSystemInterface();
26 28
27 // Warmup APIs before turning on the Sandbox.
28 sandbox::SandboxWarmup();
29
30 if (![NSThread isMultiThreaded]) { 29 if (![NSThread isMultiThreaded]) {
31 NSString* string = @""; 30 NSString* string = @"";
32 [NSThread detachNewThreadSelector:@selector(length) 31 [NSThread detachNewThreadSelector:@selector(length)
33 toTarget:string 32 toTarget:string
34 withObject:nil]; 33 withObject:nil];
35 } 34 }
36 35
37 // Initialize Cocoa. Without this call, drawing of native UI 36 // Initialize Cocoa. Without this call, drawing of native UI
38 // elements (e.g. buttons) in WebKit will explode. 37 // elements (e.g. buttons) in WebKit will explode.
39 [NSApplication sharedApplication]; 38 [NSApplication sharedApplication];
40 } 39 }
41 40
42 void RendererMainPlatformDelegate::PlatformUninitialize() { 41 void RendererMainPlatformDelegate::PlatformUninitialize() {
43 } 42 }
44 43
45 bool RendererMainPlatformDelegate::InitSandboxTests(bool no_sandbox) { 44 bool RendererMainPlatformDelegate::InitSandboxTests(bool no_sandbox) {
46 return true; 45 return true;
47 } 46 }
48 47
49 bool RendererMainPlatformDelegate::EnableSandbox() { 48 bool RendererMainPlatformDelegate::EnableSandbox() {
50 return sandbox::EnableSandbox(); 49 CommandLine* parsed_command_line = CommandLine::ForCurrentProcess();
50 SandboxInitWrapper sandbox_wrapper;
51 return sandbox_wrapper.InitializeSandbox(*parsed_command_line,
52 switches::kRendererProcess);
51 } 53 }
52 54
53 void RendererMainPlatformDelegate::RunSandboxTests() { 55 void RendererMainPlatformDelegate::RunSandboxTests() {
54 // TODO(port): Run sandbox unit test here. 56 // TODO(port): Run sandbox unit test here.
55 } 57 }
OLDNEW
« no previous file with comments | « chrome/common/sandbox_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698