OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_process_impl.h" | 5 #include "chrome/browser/browser_process_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/path_service.h" |
8 #include "base/thread.h" | 9 #include "base/thread.h" |
9 #include "base/path_service.h" | |
10 #include "chrome/browser/automation/automation_provider_list.h" | 10 #include "chrome/browser/automation/automation_provider_list.h" |
| 11 #include "chrome/browser/browser_trial.h" |
11 #include "chrome/browser/chrome_thread.h" | 12 #include "chrome/browser/chrome_thread.h" |
12 #include "chrome/browser/download/download_file.h" | 13 #include "chrome/browser/download/download_file.h" |
13 #include "chrome/browser/download/save_file_manager.h" | 14 #include "chrome/browser/download/save_file_manager.h" |
14 #include "chrome/browser/google_url_tracker.h" | 15 #include "chrome/browser/google_url_tracker.h" |
15 #include "chrome/browser/icon_manager.h" | 16 #include "chrome/browser/icon_manager.h" |
16 #include "chrome/browser/metrics_service.h" | 17 #include "chrome/browser/metrics_service.h" |
17 #include "chrome/browser/plugin_service.h" | 18 #include "chrome/browser/plugin_service.h" |
18 #include "chrome/browser/printing/print_job_manager.h" | 19 #include "chrome/browser/printing/print_job_manager.h" |
19 #include "chrome/browser/profile_manager.h" | 20 #include "chrome/browser/profile_manager.h" |
20 #include "chrome/browser/render_process_host.h" | 21 #include "chrome/browser/render_process_host.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 if (command_line.HasSwitch(switches::kMemoryModel)) { | 109 if (command_line.HasSwitch(switches::kMemoryModel)) { |
109 std::wstring model = command_line.GetSwitchValue(switches::kMemoryModel); | 110 std::wstring model = command_line.GetSwitchValue(switches::kMemoryModel); |
110 if (!model.empty()) { | 111 if (!model.empty()) { |
111 if (model == L"high") | 112 if (model == L"high") |
112 memory_model_ = HIGH_MEMORY_MODEL; | 113 memory_model_ = HIGH_MEMORY_MODEL; |
113 else if (model == L"low") | 114 else if (model == L"low") |
114 memory_model_ = LOW_MEMORY_MODEL; | 115 memory_model_ = LOW_MEMORY_MODEL; |
115 else if (model == L"medium") | 116 else if (model == L"medium") |
116 memory_model_ = MEDIUM_MEMORY_MODEL; | 117 memory_model_ = MEDIUM_MEMORY_MODEL; |
117 } | 118 } |
| 119 } else { |
| 120 // Randomly choose what memory model to use. |
| 121 const double probability = 0.5; |
| 122 FieldTrial* trial(new FieldTrial(BrowserTrial::kMemoryModelFieldTrial, |
| 123 probability)); |
| 124 DCHECK(FieldTrialList::Find(BrowserTrial::kMemoryModelFieldTrial) == trial); |
| 125 if (trial->boolean_value()) |
| 126 memory_model_ = HIGH_MEMORY_MODEL; |
| 127 else |
| 128 memory_model_ = MEDIUM_MEMORY_MODEL; |
118 } | 129 } |
119 | 130 |
120 suspend_controller_ = new SuspendController(); | 131 suspend_controller_ = new SuspendController(); |
121 | 132 |
122 shutdown_event_ = ::CreateEvent(NULL, TRUE, FALSE, NULL); | 133 shutdown_event_ = ::CreateEvent(NULL, TRUE, FALSE, NULL); |
123 } | 134 } |
124 | 135 |
125 BrowserProcessImpl::~BrowserProcessImpl() { | 136 BrowserProcessImpl::~BrowserProcessImpl() { |
126 // Delete the AutomationProviderList before NotificationService, | 137 // Delete the AutomationProviderList before NotificationService, |
127 // since it may try to unregister notifications | 138 // since it may try to unregister notifications |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 new views::AcceleratorHandler); | 356 new views::AcceleratorHandler); |
346 accelerator_handler_.swap(accelerator_handler); | 357 accelerator_handler_.swap(accelerator_handler); |
347 } | 358 } |
348 | 359 |
349 void BrowserProcessImpl::CreateGoogleURLTracker() { | 360 void BrowserProcessImpl::CreateGoogleURLTracker() { |
350 DCHECK(google_url_tracker_.get() == NULL); | 361 DCHECK(google_url_tracker_.get() == NULL); |
351 scoped_ptr<GoogleURLTracker> google_url_tracker(new GoogleURLTracker); | 362 scoped_ptr<GoogleURLTracker> google_url_tracker(new GoogleURLTracker); |
352 google_url_tracker_.swap(google_url_tracker); | 363 google_url_tracker_.swap(google_url_tracker); |
353 } | 364 } |
354 | 365 |
OLD | NEW |