OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #if defined(OS_MACOSX) | |
6 #include <signal.h> | |
7 #include <unistd.h> | |
8 #endif // OS_MACOSX | |
9 | |
10 #include "base/command_line.h" | 5 #include "base/command_line.h" |
11 #include "base/debug/trace_event.h" | 6 #include "base/debug/trace_event.h" |
12 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
13 #include "base/mac/scoped_nsautorelease_pool.h" | 8 #include "base/mac/scoped_nsautorelease_pool.h" |
14 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
15 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
16 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
17 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
18 #include "base/metrics/stats_counters.h" | 13 #include "base/metrics/stats_counters.h" |
19 #include "base/path_service.h" | 14 #include "base/path_service.h" |
20 #include "base/process_util.h" | 15 #include "base/process_util.h" |
21 #include "base/string_util.h" | 16 #include "base/string_util.h" |
22 #include "base/system_monitor/system_monitor.h" | 17 #include "base/system_monitor/system_monitor.h" |
23 #include "base/threading/platform_thread.h" | 18 #include "base/threading/platform_thread.h" |
24 #include "base/time.h" | 19 #include "base/time.h" |
25 #include "content/common/content_counters.h" | 20 #include "content/common/content_counters.h" |
26 #include "content/common/content_switches.h" | 21 #include "content/common/content_switches.h" |
27 #include "content/common/main_function_params.h" | 22 #include "content/common/main_function_params.h" |
28 #include "content/common/hi_res_timer_manager.h" | 23 #include "content/common/hi_res_timer_manager.h" |
29 #include "content/common/pepper_plugin_registry.h" | 24 #include "content/common/pepper_plugin_registry.h" |
30 #include "content/renderer/render_process_impl.h" | 25 #include "content/renderer/render_process_impl.h" |
31 #include "content/renderer/render_thread.h" | 26 #include "content/renderer/render_thread.h" |
32 #include "content/renderer/renderer_main_platform_delegate.h" | 27 #include "content/renderer/renderer_main_platform_delegate.h" |
33 #include "ui/base/ui_base_switches.h" | 28 #include "ui/base/ui_base_switches.h" |
34 | 29 |
35 #if defined(OS_MACOSX) | 30 #if defined(OS_MACOSX) |
36 #include <Carbon/Carbon.h> // TISCreateInputSourceList | 31 #include <Carbon/Carbon.h> |
| 32 #include <signal.h> |
| 33 #include <unistd.h> |
37 | 34 |
38 #include "base/sys_info.h" | 35 #include "base/mac/mac_util.h" |
39 #include "third_party/mach_override/mach_override.h" | 36 #include "third_party/mach_override/mach_override.h" |
40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 37 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
41 #endif // OS_MACOSX | 38 #endif // OS_MACOSX |
42 | 39 |
43 #if defined(OS_MACOSX) | 40 #if defined(OS_MACOSX) |
44 namespace { | 41 namespace { |
45 | 42 |
46 CFArrayRef ChromeTISCreateInputSourceList( | 43 CFArrayRef ChromeTISCreateInputSourceList( |
47 CFDictionaryRef properties, | 44 CFDictionaryRef properties, |
48 Boolean includeAllInstalled) { | 45 Boolean includeAllInstalled) { |
49 CFTypeRef values[] = { CFSTR("") }; | 46 CFTypeRef values[] = { CFSTR("") }; |
50 return CFArrayCreate( | 47 return CFArrayCreate( |
51 kCFAllocatorDefault, values, arraysize(values), &kCFTypeArrayCallBacks); | 48 kCFAllocatorDefault, values, arraysize(values), &kCFTypeArrayCallBacks); |
52 } | 49 } |
53 | 50 |
54 void InstallFrameworkHacks() { | 51 void InstallFrameworkHacks() { |
55 int32 os_major, os_minor, os_bugfix; | |
56 base::SysInfo::OperatingSystemVersionNumbers( | |
57 &os_major, &os_minor, &os_bugfix); | |
58 | |
59 // See http://crbug.com/31225 | 52 // See http://crbug.com/31225 |
60 // TODO: Don't do this on newer OS X revisions that have a fix for | 53 // TODO: Don't do this on newer OS X revisions that have a fix for |
61 // http://openradar.appspot.com/radar?id=1156410 | 54 // http://openradar.appspot.com/radar?id=1156410 |
62 if (os_major == 10 && os_minor >= 6) { | 55 if (base::mac::IsOSSnowLeopardOrLater()) { |
63 // Chinese Handwriting was introduced in 10.6. Since doing this override | 56 // Chinese Handwriting was introduced in 10.6. Since doing this override |
64 // regresses page cycler memory usage on 10.5, don't do the unnecessary | 57 // regresses page cycler memory usage on 10.5, don't do the unnecessary |
65 // override there. | 58 // override there. |
66 mach_error_t err = mach_override_ptr( | 59 mach_error_t err = mach_override_ptr( |
67 (void*)&TISCreateInputSourceList, | 60 (void*)&TISCreateInputSourceList, |
68 (void*)&ChromeTISCreateInputSourceList, | 61 (void*)&ChromeTISCreateInputSourceList, |
69 NULL); | 62 NULL); |
70 CHECK_EQ(err_none, err); | 63 CHECK_EQ(err_none, err); |
71 } | 64 } |
72 } | 65 } |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 pool->Recycle(); | 226 pool->Recycle(); |
234 TRACE_EVENT_BEGIN_ETW("RendererMain.START_MSG_LOOP", 0, 0); | 227 TRACE_EVENT_BEGIN_ETW("RendererMain.START_MSG_LOOP", 0, 0); |
235 MessageLoop::current()->Run(); | 228 MessageLoop::current()->Run(); |
236 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); | 229 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); |
237 } | 230 } |
238 } | 231 } |
239 platform.PlatformUninitialize(); | 232 platform.PlatformUninitialize(); |
240 TRACE_EVENT_END_ETW("RendererMain", 0, ""); | 233 TRACE_EVENT_END_ETW("RendererMain", 0, ""); |
241 return 0; | 234 return 0; |
242 } | 235 } |
OLD | NEW |