Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: blimp/client/app/blimp_startup.cc

Issue 2241623002: blimp: Move compositing, input and render widget feature to client/core. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments from #7 Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <string> 7 #include <string>
8 8
9 #include "base/at_exit.h"
10 #include "base/bind.h"
9 #include "base/command_line.h" 11 #include "base/command_line.h"
10 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
11 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
12 #include "base/logging.h" 14 #include "base/logging.h"
13 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
14 #include "base/path_service.h" 16 #include "base/path_service.h"
15 #include "blimp/client/app/blimp_discardable_memory_allocator.h" 17 #include "blimp/client/app/blimp_discardable_memory_allocator.h"
18 #include "blimp/client/core/blimp_client_switches.h"
16 #include "blimp/client/core/compositor/decoding_image_generator.h" 19 #include "blimp/client/core/compositor/decoding_image_generator.h"
20 #include "blimp/client/public/blimp_client_context.h"
17 #include "third_party/skia/include/core/SkGraphics.h" 21 #include "third_party/skia/include/core/SkGraphics.h"
18 #include "ui/gl/init/gl_factory.h" 22 #include "ui/gl/init/gl_factory.h"
19 23
20 class SkImageGenerator; 24 class SkImageGenerator;
21 25
22 namespace { 26 namespace {
23 base::LazyInstance<std::unique_ptr<base::MessageLoopForUI>> 27 base::LazyInstance<std::unique_ptr<base::MessageLoopForUI>>
24 g_main_message_loop = LAZY_INSTANCE_INITIALIZER; 28 g_main_message_loop = LAZY_INSTANCE_INITIALIZER;
25 29
26 base::LazyInstance<blimp::client::BlimpDiscardableMemoryAllocator> 30 base::LazyInstance<blimp::client::BlimpDiscardableMemoryAllocator>
27 g_discardable_memory_allocator = LAZY_INSTANCE_INITIALIZER; 31 g_discardable_memory_allocator = LAZY_INSTANCE_INITIALIZER;
28 32
29 SkImageGenerator* CreateImageGenerator(SkData* data) { 33 SkImageGenerator* CreateImageGenerator(SkData* data) {
30 return blimp::client::DecodingImageGenerator::create(data); 34 return blimp::client::DecodingImageGenerator::create(data);
31 } 35 }
32 36
37 void TerminateEverything() {
38 blimp::client::BlimpClientContext::Terminate();
39 }
40
33 } // namespace 41 } // namespace
34 42
35 namespace blimp { 43 namespace blimp {
36 namespace client { 44 namespace client {
37 45
38 void InitializeLogging() { 46 void InitializeLogging() {
39 // TODO(haibinlu): Remove this before release. 47 // TODO(haibinlu): Remove this before release.
40 // Enables a few verbose log by default. 48 // Enables a few verbose log by default.
41 if (!base::CommandLine::ForCurrentProcess()->HasSwitch("vmodule")) { 49 if (!base::CommandLine::ForCurrentProcess()->HasSwitch("vmodule")) {
42 std::string vmodule_entries = 50 std::string vmodule_entries =
(...skipping 27 matching lines...) Expand all
70 bool InitializeMainMessageLoop() { 78 bool InitializeMainMessageLoop() {
71 // TODO(dtrainor): Initialize ICU? 79 // TODO(dtrainor): Initialize ICU?
72 80
73 // Set the DiscardableMemoryAllocator. 81 // Set the DiscardableMemoryAllocator.
74 base::DiscardableMemoryAllocator::SetInstance( 82 base::DiscardableMemoryAllocator::SetInstance(
75 g_discardable_memory_allocator.Pointer()); 83 g_discardable_memory_allocator.Pointer());
76 if (!gl::init::InitializeGLOneOff()) 84 if (!gl::init::InitializeGLOneOff())
77 return false; 85 return false;
78 SkGraphics::Init(); 86 SkGraphics::Init();
79 SkGraphics::SetImageGeneratorFromEncodedFactory(CreateImageGenerator); 87 SkGraphics::SetImageGeneratorFromEncodedFactory(CreateImageGenerator);
88 base::CommandLine::ForCurrentProcess()->AppendSwitch(
89 switches::kUseInternalDisplay);
90 BlimpClientContext::Initialize();
91 base::AtExitManager::RegisterTask(base::Bind(&TerminateEverything));
80 g_main_message_loop.Get().reset(new base::MessageLoopForUI); 92 g_main_message_loop.Get().reset(new base::MessageLoopForUI);
81 return true; 93 return true;
82 } 94 }
83 95
84 } // namespace client 96 } // namespace client
85 } // namespace blimp 97 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698