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 <string> |
| 8 #include <vector> |
| 9 |
7 #include "base/bind.h" | 10 #include "base/bind.h" |
8 #include "base/command_line.h" | 11 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 13 #include "base/logging.h" |
11 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
12 #include "base/metrics/field_trial.h" | 15 #include "base/metrics/field_trial.h" |
13 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
14 #include "base/pending_task.h" | 17 #include "base/pending_task.h" |
15 #include "base/power_monitor/power_monitor.h" | 18 #include "base/power_monitor/power_monitor.h" |
16 #include "base/power_monitor/power_monitor_device_source.h" | 19 #include "base/power_monitor/power_monitor_device_source.h" |
(...skipping 16 matching lines...) Expand all Loading... |
33 #include "content/browser/histogram_synchronizer.h" | 36 #include "content/browser/histogram_synchronizer.h" |
34 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 37 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
35 #include "content/browser/media/media_internals.h" | 38 #include "content/browser/media/media_internals.h" |
36 #include "content/browser/net/browser_online_state_observer.h" | 39 #include "content/browser/net/browser_online_state_observer.h" |
37 #include "content/browser/renderer_host/media/media_stream_manager.h" | 40 #include "content/browser/renderer_host/media/media_stream_manager.h" |
38 #include "content/browser/speech/speech_recognition_manager_impl.h" | 41 #include "content/browser/speech/speech_recognition_manager_impl.h" |
39 #include "content/browser/startup_task_runner.h" | 42 #include "content/browser/startup_task_runner.h" |
40 #include "content/browser/time_zone_monitor.h" | 43 #include "content/browser/time_zone_monitor.h" |
41 #include "content/browser/webui/content_web_ui_controller_factory.h" | 44 #include "content/browser/webui/content_web_ui_controller_factory.h" |
42 #include "content/browser/webui/url_data_manager.h" | 45 #include "content/browser/webui/url_data_manager.h" |
| 46 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" |
43 #include "content/public/browser/browser_main_parts.h" | 47 #include "content/public/browser/browser_main_parts.h" |
44 #include "content/public/browser/browser_shutdown.h" | 48 #include "content/public/browser/browser_shutdown.h" |
45 #include "content/public/browser/content_browser_client.h" | 49 #include "content/public/browser/content_browser_client.h" |
46 #include "content/public/browser/render_process_host.h" | 50 #include "content/public/browser/render_process_host.h" |
47 #include "content/public/browser/tracing_controller.h" | 51 #include "content/public/browser/tracing_controller.h" |
48 #include "content/public/common/content_switches.h" | 52 #include "content/public/common/content_switches.h" |
49 #include "content/public/common/main_function_params.h" | 53 #include "content/public/common/main_function_params.h" |
50 #include "content/public/common/result_codes.h" | 54 #include "content/public/common/result_codes.h" |
51 #include "crypto/nss_util.h" | 55 #include "crypto/nss_util.h" |
52 #include "device/battery/battery_status_service.h" | 56 #include "device/battery/battery_status_service.h" |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 if (parsed_command_line_.HasSwitch(switches::kRendererProcessLimit)) { | 427 if (parsed_command_line_.HasSwitch(switches::kRendererProcessLimit)) { |
424 std::string limit_string = parsed_command_line_.GetSwitchValueASCII( | 428 std::string limit_string = parsed_command_line_.GetSwitchValueASCII( |
425 switches::kRendererProcessLimit); | 429 switches::kRendererProcessLimit); |
426 size_t process_limit; | 430 size_t process_limit; |
427 if (base::StringToSizeT(limit_string, &process_limit)) { | 431 if (base::StringToSizeT(limit_string, &process_limit)) { |
428 RenderProcessHost::SetMaxRendererProcessCount(process_limit); | 432 RenderProcessHost::SetMaxRendererProcessCount(process_limit); |
429 } | 433 } |
430 } | 434 } |
431 #endif // !defined(OS_IOS) | 435 #endif // !defined(OS_IOS) |
432 | 436 |
| 437 std::vector<gfx::GpuMemoryBufferType> supported_types; |
| 438 GpuMemoryBufferImpl::GetSupportedTypes(&supported_types); |
| 439 DCHECK(!supported_types.empty()); |
| 440 |
| 441 // The default preferred type is always the first one in list. |
| 442 gfx::GpuMemoryBufferType type = supported_types[0]; |
| 443 |
| 444 if (parsed_command_line_.HasSwitch(switches::kUseGpuMemoryBuffer)) { |
| 445 std::string requested_type_name = parsed_command_line_.GetSwitchValueASCII( |
| 446 switches::kUseGpuMemoryBuffer); |
| 447 gfx::GpuMemoryBufferType requested_type = |
| 448 GpuMemoryBufferImpl::GetNamedType(requested_type_name); |
| 449 if (std::find(supported_types.begin(), |
| 450 supported_types.end(), |
| 451 requested_type) != supported_types.end()) { |
| 452 type = requested_type; |
| 453 } else { |
| 454 LOG(ERROR) << "Requested GPU memory buffer type is not supported."; |
| 455 } |
| 456 } |
| 457 |
| 458 GpuMemoryBufferImpl::SetPreferredType(type); |
| 459 |
433 if (parts_) | 460 if (parts_) |
434 parts_->PostEarlyInitialization(); | 461 parts_->PostEarlyInitialization(); |
435 } | 462 } |
436 | 463 |
437 void BrowserMainLoop::MainMessageLoopStart() { | 464 void BrowserMainLoop::MainMessageLoopStart() { |
438 TRACE_EVENT0("startup", "BrowserMainLoop::MainMessageLoopStart"); | 465 TRACE_EVENT0("startup", "BrowserMainLoop::MainMessageLoopStart"); |
439 if (parts_) { | 466 if (parts_) { |
440 TRACE_EVENT0("startup", | 467 TRACE_EVENT0("startup", |
441 "BrowserMainLoop::MainMessageLoopStart:PreMainMessageLoopStart"); | 468 "BrowserMainLoop::MainMessageLoopStart:PreMainMessageLoopStart"); |
442 parts_->PreMainMessageLoopStart(); | 469 parts_->PreMainMessageLoopStart(); |
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1193 | 1220 |
1194 void BrowserMainLoop::EndStartupTracing() { | 1221 void BrowserMainLoop::EndStartupTracing() { |
1195 is_tracing_startup_ = false; | 1222 is_tracing_startup_ = false; |
1196 TracingController::GetInstance()->DisableRecording( | 1223 TracingController::GetInstance()->DisableRecording( |
1197 TracingController::CreateFileSink( | 1224 TracingController::CreateFileSink( |
1198 startup_trace_file_, | 1225 startup_trace_file_, |
1199 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); | 1226 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); |
1200 } | 1227 } |
1201 | 1228 |
1202 } // namespace content | 1229 } // namespace content |
OLD | NEW |