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

Side by Side Diff: chrome/browser/browser_main.cc

Issue 2112006: Cleaned up some constants for stats reading (Closed)
Patch Set: Review mods Created 10 years, 7 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 | « chrome/app/chrome_dll_main.cc ('k') | chrome/browser/chromeos/boot_times_loader.h » ('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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/browser/browser_main.h" 5 #include "chrome/browser/browser_main.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 #if defined(USE_LINUX_BREAKPAD) 90 #if defined(USE_LINUX_BREAKPAD)
91 #include "base/linux_util.h" 91 #include "base/linux_util.h"
92 #include "chrome/app/breakpad_linux.h" 92 #include "chrome/app/breakpad_linux.h"
93 #endif 93 #endif
94 94
95 #if defined(OS_POSIX) && !defined(OS_MACOSX) 95 #if defined(OS_POSIX) && !defined(OS_MACOSX)
96 #include "chrome/browser/gtk/gtk_util.h" 96 #include "chrome/browser/gtk/gtk_util.h"
97 #endif 97 #endif
98 98
99 #if defined(OS_CHROMEOS)
100 #include "chrome/browser/chromeos/boot_times_loader.h"
101 #endif
102
99 // TODO(port): several win-only methods have been pulled out of this, but 103 // TODO(port): several win-only methods have been pulled out of this, but
100 // BrowserMain() as a whole needs to be broken apart so that it's usable by 104 // BrowserMain() as a whole needs to be broken apart so that it's usable by
101 // other platforms. For now, it's just a stub. This is a serious work in 105 // other platforms. For now, it's just a stub. This is a serious work in
102 // progress and should not be taken as an indication of a real refactoring. 106 // progress and should not be taken as an indication of a real refactoring.
103 107
104 #if defined(OS_WIN) 108 #if defined(OS_WIN)
105 #include <windows.h> 109 #include <windows.h>
106 #include <commctrl.h> 110 #include <commctrl.h>
107 #include <shellapi.h> 111 #include <shellapi.h>
108 112
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 728
725 std::wstring app_name = chrome::kBrowserAppName; 729 std::wstring app_name = chrome::kBrowserAppName;
726 std::string thread_name_string = WideToASCII(app_name + L"_BrowserMain"); 730 std::string thread_name_string = WideToASCII(app_name + L"_BrowserMain");
727 731
728 const char* thread_name = thread_name_string.c_str(); 732 const char* thread_name = thread_name_string.c_str();
729 PlatformThread::SetName(thread_name); 733 PlatformThread::SetName(thread_name);
730 main_message_loop.set_thread_name(thread_name); 734 main_message_loop.set_thread_name(thread_name);
731 735
732 // Register the main thread by instantiating it, but don't call any methods. 736 // Register the main thread by instantiating it, but don't call any methods.
733 ChromeThread main_thread(ChromeThread::UI, MessageLoop::current()); 737 ChromeThread main_thread(ChromeThread::UI, MessageLoop::current());
734
735 #if defined(OS_POSIX) 738 #if defined(OS_POSIX)
736 int pipefd[2]; 739 int pipefd[2];
737 int ret = pipe(pipefd); 740 int ret = pipe(pipefd);
738 if (ret < 0) { 741 if (ret < 0) {
739 PLOG(DFATAL) << "Failed to create pipe"; 742 PLOG(DFATAL) << "Failed to create pipe";
740 } else { 743 } else {
741 g_shutdown_pipe_read_fd = pipefd[0]; 744 g_shutdown_pipe_read_fd = pipefd[0];
742 g_shutdown_pipe_write_fd = pipefd[1]; 745 g_shutdown_pipe_write_fd = pipefd[1];
743 const size_t kShutdownDetectorThreadStackSize = 4096; 746 const size_t kShutdownDetectorThreadStackSize = 4096;
744 if (!PlatformThread::CreateNonJoinable( 747 if (!PlatformThread::CreateNonJoinable(
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 // thread, which has a proper CFRunloop, instead of later on the I/O thread, 898 // thread, which has a proper CFRunloop, instead of later on the I/O thread,
896 // which doesn't. This ensures those notifications will get delivered 899 // which doesn't. This ensures those notifications will get delivered
897 // properly. See issue 37766. 900 // properly. See issue 37766.
898 // (Note that the callback mask here is empty. I don't want to register for 901 // (Note that the callback mask here is empty. I don't want to register for
899 // any callbacks, I just want to initialize the mechanism.) 902 // any callbacks, I just want to initialize the mechanism.)
900 SecKeychainAddCallback(&KeychainCallback, 0, NULL); 903 SecKeychainAddCallback(&KeychainCallback, 0, NULL);
901 #endif 904 #endif
902 905
903 CreateChildThreads(browser_process.get()); 906 CreateChildThreads(browser_process.get());
904 907
908 #if defined(OS_CHROMEOS)
909 // Now that the file thread exists we can record our stats.
910 chromeos::BootTimesLoader::RecordChromeMainStats();
911 #endif
912
905 // Record last shutdown time into a histogram. 913 // Record last shutdown time into a histogram.
906 browser_shutdown::ReadLastShutdownInfo(); 914 browser_shutdown::ReadLastShutdownInfo();
907 915
908 #if defined(OS_WIN) 916 #if defined(OS_WIN)
909 // On Windows, we use our startup as an opportunity to do upgrade/uninstall 917 // On Windows, we use our startup as an opportunity to do upgrade/uninstall
910 // tasks. Those care whether the browser is already running. On Linux/Mac, 918 // tasks. Those care whether the browser is already running. On Linux/Mac,
911 // upgrade/uninstall happen separately. 919 // upgrade/uninstall happen separately.
912 bool already_running = Upgrade::IsBrowserAlreadyRunning(); 920 bool already_running = Upgrade::IsBrowserAlreadyRunning();
913 921
914 // If the command line specifies 'uninstall' then we need to work here 922 // If the command line specifies 'uninstall' then we need to work here
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 1251
1244 metrics->Stop(); 1252 metrics->Stop();
1245 1253
1246 // browser_shutdown takes care of deleting browser_process, so we need to 1254 // browser_shutdown takes care of deleting browser_process, so we need to
1247 // release it. 1255 // release it.
1248 ignore_result(browser_process.release()); 1256 ignore_result(browser_process.release());
1249 browser_shutdown::Shutdown(); 1257 browser_shutdown::Shutdown();
1250 1258
1251 return result_code; 1259 return result_code;
1252 } 1260 }
OLDNEW
« no previous file with comments | « chrome/app/chrome_dll_main.cc ('k') | chrome/browser/chromeos/boot_times_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698