Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 "blimp/client/app/blimp_startup.h" | 5 #include "blimp/client/app/blimp_startup.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | |
| 7 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 8 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 9 #include "base/logging.h" | 10 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 11 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 12 #include "blimp/client/app/blimp_discardable_memory_allocator.h" | 13 #include "blimp/client/app/blimp_discardable_memory_allocator.h" |
| 13 #include "blimp/client/feature/compositor/decoding_image_generator.h" | 14 #include "blimp/client/feature/compositor/decoding_image_generator.h" |
| 14 #include "third_party/skia/include/core/SkGraphics.h" | 15 #include "third_party/skia/include/core/SkGraphics.h" |
| 15 #include "ui/gl/gl_surface.h" | 16 #include "ui/gl/gl_surface.h" |
| 16 | 17 |
| 17 class SkImageGenerator; | 18 class SkImageGenerator; |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 base::LazyInstance<scoped_ptr<base::MessageLoopForUI>> g_main_message_loop = | 21 base::LazyInstance<scoped_ptr<base::MessageLoopForUI>> g_main_message_loop = |
| 21 LAZY_INSTANCE_INITIALIZER; | 22 LAZY_INSTANCE_INITIALIZER; |
| 22 | 23 |
| 23 base::LazyInstance<blimp::client::BlimpDiscardableMemoryAllocator> | 24 base::LazyInstance<blimp::client::BlimpDiscardableMemoryAllocator> |
| 24 g_discardable_memory_allocator = LAZY_INSTANCE_INITIALIZER; | 25 g_discardable_memory_allocator = LAZY_INSTANCE_INITIALIZER; |
| 25 | 26 |
| 26 SkImageGenerator* CreateImageGenerator(SkData* data) { | 27 SkImageGenerator* CreateImageGenerator(SkData* data) { |
| 27 return blimp::client::DecodingImageGenerator::create(data); | 28 return blimp::client::DecodingImageGenerator::create(data); |
| 28 } | 29 } |
| 29 | 30 |
| 30 } // namespace | 31 } // namespace |
| 31 | 32 |
| 32 namespace blimp { | 33 namespace blimp { |
| 33 namespace client { | 34 namespace client { |
| 34 | 35 |
| 35 void InitializeLogging() { | 36 void InitializeLogging() { |
| 37 // TODO(haibinlu): Remove this before release. | |
| 38 // Enables a few verbose log by default. | |
| 39 if (!base::CommandLine::ForCurrentProcess()->HasSwitch("vmodule")) { | |
| 40 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | |
| 41 "vmodule", "blimp_message_pump=1, blimp_connection=1"); | |
|
Khushal
2016/03/29 21:10:04
Should this be *blimp*? I think we have bugs for a
Kevin M
2016/03/29 21:11:45
I don't think blimp* is a good choice because we h
haibinlu1
2016/03/29 21:11:47
there will be way too many logs. feature shall cha
| |
| 42 } | |
| 43 | |
| 36 logging::LoggingSettings settings; | 44 logging::LoggingSettings settings; |
| 37 #if defined(OS_ANDROID) | 45 #if defined(OS_ANDROID) |
| 38 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 46 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
| 39 #else | 47 #else |
| 40 base::FilePath log_filename; | 48 base::FilePath log_filename; |
| 41 PathService::Get(base::DIR_EXE, &log_filename); | 49 PathService::Get(base::DIR_EXE, &log_filename); |
| 42 log_filename = log_filename.AppendASCII("blimp_client.log"); | 50 log_filename = log_filename.AppendASCII("blimp_client.log"); |
| 43 settings.logging_dest = logging::LOG_TO_ALL; | 51 settings.logging_dest = logging::LOG_TO_ALL; |
| 44 settings.log_file = log_filename.value().c_str(); | 52 settings.log_file = log_filename.value().c_str(); |
| 45 settings.delete_old = logging::DELETE_OLD_LOG_FILE; | 53 settings.delete_old = logging::DELETE_OLD_LOG_FILE; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 62 if (!gfx::GLSurface::InitializeOneOff()) | 70 if (!gfx::GLSurface::InitializeOneOff()) |
| 63 return false; | 71 return false; |
| 64 SkGraphics::Init(); | 72 SkGraphics::Init(); |
| 65 SkGraphics::SetImageGeneratorFromEncodedFactory(CreateImageGenerator); | 73 SkGraphics::SetImageGeneratorFromEncodedFactory(CreateImageGenerator); |
| 66 g_main_message_loop.Get().reset(new base::MessageLoopForUI); | 74 g_main_message_loop.Get().reset(new base::MessageLoopForUI); |
| 67 return true; | 75 return true; |
| 68 } | 76 } |
| 69 | 77 |
| 70 } // namespace client | 78 } // namespace client |
| 71 } // namespace blimp | 79 } // namespace blimp |
| OLD | NEW |