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

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

Issue 2542083004: Make //blimp/client/app a real embedder of //blimp/client/public (Closed)
Patch Set: Fix findbugs issue Created 4 years 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
« no previous file with comments | « blimp/client/app/blimp_startup.h ('k') | blimp/client/app/compositor/browser_compositor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "blimp/client/app/blimp_discardable_memory_allocator.h" 15 #include "blimp/client/app/blimp_discardable_memory_allocator.h"
16 #include "blimp/client/core/compositor/decoding_image_generator.h"
17 #include "third_party/skia/include/core/SkGraphics.h" 16 #include "third_party/skia/include/core/SkGraphics.h"
18 #include "ui/base/resource/resource_bundle.h" 17 #include "ui/base/resource/resource_bundle.h"
19 #include "ui/gl/init/gl_factory.h" 18 #include "ui/gl/init/gl_factory.h"
20 19
21 class SkImageGenerator; 20 class SkImageGenerator;
22 21
23 namespace { 22 namespace {
24 base::LazyInstance<std::unique_ptr<base::MessageLoopForUI>> 23 base::LazyInstance<std::unique_ptr<base::MessageLoopForUI>>
25 g_main_message_loop = LAZY_INSTANCE_INITIALIZER; 24 g_main_message_loop = LAZY_INSTANCE_INITIALIZER;
26 25
27 base::LazyInstance<blimp::client::BlimpDiscardableMemoryAllocator> 26 base::LazyInstance<blimp::client::BlimpDiscardableMemoryAllocator>
28 g_discardable_memory_allocator = LAZY_INSTANCE_INITIALIZER; 27 g_discardable_memory_allocator = LAZY_INSTANCE_INITIALIZER;
29 28
30 SkImageGenerator* CreateImageGenerator(SkData* data) {
31 return blimp::client::DecodingImageGenerator::create(data);
32 }
33
34 } // namespace 29 } // namespace
35 30
36 namespace blimp { 31 namespace blimp {
37 namespace client { 32 namespace client {
38 33
39 void InitializeLogging() { 34 void InitializeLogging() {
40 // TODO(haibinlu): Remove this before release. 35 // TODO(haibinlu): Remove this before release.
41 // Enables a few verbose log by default. 36 // Enables a few verbose log by default.
42 if (!base::CommandLine::ForCurrentProcess()->HasSwitch("vmodule")) { 37 if (!base::CommandLine::ForCurrentProcess()->HasSwitch("vmodule")) {
43 std::string vmodule_entries = 38 std::string vmodule_entries =
44 "blimp_message_pump=1, blimp_connection=1," 39 "blimp_message_pump=1, blimp_connection=1,"
45 "blimp_compositor=1, blimp_compositor_manager=1," 40 "blimp_compositor=1, blimp_compositor_manager=1,"
46 "remote_channel_impl=1, blimp_client_session=1"; 41 "remote_channel_impl=1";
47 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII("vmodule", 42 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII("vmodule",
48 vmodule_entries); 43 vmodule_entries);
49 } 44 }
50 45
51 logging::LoggingSettings settings; 46 logging::LoggingSettings settings;
52 #if defined(OS_ANDROID) 47 #if defined(OS_ANDROID)
53 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; 48 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
54 #else 49 #else
55 base::FilePath log_filename; 50 base::FilePath log_filename;
56 PathService::Get(base::DIR_EXE, &log_filename); 51 PathService::Get(base::DIR_EXE, &log_filename);
(...skipping 13 matching lines...) Expand all
70 65
71 bool InitializeMainMessageLoop() { 66 bool InitializeMainMessageLoop() {
72 // TODO(dtrainor): Initialize ICU? 67 // TODO(dtrainor): Initialize ICU?
73 68
74 // Set the DiscardableMemoryAllocator. 69 // Set the DiscardableMemoryAllocator.
75 base::DiscardableMemoryAllocator::SetInstance( 70 base::DiscardableMemoryAllocator::SetInstance(
76 g_discardable_memory_allocator.Pointer()); 71 g_discardable_memory_allocator.Pointer());
77 if (!gl::init::InitializeGLOneOff()) 72 if (!gl::init::InitializeGLOneOff())
78 return false; 73 return false;
79 SkGraphics::Init(); 74 SkGraphics::Init();
80 SkGraphics::SetImageGeneratorFromEncodedFactory(CreateImageGenerator);
81 g_main_message_loop.Get().reset(new base::MessageLoopForUI); 75 g_main_message_loop.Get().reset(new base::MessageLoopForUI);
82 return true; 76 return true;
83 } 77 }
84 78
85 void InitializeResourceBundle() {
86 // Load the pak file for the shell.
87 base::FilePath pak_file;
88 bool pak_file_valid = base::PathService::Get(base::DIR_MODULE, &pak_file);
89 CHECK(pak_file_valid);
90 pak_file = pak_file.Append(FILE_PATH_LITERAL("blimp_shell.pak"));
91 ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file);
92 }
93
94 } // namespace client 79 } // namespace client
95 } // namespace blimp 80 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/client/app/blimp_startup.h ('k') | blimp/client/app/compositor/browser_compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698