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 #include "blimp/client/blimp_startup.h" | |
6 | |
7 #include "base/files/file_path.h" | |
8 #include "base/lazy_instance.h" | |
9 #include "base/logging.h" | |
10 #include "base/message_loop/message_loop.h" | |
11 #include "base/path_service.h" | |
12 #include "third_party/skia/include/core/SkGraphics.h" | |
13 #include "ui/gl/gl_surface.h" | |
14 | |
15 namespace { | |
16 base::LazyInstance<scoped_ptr<base::MessageLoopForUI>> g_main_message_loop = | |
17 LAZY_INSTANCE_INITIALIZER; | |
18 } | |
19 | |
20 namespace blimp { | |
21 namespace client { | |
22 | |
23 void InitializeLogging() { | |
24 logging::LoggingSettings settings; | |
25 #if defined(OS_ANDROID) | |
26 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | |
27 #else | |
28 base::FilePath log_filename; | |
29 PathService::Get(base::DIR_EXE, &log_filename); | |
30 log_filename = log_filename.AppendASCII("blimp_client.log"); | |
31 settings.logging_dest = logging::LOG_TO_ALL; | |
32 settings.log_file = log_filename.value().c_str(); | |
33 settings.delete_old = logging::DELETE_OLD_LOG_FILE; | |
34 #endif // OS_ANDROID | |
35 logging::InitLogging(settings); | |
36 logging::SetLogItems(false, // Process ID | |
37 false, // Thread ID | |
38 false, // Timestamp | |
39 false); // Tick count | |
40 VLOG(0) << "Chromium logging enabled: level = " << logging::GetMinLogLevel() | |
41 << ", default verbosity = " << logging::GetVlogVerbosity(); | |
42 } | |
43 | |
44 bool InitializeMainMessageLoop() { | |
45 // TODO(dtrainor): Initialize ICU? | |
46 | |
47 if (!gfx::GLSurface::InitializeOneOff()) | |
48 return false; | |
49 SkGraphics::Init(); | |
50 g_main_message_loop.Get().reset(new base::MessageLoopForUI); | |
51 return true; | |
52 } | |
53 | |
54 } // namespace client | |
55 } // namespace blimp | |
OLD | NEW |