| OLD | NEW |
| 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/renderer/renderer_main_platform_delegate.h" | 5 #include "content/renderer/renderer_main_platform_delegate.h" |
| 6 | 6 |
| 7 #include <Carbon/Carbon.h> | 7 #include <Carbon/Carbon.h> |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 #include <objc/runtime.h> | 9 #include <objc/runtime.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 RendererMainPlatformDelegate::RendererMainPlatformDelegate( | 109 RendererMainPlatformDelegate::RendererMainPlatformDelegate( |
| 110 const MainFunctionParams& parameters) {} | 110 const MainFunctionParams& parameters) {} |
| 111 | 111 |
| 112 RendererMainPlatformDelegate::~RendererMainPlatformDelegate() { | 112 RendererMainPlatformDelegate::~RendererMainPlatformDelegate() { |
| 113 } | 113 } |
| 114 | 114 |
| 115 // TODO(mac-port): Any code needed to initialize a process for purposes of | 115 // TODO(mac-port): Any code needed to initialize a process for purposes of |
| 116 // running a renderer needs to also be reflected in chrome_main.cc for | 116 // running a renderer needs to also be reflected in chrome_main.cc for |
| 117 // --single-process support. | 117 // --single-process support. |
| 118 void RendererMainPlatformDelegate::PlatformInitialize() { | 118 void RendererMainPlatformDelegate::PlatformInitialize() { |
| 119 if (base::mac::IsAtLeastOS10_10()) { | |
| 120 // This is needed by the NSAnimations run for the scrollbars. If we switch | |
| 121 // from native scrollers to drawing them in some other way, this warmup can | |
| 122 // be removed <http://crbug.com/306348>. | |
| 123 [NSScreen screens]; | |
| 124 } | |
| 125 | |
| 126 if (![NSThread isMultiThreaded]) { | 119 if (![NSThread isMultiThreaded]) { |
| 127 NSString* string = @""; | 120 NSString* string = @""; |
| 128 [NSThread detachNewThreadSelector:@selector(length) | 121 [NSThread detachNewThreadSelector:@selector(length) |
| 129 toTarget:string | 122 toTarget:string |
| 130 withObject:nil]; | 123 withObject:nil]; |
| 131 } | 124 } |
| 132 } | 125 } |
| 133 | 126 |
| 134 void RendererMainPlatformDelegate::PlatformUninitialize() { | 127 void RendererMainPlatformDelegate::PlatformUninitialize() { |
| 135 } | 128 } |
| 136 | 129 |
| 137 bool RendererMainPlatformDelegate::EnableSandbox() { | 130 bool RendererMainPlatformDelegate::EnableSandbox() { |
| 138 // Enable the sandbox. | 131 // Enable the sandbox. |
| 139 bool sandbox_initialized = InitializeSandbox(); | 132 bool sandbox_initialized = InitializeSandbox(); |
| 140 | 133 |
| 141 // The sandbox is now engaged. Make sure that the renderer has not connected | 134 // The sandbox is now engaged. Make sure that the renderer has not connected |
| 142 // itself to Cocoa. | 135 // itself to Cocoa. |
| 143 CHECK(NSApp == nil); | 136 CHECK(NSApp == nil); |
| 144 | 137 |
| 145 DisconnectCFNotificationCenter(); | 138 DisconnectCFNotificationCenter(); |
| 146 | 139 |
| 147 return sandbox_initialized; | 140 return sandbox_initialized; |
| 148 } | 141 } |
| 149 | 142 |
| 150 } // namespace content | 143 } // namespace content |
| OLD | NEW |