summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorccameron <ccameron@chromium.org>2015-05-12 00:05:17 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-12 07:05:38 +0000
commitc685e64c0d001f8bba7bd42c711e243bd57d3d59 (patch)
tree1b5fda9f14661d988dae22b55a3a21c88536eedf
parent49d649a34d1a75fc713d333316ef71b098e18df9 (diff)
downloadchromium_src-c685e64c0d001f8bba7bd42c711e243bd57d3d59.zip
chromium_src-c685e64c0d001f8bba7bd42c711e243bd57d3d59.tar.gz
chromium_src-c685e64c0d001f8bba7bd42c711e243bd57d3d59.tar.bz2
Mac: Make content shell work with remote CoreAnimation
Move setting of NSWindowHostsLayersInWindowServer to ContentMainRunnerImpl::Initialize. Use the CoreFoundation API so that it can be called from C code. BUG=450173 Review URL: https://codereview.chromium.org/903943002 Cr-Commit-Position: refs/heads/master@{#329366}
-rw-r--r--chrome/browser/chrome_browser_main_mac.mm8
-rw-r--r--content/app/BUILD.gn2
-rw-r--r--content/app/content_main_runner.cc2
-rw-r--r--content/app/mac/mac_init.h17
-rw-r--r--content/app/mac/mac_init.mm25
-rw-r--r--content/content_app.gypi2
6 files changed, 49 insertions, 7 deletions
diff --git a/chrome/browser/chrome_browser_main_mac.mm b/chrome/browser/chrome_browser_main_mac.mm
index f016458..c097c49 100644
--- a/chrome/browser/chrome_browser_main_mac.mm
+++ b/chrome/browser/chrome_browser_main_mac.mm
@@ -156,13 +156,7 @@ void ChromeBrowserMainPartsMac::PreMainMessageLoopStart() {
// |-application:openFiles:|, since we already handle them directly.
// @"NO" looks like a mistake, but the value really is supposed to be a
// string.
- @"NSTreatUnknownArgumentsAsOpen": @"NO",
- // CoreAnimation has poor performance and CoreAnimation and
- // non-CoreAnimation exhibit window flickering when layers are not hosted
- // in the window server, which is the default when not not using the
- // 10.9 SDK.
- // TODO: Remove this when we build with the 10.9 SDK.
- @"NSWindowHostsLayersInWindowServer": @(base::mac::IsOSMavericksOrLater())
+ @"NSTreatUnknownArgumentsAsOpen": @"NO"
}];
}
diff --git a/content/app/BUILD.gn b/content/app/BUILD.gn
index d775702..6aae696 100644
--- a/content/app/BUILD.gn
+++ b/content/app/BUILD.gn
@@ -16,6 +16,8 @@ content_app_sources = [
"android/library_loader_hooks.h",
"content_main.cc",
"content_main_runner.cc",
+ "mac/mac_init.mm",
+ "mac/mac_init.h",
"mojo/mojo_init.cc",
"mojo/mojo_init.h",
]
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc
index d29618ae..279536b 100644
--- a/content/app/content_main_runner.cc
+++ b/content/app/content_main_runner.cc
@@ -85,6 +85,7 @@
#include "base/mac/scoped_nsautorelease_pool.h"
#if !defined(OS_IOS)
#include "base/power_monitor/power_monitor_device_source.h"
+#include "content/app/mac/mac_init.h"
#include "content/browser/mach_broker_mac.h"
#include "content/common/sandbox_init_mac.h"
#endif // !OS_IOS
@@ -552,6 +553,7 @@ class ContentMainRunnerImpl : public ContentMainRunner {
// app quits. Each "main" needs to flush this pool right before it goes into
// its main event loop to get rid of the cruft.
autorelease_pool_.reset(new base::mac::ScopedNSAutoreleasePool());
+ InitializeMac();
#endif
// On Android, the command line is initialized when library is loaded and
diff --git a/content/app/mac/mac_init.h b/content/app/mac/mac_init.h
new file mode 100644
index 0000000..58e2af7
--- /dev/null
+++ b/content/app/mac/mac_init.h
@@ -0,0 +1,17 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_APP_MAC_MAC_INIT_H_
+#define CONTENT_APP_MAC_MAC_INIT_H_
+
+#include "content/common/content_export.h"
+
+namespace content {
+
+// Perform any necessary Mac initialization.
+CONTENT_EXPORT void InitializeMac();
+
+} // namespace content
+
+#endif // CONTENT_APP_MAC_MAC_INIT_H_
diff --git a/content/app/mac/mac_init.mm b/content/app/mac/mac_init.mm
new file mode 100644
index 0000000..042663c
--- /dev/null
+++ b/content/app/mac/mac_init.mm
@@ -0,0 +1,25 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/app/mac/mac_init.h"
+
+#include <Cocoa/Cocoa.h>
+
+#include "base/mac/mac_util.h"
+
+namespace content {
+
+void InitializeMac() {
+ [[NSUserDefaults standardUserDefaults] registerDefaults:@{
+ @"NSTreatUnknownArgumentsAsOpen": @"NO",
+ // CoreAnimation has poor performance and CoreAnimation and
+ // non-CoreAnimation exhibit window flickering when layers are not hosted
+ // in the window server, which is the default when not not using the
+ // 10.9 SDK.
+ // TODO: Remove this when we build with the 10.9 SDK.
+ @"NSWindowHostsLayersInWindowServer": @(base::mac::IsOSMavericksOrLater())
+ }];
+}
+
+} // namespace content
diff --git a/content/content_app.gypi b/content/content_app.gypi
index 2681899..d7b2b44 100644
--- a/content/content_app.gypi
+++ b/content/content_app.gypi
@@ -29,6 +29,8 @@
'app/android/library_loader_hooks.h',
'app/content_main.cc',
'app/content_main_runner.cc',
+ 'app/mac/mac_init.mm',
+ 'app/mac/mac_init.h',
'app/mojo/mojo_init.cc',
'app/mojo/mojo_init.h',
'public/app/content_jni_onload.h',