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

Side by Side Diff: chrome/app/chrome_main_delegate.cc

Issue 1352713002: Get logging to chrome_debug.log working again on Windows Vista+. (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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/app/chrome_main_delegate.h" 5 #include "chrome/app/chrome_main_delegate.h"
6 6
7 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/cpu.h" 9 #include "base/cpu.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 CHECK(process_type.empty()) << "Unable to get the user data directory " 381 CHECK(process_type.empty()) << "Unable to get the user data directory "
382 << "for process type: " << process_type; 382 << "for process type: " << process_type;
383 } 383 }
384 384
385 // Append the fallback user data directory to the commandline. Otherwise, 385 // Append the fallback user data directory to the commandline. Otherwise,
386 // child or service processes will attempt to use the invalid directory. 386 // child or service processes will attempt to use the invalid directory.
387 if (specified_directory_was_invalid) 387 if (specified_directory_was_invalid)
388 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir); 388 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir);
389 } 389 }
390 390
391 void InitLogging(const std::string& process_type) {
392 logging::OldFileDeletionState file_state =
393 logging::APPEND_TO_OLD_LOG_FILE;
394 if (process_type.empty()) {
395 file_state = logging::DELETE_OLD_LOG_FILE;
396 }
397 const base::CommandLine& command_line =
398 *base::CommandLine::ForCurrentProcess();
399 logging::InitChromeLogging(command_line, file_state);
400 }
401
391 } // namespace 402 } // namespace
392 403
393 ChromeMainDelegate::ChromeMainDelegate() { 404 ChromeMainDelegate::ChromeMainDelegate() {
394 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX) 405 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX)
395 // Record the startup process creation time on supported platforms. 406 // Record the startup process creation time on supported platforms.
396 startup_metric_utils::RecordStartupProcessCreationTime( 407 startup_metric_utils::RecordStartupProcessCreationTime(
397 base::CurrentProcessInfo::CreationTime()); 408 base::CurrentProcessInfo::CreationTime());
398 #endif 409 #endif
399 410
400 // On Android the main entry point time is the time when the Java code starts. 411 // On Android the main entry point time is the time when the Java code starts.
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 InitializeUserDataDir(); 666 InitializeUserDataDir();
656 667
657 // Register component_updater PathProvider after DIR_USER_DATA overidden by 668 // Register component_updater PathProvider after DIR_USER_DATA overidden by
658 // command line flags. Maybe move the chrome PathProvider down here also? 669 // command line flags. Maybe move the chrome PathProvider down here also?
659 component_updater::RegisterPathProvider(chrome::DIR_USER_DATA); 670 component_updater::RegisterPathProvider(chrome::DIR_USER_DATA);
660 671
661 // Enable Message Loop related state asap. 672 // Enable Message Loop related state asap.
662 if (command_line.HasSwitch(switches::kMessageLoopHistogrammer)) 673 if (command_line.HasSwitch(switches::kMessageLoopHistogrammer))
663 base::MessageLoop::EnableHistogrammer(true); 674 base::MessageLoop::EnableHistogrammer(true);
664 675
665 #if !defined(OS_ANDROID) 676 #if !defined(OS_ANDROID) && !defined(OS_WIN)
666 // Android does InitLogging when library is loaded. Skip here. 677 // Android does InitLogging when library is loaded. Skip here.
667 logging::OldFileDeletionState file_state = 678 // For windows we call InitLogging when the sandbox is initialized.
668 logging::APPEND_TO_OLD_LOG_FILE; 679 InitLogging(process_type);
669 if (process_type.empty()) {
670 file_state = logging::DELETE_OLD_LOG_FILE;
671 }
672 logging::InitChromeLogging(command_line, file_state);
673 #endif 680 #endif
674 681
675 #if defined(OS_WIN) 682 #if defined(OS_WIN)
676 // TODO(zturner): Throbber icons are still stored in chrome.dll, this can be 683 // TODO(zturner): Throbber icons are still stored in chrome.dll, this can be
677 // killed once those are merged into resources.pak. See 684 // killed once those are merged into resources.pak. See
678 // GlassBrowserFrameView::InitThrobberIcons() and http://crbug.com/368327. 685 // GlassBrowserFrameView::InitThrobberIcons() and http://crbug.com/368327.
679 ui::SetResourcesDataDLL(_AtlBaseModule.GetResourceInstance()); 686 ui::SetResourcesDataDLL(_AtlBaseModule.GetResourceInstance());
680 #endif 687 #endif
681 688
682 if (SubprocessNeedsResourceBundle(process_type)) { 689 if (SubprocessNeedsResourceBundle(process_type)) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 crash_keys::SetSwitchesFromCommandLine(&command_line); 780 crash_keys::SetSwitchesFromCommandLine(&command_line);
774 } 781 }
775 782
776 void ChromeMainDelegate::SandboxInitialized(const std::string& process_type) { 783 void ChromeMainDelegate::SandboxInitialized(const std::string& process_type) {
777 // Note: If you are adding a new process type below, be sure to adjust the 784 // Note: If you are adding a new process type below, be sure to adjust the
778 // AdjustLinuxOOMScore function too. 785 // AdjustLinuxOOMScore function too.
779 #if defined(OS_LINUX) 786 #if defined(OS_LINUX)
780 AdjustLinuxOOMScore(process_type); 787 AdjustLinuxOOMScore(process_type);
781 #endif 788 #endif
782 #if defined(OS_WIN) 789 #if defined(OS_WIN)
790 InitLogging(process_type);
783 SuppressWindowsErrorDialogs(); 791 SuppressWindowsErrorDialogs();
784 #endif 792 #endif
785 793
786 #if defined(CHROME_MULTIPLE_DLL_CHILD) || !defined(CHROME_MULTIPLE_DLL_BROWSER) 794 #if defined(CHROME_MULTIPLE_DLL_CHILD) || !defined(CHROME_MULTIPLE_DLL_BROWSER)
787 #if !defined(DISABLE_NACL) 795 #if !defined(DISABLE_NACL)
788 ChromeContentClient::SetNaClEntryFunctions( 796 ChromeContentClient::SetNaClEntryFunctions(
789 nacl_plugin::PPP_GetInterface, 797 nacl_plugin::PPP_GetInterface,
790 nacl_plugin::PPP_InitializeModule, 798 nacl_plugin::PPP_InitializeModule,
791 nacl_plugin::PPP_ShutdownModule); 799 nacl_plugin::PPP_ShutdownModule);
792 #endif 800 #endif
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 case version_info::Channel::CANARY: 953 case version_info::Channel::CANARY:
946 return true; 954 return true;
947 case version_info::Channel::DEV: 955 case version_info::Channel::DEV:
948 case version_info::Channel::BETA: 956 case version_info::Channel::BETA:
949 case version_info::Channel::STABLE: 957 case version_info::Channel::STABLE:
950 default: 958 default:
951 // Don't enable instrumentation. 959 // Don't enable instrumentation.
952 return false; 960 return false;
953 } 961 }
954 } 962 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698