| 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/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "blimp/client/app/blimp_discardable_memory_allocator.h" | 12 #include "blimp/client/app/blimp_discardable_memory_allocator.h" |
| 13 #include "blimp/client/feature/compositor/decoding_image_generator.h" |
| 13 #include "third_party/skia/include/core/SkGraphics.h" | 14 #include "third_party/skia/include/core/SkGraphics.h" |
| 14 #include "ui/gl/gl_surface.h" | 15 #include "ui/gl/gl_surface.h" |
| 15 | 16 |
| 17 class SkImageGenerator; |
| 18 |
| 16 namespace { | 19 namespace { |
| 17 base::LazyInstance<scoped_ptr<base::MessageLoopForUI>> g_main_message_loop = | 20 base::LazyInstance<scoped_ptr<base::MessageLoopForUI>> g_main_message_loop = |
| 18 LAZY_INSTANCE_INITIALIZER; | 21 LAZY_INSTANCE_INITIALIZER; |
| 19 | 22 |
| 20 base::LazyInstance<blimp::client::BlimpDiscardableMemoryAllocator> | 23 base::LazyInstance<blimp::client::BlimpDiscardableMemoryAllocator> |
| 21 g_discardable_memory_allocator = LAZY_INSTANCE_INITIALIZER; | 24 g_discardable_memory_allocator = LAZY_INSTANCE_INITIALIZER; |
| 25 |
| 26 SkImageGenerator* CreateImageGenerator(SkData* data) { |
| 27 return blimp::client::DecodingImageGenerator::create(data); |
| 22 } | 28 } |
| 23 | 29 |
| 30 } // namespace |
| 31 |
| 24 namespace blimp { | 32 namespace blimp { |
| 25 namespace client { | 33 namespace client { |
| 26 | 34 |
| 27 void InitializeLogging() { | 35 void InitializeLogging() { |
| 28 logging::LoggingSettings settings; | 36 logging::LoggingSettings settings; |
| 29 #if defined(OS_ANDROID) | 37 #if defined(OS_ANDROID) |
| 30 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 38 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
| 31 #else | 39 #else |
| 32 base::FilePath log_filename; | 40 base::FilePath log_filename; |
| 33 PathService::Get(base::DIR_EXE, &log_filename); | 41 PathService::Get(base::DIR_EXE, &log_filename); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 47 | 55 |
| 48 bool InitializeMainMessageLoop() { | 56 bool InitializeMainMessageLoop() { |
| 49 // TODO(dtrainor): Initialize ICU? | 57 // TODO(dtrainor): Initialize ICU? |
| 50 | 58 |
| 51 // Set the DiscardableMemoryAllocator. | 59 // Set the DiscardableMemoryAllocator. |
| 52 base::DiscardableMemoryAllocator::SetInstance( | 60 base::DiscardableMemoryAllocator::SetInstance( |
| 53 g_discardable_memory_allocator.Pointer()); | 61 g_discardable_memory_allocator.Pointer()); |
| 54 if (!gfx::GLSurface::InitializeOneOff()) | 62 if (!gfx::GLSurface::InitializeOneOff()) |
| 55 return false; | 63 return false; |
| 56 SkGraphics::Init(); | 64 SkGraphics::Init(); |
| 65 SkGraphics::SetImageGeneratorFromEncodedFactory(CreateImageGenerator); |
| 57 g_main_message_loop.Get().reset(new base::MessageLoopForUI); | 66 g_main_message_loop.Get().reset(new base::MessageLoopForUI); |
| 58 return true; | 67 return true; |
| 59 } | 68 } |
| 60 | 69 |
| 61 } // namespace client | 70 } // namespace client |
| 62 } // namespace blimp | 71 } // namespace blimp |
| OLD | NEW |