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

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

Issue 3235007: This adds periodic OOM score adjustment, based on the last access time (Closed)
Patch Set: Final review changes Created 10 years, 3 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 | « base/task.h ('k') | chrome/browser/oom_priority_manager.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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 #include "base/linux_util.h" 98 #include "base/linux_util.h"
99 #include "chrome/app/breakpad_linux.h" 99 #include "chrome/app/breakpad_linux.h"
100 #endif 100 #endif
101 101
102 #if defined(OS_POSIX) && !defined(OS_MACOSX) 102 #if defined(OS_POSIX) && !defined(OS_MACOSX)
103 #include "chrome/browser/gtk/gtk_util.h" 103 #include "chrome/browser/gtk/gtk_util.h"
104 #endif 104 #endif
105 105
106 #if defined(OS_CHROMEOS) 106 #if defined(OS_CHROMEOS)
107 #include "chrome/browser/chromeos/boot_times_loader.h" 107 #include "chrome/browser/chromeos/boot_times_loader.h"
108 #include "chrome/browser/oom_priority_manager.h"
108 #endif 109 #endif
109 110
110 // TODO(port): several win-only methods have been pulled out of this, but 111 // TODO(port): several win-only methods have been pulled out of this, but
111 // BrowserMain() as a whole needs to be broken apart so that it's usable by 112 // BrowserMain() as a whole needs to be broken apart so that it's usable by
112 // other platforms. For now, it's just a stub. This is a serious work in 113 // other platforms. For now, it's just a stub. This is a serious work in
113 // progress and should not be taken as an indication of a real refactoring. 114 // progress and should not be taken as an indication of a real refactoring.
114 115
115 #if defined(OS_WIN) 116 #if defined(OS_WIN)
116 #include <windows.h> 117 #include <windows.h>
117 #include <commctrl.h> 118 #include <commctrl.h>
(...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 // See issue 40144. 1395 // See issue 40144.
1395 profile->GetExtensionsService()->InitEventRouters(); 1396 profile->GetExtensionsService()->InitEventRouters();
1396 } 1397 }
1397 1398
1398 #if defined(OS_WIN) 1399 #if defined(OS_WIN)
1399 // We check this here because if the profile is OTR (chromeos possibility) 1400 // We check this here because if the profile is OTR (chromeos possibility)
1400 // it won't still be accessible after browser is destroyed. 1401 // it won't still be accessible after browser is destroyed.
1401 bool record_search_engine = is_first_run && !profile->IsOffTheRecord(); 1402 bool record_search_engine = is_first_run && !profile->IsOffTheRecord();
1402 #endif 1403 #endif
1403 1404
1404 // ChildProcess:: is a misnomer unless you consider context. Use 1405 // ChildProcess:: is a misnomer unless you consider context. Use
1405 // of --wait-for-debugger only makes sense when Chrome itself is a 1406 // of --wait-for-debugger only makes sense when Chrome itself is a
1406 // child process (e.g. when launched by PyAuto). 1407 // child process (e.g. when launched by PyAuto).
1407 if (parsed_command_line.HasSwitch(switches::kWaitForDebugger)) { 1408 if (parsed_command_line.HasSwitch(switches::kWaitForDebugger)) {
1408 ChildProcess::WaitForDebugger(L"Browser"); 1409 ChildProcess::WaitForDebugger(L"Browser");
1409 } 1410 }
1410 1411
1411 // If remoting or cloud print proxy is enabled and setup has been completed 1412 // If remoting or cloud print proxy is enabled and setup has been completed
1412 // we start the service process here. 1413 // we start the service process here.
1413 // The prerequisite for running the service process is that we have IO, UI 1414 // The prerequisite for running the service process is that we have IO, UI
1414 // and PROCESS_LAUNCHER threads up and running. 1415 // and PROCESS_LAUNCHER threads up and running.
1415 // TODO(hclam): Need to check for cloud print proxy too. 1416 // TODO(hclam): Need to check for cloud print proxy too.
1416 if (parsed_command_line.HasSwitch(switches::kEnableRemoting)) { 1417 if (parsed_command_line.HasSwitch(switches::kEnableRemoting)) {
1417 if (user_prefs->GetBoolean(prefs::kRemotingHasSetupCompleted)) { 1418 if (user_prefs->GetBoolean(prefs::kRemotingHasSetupCompleted)) {
1418 ServiceProcessControl* control = ServiceProcessControlManager::instance() 1419 ServiceProcessControl* control = ServiceProcessControlManager::instance()
1419 ->GetProcessControl(profile, kServiceProcessRemoting); 1420 ->GetProcessControl(profile, kServiceProcessRemoting);
1420 control->Launch(NULL); 1421 control->Launch(NULL);
1421 } 1422 }
1422 } 1423 }
1423 1424
1425 #if defined(OS_CHROMEOS)
1426 // Run the Out of Memory priority manager while in this scope. Wait
1427 // until here to start so that we give the most amount of time for
1428 // the other services to start up before we start adjusting the oom
1429 // priority. In reality, it doesn't matter much where in this scope
1430 // this is started, but it must be started in this scope so it will
1431 // also be terminated when this scope exits.
1432 scoped_ptr<browser::OomPriorityManager> oom_priority_manager(
1433 new browser::OomPriorityManager);
1434 #endif
1435
1424 int result_code = ResultCodes::NORMAL_EXIT; 1436 int result_code = ResultCodes::NORMAL_EXIT;
1425 if (parameters.ui_task) { 1437 if (parameters.ui_task) {
1426 // We are in test mode. Run one task and enter the main message loop. 1438 // We are in test mode. Run one task and enter the main message loop.
1427 if (pool) 1439 if (pool)
1428 pool->Recycle(); 1440 pool->Recycle();
1429 parameters.ui_task->Run(); 1441 parameters.ui_task->Run();
1430 delete parameters.ui_task; 1442 delete parameters.ui_task;
1431 } else { 1443 } else {
1432 // We are in regular browser boot sequence. Open initial stabs and enter 1444 // We are in regular browser boot sequence. Open initial stabs and enter
1433 // the main message loop. 1445 // the main message loop.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 metrics->Stop(); 1517 metrics->Stop();
1506 1518
1507 // browser_shutdown takes care of deleting browser_process, so we need to 1519 // browser_shutdown takes care of deleting browser_process, so we need to
1508 // release it. 1520 // release it.
1509 ignore_result(browser_process.release()); 1521 ignore_result(browser_process.release());
1510 browser_shutdown::Shutdown(); 1522 browser_shutdown::Shutdown();
1511 1523
1512 TRACE_EVENT_END("BrowserMain", 0, 0); 1524 TRACE_EVENT_END("BrowserMain", 0, 0);
1513 return result_code; 1525 return result_code;
1514 } 1526 }
OLDNEW
« no previous file with comments | « base/task.h ('k') | chrome/browser/oom_priority_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698