Index: blimp/client/blimp_startup.cc |
diff --git a/blimp/client/blimp_startup.cc b/blimp/client/blimp_startup.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8e51b28cfd2bf5076eb8b4b2b4b706cbcbb7d47d |
--- /dev/null |
+++ b/blimp/client/blimp_startup.cc |
@@ -0,0 +1,53 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "blimp/client/blimp_startup.h" |
+ |
+#include "base/files/file_path.h" |
+#include "base/lazy_instance.h" |
+#include "base/logging.h" |
+#include "base/message_loop/message_loop.h" |
+#include "base/path_service.h" |
+#include "third_party/skia/include/core/SkGraphics.h" |
+#include "ui/gl/gl_surface.h" |
+ |
+namespace { |
+base::LazyInstance<scoped_ptr<base::MessageLoopForUI>> g_main_message_loop = |
+ LAZY_INSTANCE_INITIALIZER; |
Wez
2016/01/05 19:15:02
Add a comment to explain the purpose of this membe
|
+} |
+ |
+namespace blimp { |
+ |
+void InitializeLogging() { |
+ logging::LoggingSettings settings; |
+#if defined(OS_ANDROID) |
+ settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
+#else |
+ base::FilePath log_filename; |
+ PathService::Get(base::DIR_EXE, &log_filename); |
+ log_filename = log_filename.AppendASCII("blimp_client.log"); |
+ settings.logging_dest = logging::LOG_TO_ALL; |
+ settings.log_file = log_filename.value().c_str(); |
+ settings.delete_old = logging::DELETE_OLD_LOG_FILE; |
+#endif // OS_ANDROID |
+ logging::InitLogging(settings); |
+ logging::SetLogItems(false, // Process ID |
nyquist
2015/12/17 03:00:21
Why do we not want to log the process and thread I
Wez
2016/01/05 19:15:02
This is blimp_client logging initialization - ther
|
+ false, // Thread ID |
+ false, // Timestamp |
+ false); // Tick count |
+ VLOG(0) << "Chromium logging enabled: level = " << logging::GetMinLogLevel() |
+ << ", default verbosity = " << logging::GetVlogVerbosity(); |
+} |
+ |
+bool InitializeMainMessageLoop() { |
+ // TODO(dtrainor): Initialize ICU? |
Wez
2016/01/05 19:15:02
Clarify why we might need to initialize ICU here.
|
+ |
Wez
2016/01/05 19:15:02
nit: Remove the spurious blank line.
|
+ if (!gfx::GLSurface::InitializeOneOff()) |
+ return false; |
+ SkGraphics::Init(); |
Wez
2016/01/05 19:15:02
The function name is InitializeMainMessageLoop, bu
|
+ g_main_message_loop.Get().reset(new base::MessageLoopForUI); |
+ return true; |
+} |
+ |
+} // namespace blimp |