OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import <UIKit/UIKit.h> |
| 6 #include <asl.h> |
| 7 #import "sky_app_delegate.h" |
| 8 #include "base/at_exit.h" |
| 9 #include "base/logging.h" |
| 10 #include "base/i18n/icu_util.h" |
| 11 #include "base/command_line.h" |
| 12 #include "base/mac/scoped_nsautorelease_pool.h" |
| 13 #include "ui/gl/gl_surface.h" |
| 14 |
| 15 static void InitializeLogging() { |
| 16 logging::LoggingSettings settings; |
| 17 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
| 18 logging::InitLogging(settings); |
| 19 logging::SetLogItems(false, // Process ID |
| 20 false, // Thread ID |
| 21 false, // Timestamp |
| 22 false); // Tick count |
| 23 } |
| 24 |
| 25 static void RedirectIOConnectionsToSyslog() { |
| 26 asl_log_descriptor(NULL, NULL, ASL_LEVEL_INFO, STDOUT_FILENO, |
| 27 ASL_LOG_DESCRIPTOR_WRITE); |
| 28 asl_log_descriptor(NULL, NULL, ASL_LEVEL_NOTICE, STDERR_FILENO, |
| 29 ASL_LOG_DESCRIPTOR_WRITE); |
| 30 } |
| 31 |
| 32 #ifndef NDEBUG |
| 33 |
| 34 static void SkyDebuggerHookMain(void) { |
| 35 // By default, LLDB breaks way too early. This is before libraries have been |
| 36 // loaded and __attribute__((constructor)) methods have been called. In most |
| 37 // situations, this is unnecessary. Also, breakpoint resolution is not |
| 38 // immediate. So we provide this hook to break on. |
| 39 } |
| 40 |
| 41 #endif |
| 42 |
| 43 int main(int argc, char* argv[]) { |
| 44 #ifndef NDEBUG |
| 45 SkyDebuggerHookMain(); |
| 46 #endif |
| 47 base::mac::ScopedNSAutoreleasePool pool; |
| 48 base::AtExitManager exit_manager; |
| 49 RedirectIOConnectionsToSyslog(); |
| 50 auto result = false; |
| 51 result = base::CommandLine::Init(0, nullptr); |
| 52 DLOG_ASSERT(result); |
| 53 InitializeLogging(); |
| 54 result = base::i18n::InitializeICU(); |
| 55 DLOG_ASSERT(result); |
| 56 result = gfx::GLSurface::InitializeOneOff(); |
| 57 DLOG_ASSERT(result); |
| 58 return UIApplicationMain(argc, argv, nil, |
| 59 NSStringFromClass([SkyAppDelegate class])); |
| 60 } |
OLD | NEW |