Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/browser/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
| 6 | 6 |
| 7 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 700 } | 700 } |
| 701 #endif // defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX) | 701 #endif // defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX) |
| 702 | 702 |
| 703 // Record collected startup metrics. | 703 // Record collected startup metrics. |
| 704 startup_metric_utils::OnBrowserStartupComplete(is_first_run); | 704 startup_metric_utils::OnBrowserStartupComplete(is_first_run); |
| 705 | 705 |
| 706 // Deletes self. | 706 // Deletes self. |
| 707 new LoadCompleteListener(); | 707 new LoadCompleteListener(); |
| 708 } | 708 } |
| 709 | 709 |
| 710 // This code is specific to the Windows-only PreReadExperiment field-trial. | |
| 711 void ChromeBrowserMainParts::RecordPreReadExperimentTime(const char* name, | 710 void ChromeBrowserMainParts::RecordPreReadExperimentTime(const char* name, |
| 712 base::TimeDelta time) { | 711 base::TimeDelta time) { |
| 713 DCHECK(name != NULL); | 712 DCHECK(name != NULL); |
| 714 | 713 |
| 714 #if defined(OS_WIN) | |
| 715 #if defined(GOOGLE_CHROME_BUILD) | |
| 716 // The pre-read experiment is Windows and Google Chrome specific. Only | |
| 717 // initialize the field-trial if the experiment is running (environment | |
| 718 // variable is set, and valid). | |
| 719 scoped_ptr<base::Environment> env(base::Environment::Create()); | |
| 720 std::string pre_read_group; | |
| 721 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read_group)) { | |
|
Alexei Svitkine (slow)
2013/08/28 17:30:50
We have a script that parses source code to extrac
Roger McFarlane (Chromium)
2013/08/29 15:28:37
I've pulled this out to chrome_browser_field_trial
| |
| 722 static const char kPreReadTrialName[] = "BrowserPreReadExperiment"; | |
| 723 base::FieldTrialList::CreateFieldTrial(kPreReadTrialName, pre_read_group); | |
|
Alexei Svitkine (slow)
2013/08/28 17:30:50
You need to call group() on returned FieldTrial* o
Roger McFarlane (Chromium)
2013/08/29 15:28:37
Having created a setup function for the experiment
| |
| 724 } | |
| 725 #endif | |
| 726 #endif | |
| 727 | |
| 715 // This gets called with different histogram names, so we don't want to use | 728 // This gets called with different histogram names, so we don't want to use |
| 716 // the UMA_HISTOGRAM_CUSTOM_TIMES macro--it uses a static variable, and the | 729 // the UMA_HISTOGRAM_CUSTOM_TIMES macro--it uses a static variable, and the |
| 717 // first call wins. | 730 // first call wins. |
| 718 AddPreReadHistogramTime(name, time); | 731 AddPreReadHistogramTime(name, time); |
| 719 | |
| 720 #if defined(OS_WIN) | |
| 721 #if defined(GOOGLE_CHROME_BUILD) | |
| 722 // The pre-read experiment is Windows and Google Chrome specific. | |
| 723 scoped_ptr<base::Environment> env(base::Environment::Create()); | |
| 724 | |
| 725 // Only record the sub-histogram result if the experiment is running | |
| 726 // (environment variable is set, and valid). | |
| 727 std::string pre_read_percentage; | |
| 728 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read_percentage)) { | |
| 729 std::string uma_name(name); | |
| 730 | |
| 731 // We want XP to record a separate histogram, as the loader on XP | |
| 732 // is very different from the Vista and Win7 loaders. | |
| 733 if (base::win::GetVersion() <= base::win::VERSION_XP) | |
| 734 uma_name += "_XP"; | |
| 735 | |
| 736 uma_name += "_PreRead_"; | |
| 737 uma_name += pre_read_percentage; | |
| 738 AddPreReadHistogramTime(uma_name.c_str(), time); | |
| 739 } | |
| 740 #endif | |
| 741 #endif | |
| 742 } | 732 } |
| 743 | 733 |
| 744 // ----------------------------------------------------------------------------- | 734 // ----------------------------------------------------------------------------- |
| 745 // TODO(viettrungluu): move more/rest of BrowserMain() into BrowserMainParts. | 735 // TODO(viettrungluu): move more/rest of BrowserMain() into BrowserMainParts. |
| 746 | 736 |
| 747 #if defined(OS_WIN) | 737 #if defined(OS_WIN) |
| 748 #define DLLEXPORT __declspec(dllexport) | 738 #define DLLEXPORT __declspec(dllexport) |
| 749 | 739 |
| 750 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. | 740 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. |
| 751 extern "C" { | 741 extern "C" { |
| (...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1700 chromeos::CrosSettings::Shutdown(); | 1690 chromeos::CrosSettings::Shutdown(); |
| 1701 #endif | 1691 #endif |
| 1702 #endif | 1692 #endif |
| 1703 } | 1693 } |
| 1704 | 1694 |
| 1705 // Public members: | 1695 // Public members: |
| 1706 | 1696 |
| 1707 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 1697 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
| 1708 chrome_extra_parts_.push_back(parts); | 1698 chrome_extra_parts_.push_back(parts); |
| 1709 } | 1699 } |
| OLD | NEW |