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 "content/browser/browser_main_loop.h" | 5 #include "content/browser/browser_main_loop.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 #endif | 316 #endif |
317 | 317 |
318 MSVC_POP_WARNING() | 318 MSVC_POP_WARNING() |
319 MSVC_ENABLE_OPTIMIZE(); | 319 MSVC_ENABLE_OPTIMIZE(); |
320 | 320 |
321 #if defined(OS_WIN) | 321 #if defined(OS_WIN) |
322 // Creates a memory pressure monitor using automatic thresholds, or those | 322 // Creates a memory pressure monitor using automatic thresholds, or those |
323 // specified on the command-line. Ownership is passed to the caller. | 323 // specified on the command-line. Ownership is passed to the caller. |
324 base::win::MemoryPressureMonitor* CreateWinMemoryPressureMonitor( | 324 base::win::MemoryPressureMonitor* CreateWinMemoryPressureMonitor( |
325 const base::CommandLine& parsed_command_line) { | 325 const base::CommandLine& parsed_command_line) { |
326 std::vector<std::string> thresholds; | 326 std::vector<std::string> thresholds = base::SplitString( |
327 base::SplitString( | |
328 parsed_command_line.GetSwitchValueASCII( | 327 parsed_command_line.GetSwitchValueASCII( |
329 switches::kMemoryPressureThresholdsMb), | 328 switches::kMemoryPressureThresholdsMb), |
330 ',', | 329 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
331 &thresholds); | |
332 | 330 |
333 int moderate_threshold_mb = 0; | 331 int moderate_threshold_mb = 0; |
334 int critical_threshold_mb = 0; | 332 int critical_threshold_mb = 0; |
335 if (thresholds.size() == 2 && | 333 if (thresholds.size() == 2 && |
336 base::StringToInt(thresholds[0], &moderate_threshold_mb) && | 334 base::StringToInt(thresholds[0], &moderate_threshold_mb) && |
337 base::StringToInt(thresholds[1], &critical_threshold_mb) && | 335 base::StringToInt(thresholds[1], &critical_threshold_mb) && |
338 moderate_threshold_mb >= critical_threshold_mb && | 336 moderate_threshold_mb >= critical_threshold_mb && |
339 critical_threshold_mb >= 0) { | 337 critical_threshold_mb >= 0) { |
340 return new base::win::MemoryPressureMonitor(moderate_threshold_mb, | 338 return new base::win::MemoryPressureMonitor(moderate_threshold_mb, |
341 critical_threshold_mb); | 339 critical_threshold_mb); |
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1362 DCHECK(is_tracing_startup_); | 1360 DCHECK(is_tracing_startup_); |
1363 | 1361 |
1364 is_tracing_startup_ = false; | 1362 is_tracing_startup_ = false; |
1365 TracingController::GetInstance()->DisableRecording( | 1363 TracingController::GetInstance()->DisableRecording( |
1366 TracingController::CreateFileSink( | 1364 TracingController::CreateFileSink( |
1367 startup_trace_file_, | 1365 startup_trace_file_, |
1368 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); | 1366 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); |
1369 } | 1367 } |
1370 | 1368 |
1371 } // namespace content | 1369 } // namespace content |
OLD | NEW |