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

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

Issue 10819003: Upstreaming ChromeBrowserMainAndroid (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 2 Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chrome_browser_main_android.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) 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 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 if (parameters().ui_task) { 1385 if (parameters().ui_task) {
1386 parameters().ui_task->Run(); 1386 parameters().ui_task->Run();
1387 delete parameters().ui_task; 1387 delete parameters().ui_task;
1388 run_message_loop_ = false; 1388 run_message_loop_ = false;
1389 } 1389 }
1390 1390
1391 return result_code_; 1391 return result_code_;
1392 } 1392 }
1393 1393
1394 bool ChromeBrowserMainParts::MainMessageLoopRun(int* result_code) { 1394 bool ChromeBrowserMainParts::MainMessageLoopRun(int* result_code) {
1395 #if defined(OS_ANDROID)
1396 // Chrome on Android does not use default MessageLoop. It has its own
1397 // Android specific MessageLoop
1398 NOTREACHED();
1399 return true;
1400 #else
1395 // Set the result code set in PreMainMessageLoopRun or set above. 1401 // Set the result code set in PreMainMessageLoopRun or set above.
1396 *result_code = result_code_; 1402 *result_code = result_code_;
1397 if (!run_message_loop_) 1403 if (!run_message_loop_)
1398 return true; // Don't run the default message loop. 1404 return true; // Don't run the default message loop.
1399 1405
1400 // This should be invoked as close to the start of the browser's 1406 // This should be invoked as close to the start of the browser's
1401 // UI thread message loop as possible to get a stable measurement 1407 // UI thread message loop as possible to get a stable measurement
1402 // across versions. 1408 // across versions.
1403 RecordBrowserStartupTime(); 1409 RecordBrowserStartupTime();
1404 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); 1410 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type());
1405 #if !defined(USE_AURA) && defined(TOOLKIT_VIEWS) 1411 #if !defined(USE_AURA) && defined(TOOLKIT_VIEWS)
1406 views::AcceleratorHandler accelerator_handler; 1412 views::AcceleratorHandler accelerator_handler;
1407 base::RunLoop run_loop(&accelerator_handler); 1413 base::RunLoop run_loop(&accelerator_handler);
1408 #else 1414 #else
1409 base::RunLoop run_loop; 1415 base::RunLoop run_loop;
1410 #endif 1416 #endif
1411 run_loop.Run(); 1417 run_loop.Run();
1412 1418
1413 return true; 1419 return true;
1420 #endif
1414 } 1421 }
1415 1422
1416 void ChromeBrowserMainParts::PostMainMessageLoopRun() { 1423 void ChromeBrowserMainParts::PostMainMessageLoopRun() {
1424 #if defined(OS_ANDROID)
1425 // Chrome on Android does not use default MessageLoop. It has its own
1426 // Android specific MessageLoop
1427 NOTREACHED();
1428 #else
1417 // Start watching for jank during shutdown. It gets disarmed when 1429 // Start watching for jank during shutdown. It gets disarmed when
1418 // |shutdown_watcher_| object is destructed. 1430 // |shutdown_watcher_| object is destructed.
1419 shutdown_watcher_->Arm(base::TimeDelta::FromSeconds(300)); 1431 shutdown_watcher_->Arm(base::TimeDelta::FromSeconds(300));
1420 1432
1421 // Disarm the startup hang detector time bomb if it is still Arm'ed. 1433 // Disarm the startup hang detector time bomb if it is still Arm'ed.
1422 startup_watcher_->Disarm(); 1434 startup_watcher_->Disarm();
1423 1435
1424 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) 1436 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
1425 chrome_extra_parts_[i]->PostMainMessageLoopRun(); 1437 chrome_extra_parts_[i]->PostMainMessageLoopRun();
1426 1438
(...skipping 25 matching lines...) Expand all
1452 if (notify_result_ == ProcessSingleton::PROCESS_NONE) 1464 if (notify_result_ == ProcessSingleton::PROCESS_NONE)
1453 process_singleton_->Cleanup(); 1465 process_singleton_->Cleanup();
1454 1466
1455 // Stop all tasks that might run on WatchDogThread. 1467 // Stop all tasks that might run on WatchDogThread.
1456 ThreadWatcherList::StopWatchingAll(); 1468 ThreadWatcherList::StopWatchingAll();
1457 1469
1458 browser_process_->metrics_service()->Stop(); 1470 browser_process_->metrics_service()->Stop();
1459 1471
1460 restart_last_session_ = browser_shutdown::ShutdownPreThreadsStop(); 1472 restart_last_session_ = browser_shutdown::ShutdownPreThreadsStop();
1461 browser_process_->StartTearDown(); 1473 browser_process_->StartTearDown();
1474 #endif
1462 } 1475 }
1463 1476
1464 void ChromeBrowserMainParts::PostDestroyThreads() { 1477 void ChromeBrowserMainParts::PostDestroyThreads() {
1465 browser_process_->PostDestroyThreads(); 1478 browser_process_->PostDestroyThreads();
1466 // browser_shutdown takes care of deleting browser_process, so we need to 1479 // browser_shutdown takes care of deleting browser_process, so we need to
1467 // release it. 1480 // release it.
1468 ignore_result(browser_process_.release()); 1481 ignore_result(browser_process_.release());
1469 browser_shutdown::ShutdownPostThreadsStop(restart_last_session_); 1482 browser_shutdown::ShutdownPostThreadsStop(restart_last_session_);
1470 master_prefs_.reset(); 1483 master_prefs_.reset();
1471 process_singleton_.reset(); 1484 process_singleton_.reset();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 if (base::win::GetVersion() <= base::win::VERSION_XP) 1537 if (base::win::GetVersion() <= base::win::VERSION_XP)
1525 uma_name += "_XP"; 1538 uma_name += "_XP";
1526 1539
1527 uma_name += "_PreRead_"; 1540 uma_name += "_PreRead_";
1528 uma_name += pre_read_percentage; 1541 uma_name += pre_read_percentage;
1529 AddPreReadHistogramTime(uma_name.c_str(), time); 1542 AddPreReadHistogramTime(uma_name.c_str(), time);
1530 } 1543 }
1531 #endif 1544 #endif
1532 #endif 1545 #endif
1533 } 1546 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chrome_browser_main_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698