OLD | NEW |
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 | 8 |
9 #include "app/hi_res_timer_manager.h" | 9 #include "app/hi_res_timer_manager.h" |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 // Do platform-specific things (such as finishing initializing Cocoa) | 410 // Do platform-specific things (such as finishing initializing Cocoa) |
411 // prior to instantiating the message loop. This could be turned into a | 411 // prior to instantiating the message loop. This could be turned into a |
412 // broadcast notification. | 412 // broadcast notification. |
413 Platform::WillInitializeMainMessageLoop(parameters); | 413 Platform::WillInitializeMainMessageLoop(parameters); |
414 | 414 |
415 MessageLoop main_message_loop(MessageLoop::TYPE_UI); | 415 MessageLoop main_message_loop(MessageLoop::TYPE_UI); |
416 | 416 |
417 SystemMonitor system_monitor; | 417 SystemMonitor system_monitor; |
418 HighResolutionTimerManager hi_res_timer_manager; | 418 HighResolutionTimerManager hi_res_timer_manager; |
419 | 419 |
420 // Initialize statistical testing infrastructure. | 420 // Initialize statistical testing infrastructure for entire browser. |
421 FieldTrialList field_trial; | 421 FieldTrialList field_trial; |
422 | 422 |
| 423 // Set up a field trial to see if splitting the first transmitted packet helps |
| 424 // with latency. |
| 425 { |
| 426 FieldTrial::Probability kDivisor = 100; |
| 427 FieldTrial* trial = new FieldTrial("PacketSplit", kDivisor); |
| 428 // For each option (i.e., non-default), we have a fixed probability. |
| 429 FieldTrial::Probability kProbabilityPerGroup = 10; // 10% probability. |
| 430 int split = trial->AppendGroup("_first_packet_split", kProbabilityPerGroup); |
| 431 DCHECK_EQ(split, 0); |
| 432 int intact = trial->AppendGroup("_first_packet_intact", |
| 433 FieldTrial::kAllRemainingProbability); |
| 434 DCHECK_EQ(intact, 1); |
| 435 } |
| 436 |
423 std::wstring app_name = chrome::kBrowserAppName; | 437 std::wstring app_name = chrome::kBrowserAppName; |
424 std::string thread_name_string = WideToASCII(app_name + L"_BrowserMain"); | 438 std::string thread_name_string = WideToASCII(app_name + L"_BrowserMain"); |
425 | 439 |
426 const char* thread_name = thread_name_string.c_str(); | 440 const char* thread_name = thread_name_string.c_str(); |
427 PlatformThread::SetName(thread_name); | 441 PlatformThread::SetName(thread_name); |
428 main_message_loop.set_thread_name(thread_name); | 442 main_message_loop.set_thread_name(thread_name); |
429 | 443 |
430 // Register the main thread by instantiating it, but don't call any methods. | 444 // Register the main thread by instantiating it, but don't call any methods. |
431 ChromeThread main_thread(ChromeThread::UI, MessageLoop::current()); | 445 ChromeThread main_thread(ChromeThread::UI, MessageLoop::current()); |
432 | 446 |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 if (metrics) | 1031 if (metrics) |
1018 metrics->Stop(); | 1032 metrics->Stop(); |
1019 | 1033 |
1020 // browser_shutdown takes care of deleting browser_process, so we need to | 1034 // browser_shutdown takes care of deleting browser_process, so we need to |
1021 // release it. | 1035 // release it. |
1022 browser_process.release(); | 1036 browser_process.release(); |
1023 browser_shutdown::Shutdown(); | 1037 browser_shutdown::Shutdown(); |
1024 | 1038 |
1025 return result_code; | 1039 return result_code; |
1026 } | 1040 } |
OLD | NEW |