OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromecast/browser/cast_browser_main_parts.h" | 5 #include "chromecast/browser/cast_browser_main_parts.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/feature_list.h" |
13 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
16 #include "base/path_service.h" | 17 #include "base/path_service.h" |
17 #include "base/run_loop.h" | 18 #include "base/run_loop.h" |
18 #include "base/thread_task_runner_handle.h" | 19 #include "base/thread_task_runner_handle.h" |
19 #include "build/build_config.h" | 20 #include "build/build_config.h" |
20 #include "cc/base/switches.h" | 21 #include "cc/base/switches.h" |
21 #include "chromecast/base/cast_constants.h" | 22 #include "chromecast/base/cast_constants.h" |
22 #include "chromecast/base/cast_paths.h" | 23 #include "chromecast/base/cast_paths.h" |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 // rendering if the font cache has to be regenerated for some reason. Doing it | 289 // rendering if the font cache has to be regenerated for some reason. Doing it |
289 // explicitly here helps in cases where the browser process is starting up in | 290 // explicitly here helps in cases where the browser process is starting up in |
290 // the background (resources have not yet been granted to cast) since it | 291 // the background (resources have not yet been granted to cast) since it |
291 // prevents the long delay the user would have seen on first rendering. Note | 292 // prevents the long delay the user would have seen on first rendering. Note |
292 // that future calls to FcInit() are safe no-ops per the FontConfig interface. | 293 // that future calls to FcInit() are safe no-ops per the FontConfig interface. |
293 FcInit(); | 294 FcInit(); |
294 #endif | 295 #endif |
295 } | 296 } |
296 | 297 |
297 int CastBrowserMainParts::PreCreateThreads() { | 298 int CastBrowserMainParts::PreCreateThreads() { |
| 299 // The only case GetInstance() returns null should be when you are running a |
| 300 // C++ test, in which case currently we do not support command line features. |
| 301 // This allows Test::SetUp() to enable/disable features as necessary. See |
| 302 // crbug.com/596021 for more details. |
| 303 if (!base::FeatureList::GetInstance()) { |
| 304 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 305 scoped_ptr<base::FeatureList> feature_list(new base::FeatureList); |
| 306 feature_list->InitializeFromCommandLine( |
| 307 command_line->GetSwitchValueASCII(switches::kEnableFeatures), |
| 308 command_line->GetSwitchValueASCII(switches::kDisableFeatures)); |
| 309 base::FeatureList::SetInstance(std::move(feature_list)); |
| 310 } |
| 311 |
298 #if defined(OS_ANDROID) | 312 #if defined(OS_ANDROID) |
299 // GPU process is started immediately after threads are created, requiring | 313 // GPU process is started immediately after threads are created, requiring |
300 // CrashDumpManager to be initialized beforehand. | 314 // CrashDumpManager to be initialized beforehand. |
301 base::FilePath crash_dumps_dir; | 315 base::FilePath crash_dumps_dir; |
302 if (!chromecast::CrashHandler::GetCrashDumpLocation(&crash_dumps_dir)) { | 316 if (!chromecast::CrashHandler::GetCrashDumpLocation(&crash_dumps_dir)) { |
303 LOG(ERROR) << "Could not find crash dump location."; | 317 LOG(ERROR) << "Could not find crash dump location."; |
304 } | 318 } |
305 cast_browser_process_->SetCrashDumpManager( | 319 cast_browser_process_->SetCrashDumpManager( |
306 make_scoped_ptr(new breakpad::CrashDumpManager(crash_dumps_dir))); | 320 make_scoped_ptr(new breakpad::CrashDumpManager(crash_dumps_dir))); |
307 #else | 321 #else |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 #if defined(USE_AURA) | 461 #if defined(USE_AURA) |
448 aura::Env::DeleteInstance(); | 462 aura::Env::DeleteInstance(); |
449 #endif | 463 #endif |
450 | 464 |
451 DeregisterKillOnAlarm(); | 465 DeregisterKillOnAlarm(); |
452 #endif | 466 #endif |
453 } | 467 } |
454 | 468 |
455 } // namespace shell | 469 } // namespace shell |
456 } // namespace chromecast | 470 } // namespace chromecast |
OLD | NEW |