summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-28 18:33:30 +0000
committerrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-28 18:33:30 +0000
commitc457e8fadd95ca31883010b1da1ab5704b5bfd8f (patch)
tree5021506c62df27f8edef83cdcf8ff912d50c22e4
parentc6bc2033b8c82de1ee192200ab69c241d4a4f23a (diff)
downloadchromium_src-c457e8fadd95ca31883010b1da1ab5704b5bfd8f.zip
chromium_src-c457e8fadd95ca31883010b1da1ab5704b5bfd8f.tar.gz
chromium_src-c457e8fadd95ca31883010b1da1ab5704b5bfd8f.tar.bz2
[Mac] Remove NSApplication from the renderer.
This removes the +sharedApplication warmup from the renderer, along with the trackpad IME hack. The hack is no longer necessary because NSApplication will no longer connect to TSM. BUG=306348,311899,336642,31225,152566 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=253994 Reverted: https://src.chromium.org/viewvc/chrome?view=rev&revision=254034 R=avi@chromium.org, mark@chromium.org Review URL: https://codereview.chromium.org/177243021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@254175 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/common/sandbox_mac.mm5
-rw-r--r--content/content.gyp5
-rw-r--r--content/renderer/DEPS1
-rw-r--r--content/renderer/renderer_main.cc9
-rw-r--r--content/renderer/renderer_main_platform_delegate_mac.mm96
-rw-r--r--content/shell/renderer/test_runner/WebTestThemeEngineMac.mm8
6 files changed, 15 insertions, 109 deletions
diff --git a/content/common/sandbox_mac.mm b/content/common/sandbox_mac.mm
index 0baa275..41ad800 100644
--- a/content/common/sandbox_mac.mm
+++ b/content/common/sandbox_mac.mm
@@ -277,11 +277,6 @@ void Sandbox::SandboxWarmup(int sandbox_type) {
CGColorSpaceCreateWithName(kCGColorSpaceGenericCMYK));
}
- { // [-NSColor colorUsingColorSpaceName] - 10.5.6
- NSColor* color = [NSColor controlTextColor];
- [color colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
- }
-
{ // localtime() - 10.5.6
time_t tv = {0};
localtime(&tv);
diff --git a/content/content.gyp b/content/content.gyp
index b921672..1d32352 100644
--- a/content/content.gyp
+++ b/content/content.gyp
@@ -257,11 +257,6 @@
'content_resources.gyp:content_resources',
],
'conditions': [
- ['OS=="mac"', {
- 'dependencies': [
- '<(DEPTH)/third_party/mach_override/mach_override.gyp:mach_override',
- ],
- }],
['chromium_enable_vtune_jit_for_v8==1', {
'dependencies': [
'../v8/src/third_party/vtune/v8vtune.gyp:v8_vtune',
diff --git a/content/renderer/DEPS b/content/renderer/DEPS
index 10db772..27cce10 100644
--- a/content/renderer/DEPS
+++ b/content/renderer/DEPS
@@ -6,7 +6,6 @@ include_rules = [
"+media", # For audio input/output and audio/video decoding.
"+third_party/hyphen/hyphen.h",
"+third_party/libjingle",
- "+third_party/mach_override",
"+third_party/tcmalloc",
"+v8/include",
"+v8/src/third_party/vtune",
diff --git a/content/renderer/renderer_main.cc b/content/renderer/renderer_main.cc
index 31b0781..33aa047 100644
--- a/content/renderer/renderer_main.cc
+++ b/content/renderer/renderer_main.cc
@@ -45,6 +45,7 @@
#include "base/mac/mac_util.h"
#include "base/mac/scoped_nsautorelease_pool.h"
+#include "base/message_loop/message_pump_mac.h"
#include "third_party/WebKit/public/web/WebView.h"
#endif // OS_MACOSX
@@ -158,9 +159,11 @@ int RendererMain(const MainFunctionParams& parameters) {
RendererMessageLoopObserver task_observer;
#if defined(OS_MACOSX)
- // As long as we use Cocoa in the renderer (for the forseeable future as of
- // now; see http://crbug.com/306348 for info) we need to have a UI loop.
- base::MessageLoopForUI main_message_loop;
+ // As long as scrollbars on Mac are painted with Cocoa, the message pump
+ // needs to be backed by a Foundation-level loop to process NSTimers. See
+ // http://crbug.com/306348#c24 for details.
+ scoped_ptr<base::MessagePump> pump(new base::MessagePumpNSRunLoop());
+ base::MessageLoop main_message_loop(pump.Pass());
#else
// The main message loop of the renderer services doesn't have IO or UI tasks.
base::MessageLoop main_message_loop;
diff --git a/content/renderer/renderer_main_platform_delegate_mac.mm b/content/renderer/renderer_main_platform_delegate_mac.mm
index df47f3d..7c42727 100644
--- a/content/renderer/renderer_main_platform_delegate_mac.mm
+++ b/content/renderer/renderer_main_platform_delegate_mac.mm
@@ -10,8 +10,6 @@
#include "base/command_line.h"
#include "base/logging.h"
-#import "base/mac/foundation_util.h"
-#import "base/mac/mac_util.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/sys_string_conversions.h"
@@ -19,56 +17,11 @@
#include "content/public/common/content_switches.h"
#import "content/public/common/injection_test_mac.h"
#include "content/common/sandbox_init_mac.h"
-#include "third_party/mach_override/mach_override.h"
-
-extern "C" {
-// SPI logging functions for CF that are exported externally.
-void CFLog(int32_t level, CFStringRef format, ...);
-void _CFLogvEx(void* log_func, void* copy_desc_func,
- CFDictionaryRef format_options, int32_t level,
- CFStringRef format, va_list args);
-} // extern "C"
namespace content {
namespace {
-// This leaked array stores the text input services input and layout sources,
-// which is returned in CrTISCreateInputSourceList(). This list is computed
-// right after the sandbox is initialized.
-CFArrayRef g_text_input_services_source_list_ = NULL;
-
-CFArrayRef CrTISCreateInputSourceList(
- CFDictionaryRef properties,
- Boolean includeAllInstalled) {
- DCHECK(g_text_input_services_source_list_);
- // Callers assume ownership of the result, so increase the retain count.
- CFRetain(g_text_input_services_source_list_);
- return g_text_input_services_source_list_;
-}
-
-// Text Input Services expects to be able to XPC to HIServices, but the
-// renderer sandbox blocks that. TIS then becomes very vocal about this on
-// every new renderer startup, so filter out those log messages.
-void CrRendererCFLog(int32_t level, CFStringRef format, ...) {
- const CFStringRef kAnnoyingLogMessages[] = {
- CFSTR("Error received in message reply handler: %s\n"),
- CFSTR("Connection Invalid error for service %s.\n"),
- };
-
- for (size_t i = 0; i < arraysize(kAnnoyingLogMessages); ++i) {
- if (CFStringCompare(format, kAnnoyingLogMessages[i], 0) ==
- kCFCompareEqualTo) {
- return;
- }
- }
-
- va_list args;
- va_start(args, format);
- _CFLogvEx(NULL, NULL, NULL, level, format, args);
- va_end(args);
-}
-
// You are about to read a pretty disgusting hack. In a static initializer,
// CoreFoundation decides to connect with cfprefsd(8) using Mach IPC. There is
// no public way to close this Mach port after-the-fact, nor a way to stop it
@@ -164,10 +117,6 @@ RendererMainPlatformDelegate::~RendererMainPlatformDelegate() {
// running a renderer needs to also be reflected in chrome_main.cc for
// --single-process support.
void RendererMainPlatformDelegate::PlatformInitialize() {
- // Initialize NSApplication up front. Without this call, drawing of
- // native UI elements (e.g. buttons) in WebKit will explode.
- [NSApplication sharedApplication];
-
if (![NSThread isMultiThreaded]) {
NSString* string = @"";
[NSThread detachNewThreadSelector:@selector(length)
@@ -209,51 +158,12 @@ bool RendererMainPlatformDelegate::InitSandboxTests(bool no_sandbox) {
}
bool RendererMainPlatformDelegate::EnableSandbox() {
- // rdar://9251340 http://openradar.me/9251340
- // See http://crbug.com/31225 and http://crbug.com/152566
- // To check if this is broken:
- // 1. Enable Multi language input (simplified chinese)
- // 2. Ensure "Show/Hide Trackpad Handwriting" shortcut works.
- // (ctrl+shift+space).
- // 3. Now open a new tab in Google Chrome or start Google Chrome
- // 4. Try ctrl+shift+space shortcut again. Shortcut will not work, IME will
- // either not appear or (worse) not disappear on ctrl-shift-space.
- // (Run `ps aux | grep Chinese` (10.6/10.7) or `ps aux | grep Trackpad`
- // and then kill that pid to make it go away.)
- //
- // Chinese Handwriting was introduced in 10.6 and is confirmed broken on
- // 10.6, 10.7, and 10.8. It's fixed on 10.9.
- bool needs_ime_hack = base::mac::IsOSMountainLionOrEarlier();
-
- if (needs_ime_hack) {
- mach_error_t err = mach_override_ptr(
- (void*)&TISCreateInputSourceList,
- (void*)&CrTISCreateInputSourceList,
- NULL);
- CHECK_EQ(err_none, err);
-
- // Override the private CFLog function so that the console is not spammed
- // by TIS failing to connect to HIServices over XPC.
- err = mach_override_ptr((void*)&CFLog, (void*)&CrRendererCFLog, NULL);
- CHECK_EQ(err_none, err);
- }
-
// Enable the sandbox.
bool sandbox_initialized = InitializeSandbox();
- if (needs_ime_hack) {
- // After the sandbox is initialized, call into TIS. Doing this before
- // the sandbox is in place will open up renderer access to the
- // pasteboard and an XPC connection to "com.apple.hiservices-xpcservice".
- base::ScopedCFTypeRef<TISInputSourceRef> layout_source(
- TISCopyCurrentKeyboardLayoutInputSource());
- base::ScopedCFTypeRef<TISInputSourceRef> input_source(
- TISCopyCurrentKeyboardInputSource());
-
- CFTypeRef source_list[] = { layout_source.get(), input_source.get() };
- g_text_input_services_source_list_ = CFArrayCreate(kCFAllocatorDefault,
- source_list, arraysize(source_list), &kCFTypeArrayCallBacks);
- }
+ // The sandbox is now engaged. Make sure that the renderer has not connected
+ // itself to Cocoa.
+ CHECK(NSApp == nil);
DisconnectCFNotificationCenter();
diff --git a/content/shell/renderer/test_runner/WebTestThemeEngineMac.mm b/content/shell/renderer/test_runner/WebTestThemeEngineMac.mm
index 8a26302..6a3cb70 100644
--- a/content/shell/renderer/test_runner/WebTestThemeEngineMac.mm
+++ b/content/shell/renderer/test_runner/WebTestThemeEngineMac.mm
@@ -51,8 +51,12 @@ static NSWindow* alwaysInactiveWindow = nil;
- (id)initWithActiveControls:(BOOL)_hasActiveControls
{
- self = [super init];
- hasActiveControls = _hasActiveControls;
+ if ((self = [super initWithContentRect:NSMakeRect(0, 0, 100, 100)
+ styleMask:0
+ backing:NSBackingStoreBuffered
+ defer:YES])) {
+ hasActiveControls = _hasActiveControls;
+ }
return self;
}