| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "mojo/runner/init.h" | 5 #include "mojo/runner/init.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/debugger.h" | 9 #include "base/debug/debugger.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/i18n/icu_util.h" |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
| 13 #include "base/strings/string_split.h" | 14 #include "base/strings/string_split.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 15 #include "mojo/runner/host/switches.h" | 16 #include "mojo/runner/host/switches.h" |
| 16 | 17 |
| 17 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
| 18 #include <windows.h> | 19 #include <windows.h> |
| 19 #elif (OS_POSIX) | 20 #elif (OS_POSIX) |
| 20 #include <unistd.h> | 21 #include <unistd.h> |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 base::string16 appw = base::UTF8ToUTF16(app); | 54 base::string16 appw = base::UTF8ToUTF16(app); |
| 54 MessageBox(NULL, appw.c_str(), appw.c_str(), MB_OK | MB_SETFOREGROUND); | 55 MessageBox(NULL, appw.c_str(), appw.c_str(), MB_OK | MB_SETFOREGROUND); |
| 55 #else | 56 #else |
| 56 LOG(ERROR) << app << " waiting for GDB. pid: " << getpid(); | 57 LOG(ERROR) << app << " waiting for GDB. pid: " << getpid(); |
| 57 base::debug::WaitForDebugger(60, true); | 58 base::debug::WaitForDebugger(60, true); |
| 58 #endif | 59 #endif |
| 59 } | 60 } |
| 60 } | 61 } |
| 61 } | 62 } |
| 62 | 63 |
| 64 void CallLibraryEarlyInitialization(base::NativeLibrary app_library) { |
| 65 // Do whatever warming that the mojo application wants. |
| 66 typedef void (*LibraryEarlyInitFunction)(const uint8*); |
| 67 LibraryEarlyInitFunction init_function = |
| 68 reinterpret_cast<LibraryEarlyInitFunction>( |
| 69 base::GetFunctionPointerFromNativeLibrary(app_library, |
| 70 "InitializeBase")); |
| 71 if (init_function) { |
| 72 // Get the ICU data that we prewarmed in the runner and then pass it to |
| 73 // the copy of icu in the mojo binary that we're running. |
| 74 const uint8* icu_data = base::i18n::GetRawIcuMemory(); |
| 75 init_function(icu_data); |
| 76 } |
| 77 |
| 78 // TODO(erg): All chromium binaries load base. We might want to make a |
| 79 // general system for other people. |
| 80 } |
| 81 |
| 63 } // namespace runner | 82 } // namespace runner |
| 64 } // namespace mojo | 83 } // namespace mojo |
| OLD | NEW |