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

Side by Side Diff: components/html_viewer/global_state.cc

Issue 1304893008: Adds a common way to initialize logging (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « components/html_viewer/DEPS ('k') | mandoline/services/core_services/BUILD.gn » ('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 "components/html_viewer/global_state.h" 5 #include "components/html_viewer/global_state.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/i18n/icu_util.h" 11 #include "base/i18n/icu_util.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "components/html_viewer/blink_platform_impl.h" 13 #include "components/html_viewer/blink_platform_impl.h"
14 #include "components/html_viewer/media_factory.h" 14 #include "components/html_viewer/media_factory.h"
15 #include "components/scheduler/renderer/renderer_scheduler.h" 15 #include "components/scheduler/renderer/renderer_scheduler.h"
16 #include "gin/v8_initializer.h" 16 #include "gin/v8_initializer.h"
17 #include "mojo/application/public/cpp/application_impl.h" 17 #include "mojo/application/public/cpp/application_impl.h"
18 #include "mojo/logging/init_logging.h"
18 #include "third_party/WebKit/public/web/WebKit.h" 19 #include "third_party/WebKit/public/web/WebKit.h"
19 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" 20 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
20 #include "ui/base/resource/resource_bundle.h" 21 #include "ui/base/resource/resource_bundle.h"
21 #include "ui/base/ui_base_paths.h" 22 #include "ui/base/ui_base_paths.h"
22 #include "ui/mojo/init/ui_init.h" 23 #include "ui/mojo/init/ui_init.h"
23 #include "v8/include/v8.h" 24 #include "v8/include/v8.h"
24 25
25 #if defined(OS_LINUX) && !defined(OS_ANDROID) 26 #if defined(OS_LINUX) && !defined(OS_ANDROID)
26 #include "components/font_service/public/cpp/font_loader.h" 27 #include "components/font_service/public/cpp/font_loader.h"
27 #endif 28 #endif
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 resource_loader_.ReleaseFile(kResourceNativesBlob).TakePlatformFile(), 0u, 116 resource_loader_.ReleaseFile(kResourceNativesBlob).TakePlatformFile(), 0u,
116 0u); 117 0u);
117 #endif 118 #endif
118 blink::initialize(blink_platform_.get()); 119 blink::initialize(blink_platform_.get());
119 base::i18n::InitializeICUWithFileDescriptor( 120 base::i18n::InitializeICUWithFileDescriptor(
120 resource_loader_.GetICUFile().TakePlatformFile(), 121 resource_loader_.GetICUFile().TakePlatformFile(),
121 base::MemoryMappedFile::Region::kWholeFile); 122 base::MemoryMappedFile::Region::kWholeFile);
122 123
123 ui::RegisterPathProvider(); 124 ui::RegisterPathProvider();
124 125
126 mojo::logging::InitLogging();
127
125 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 128 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
126 129
127 logging::LoggingSettings settings;
128 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
129 logging::InitLogging(settings);
130 // Display process ID, thread ID and timestamp in logs.
131 logging::SetLogItems(true, true, true, false);
132
133 if (command_line->HasSwitch(kDisableEncryptedMedia)) 130 if (command_line->HasSwitch(kDisableEncryptedMedia))
134 blink::WebRuntimeFeatures::enableEncryptedMedia(false); 131 blink::WebRuntimeFeatures::enableEncryptedMedia(false);
135 132
136 if (!is_headless_) { 133 if (!is_headless_) {
137 base::File pak_file = resource_loader_.ReleaseFile(kResourceResourcesPak); 134 base::File pak_file = resource_loader_.ReleaseFile(kResourceResourcesPak);
138 base::File pak_file_2 = pak_file.Duplicate(); 135 base::File pak_file_2 = pak_file.Duplicate();
139 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( 136 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion(
140 pak_file.Pass(), base::MemoryMappedFile::Region::kWholeFile); 137 pak_file.Pass(), base::MemoryMappedFile::Region::kWholeFile);
141 // TODO(sky): why is this always using 100? 138 // TODO(sky): why is this always using 100?
142 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( 139 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile(
143 pak_file_2.Pass(), ui::SCALE_FACTOR_100P); 140 pak_file_2.Pass(), ui::SCALE_FACTOR_100P);
144 } 141 }
145 142
146 compositor_thread_.Start(); 143 compositor_thread_.Start();
147 144
148 media_factory_.reset( 145 media_factory_.reset(
149 new MediaFactory(compositor_thread_.task_runner(), app_->shell())); 146 new MediaFactory(compositor_thread_.task_runner(), app_->shell()));
150 147
151 if (command_line->HasSwitch(kJavaScriptFlags)) { 148 if (command_line->HasSwitch(kJavaScriptFlags)) {
152 std::string flags(command_line->GetSwitchValueASCII(kJavaScriptFlags)); 149 std::string flags(command_line->GetSwitchValueASCII(kJavaScriptFlags));
153 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size())); 150 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size()));
154 } 151 }
155 } 152 }
156 153
157 } // namespace html_viewer 154 } // namespace html_viewer
OLDNEW
« no previous file with comments | « components/html_viewer/DEPS ('k') | mandoline/services/core_services/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698