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 <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #endif | 9 #endif |
10 | 10 |
11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/power_monitor/power_monitor.h" | |
14 #include "base/rand_util.h" | 15 #include "base/rand_util.h" |
15 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
16 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
17 #include "base/threading/platform_thread.h" | 18 #include "base/threading/platform_thread.h" |
18 #include "build/build_config.h" | 19 #include "build/build_config.h" |
19 #include "content/child/child_process.h" | 20 #include "content/child/child_process.h" |
20 #include "content/common/content_constants_internal.h" | 21 #include "content/common/content_constants_internal.h" |
21 #include "content/common/gpu/gpu_config.h" | 22 #include "content/common/gpu/gpu_config.h" |
22 #include "content/common/gpu/gpu_messages.h" | 23 #include "content/common/gpu/gpu_messages.h" |
24 #include "content/common/power_monitor_broadcast_source.h" | |
23 #include "content/common/sandbox_linux.h" | 25 #include "content/common/sandbox_linux.h" |
24 #include "content/gpu/gpu_child_thread.h" | 26 #include "content/gpu/gpu_child_thread.h" |
25 #include "content/gpu/gpu_process.h" | 27 #include "content/gpu/gpu_process.h" |
26 #include "content/gpu/gpu_watchdog_thread.h" | 28 #include "content/gpu/gpu_watchdog_thread.h" |
27 #include "content/public/common/content_client.h" | 29 #include "content/public/common/content_client.h" |
28 #include "content/public/common/content_switches.h" | 30 #include "content/public/common/content_switches.h" |
29 #include "content/public/common/main_function_params.h" | 31 #include "content/public/common/main_function_params.h" |
30 #include "crypto/hmac.h" | 32 #include "crypto/hmac.h" |
31 #include "gpu/config/gpu_info_collector.h" | 33 #include "gpu/config/gpu_info_collector.h" |
32 #include "ui/gl/gl_implementation.h" | 34 #include "ui/gl/gl_implementation.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
166 #endif | 168 #endif |
167 | 169 |
168 bool delayed_watchdog_enable = false; | 170 bool delayed_watchdog_enable = false; |
169 | 171 |
170 #if defined(OS_CHROMEOS) | 172 #if defined(OS_CHROMEOS) |
171 // Don't start watchdog immediately, to allow developers to switch to VT2 on | 173 // Don't start watchdog immediately, to allow developers to switch to VT2 on |
172 // startup. | 174 // startup. |
173 delayed_watchdog_enable = true; | 175 delayed_watchdog_enable = true; |
174 #endif | 176 #endif |
175 | 177 |
178 scoped_ptr<PowerMonitorBroadcastSource> power_monitor_source( | |
jam
2013/07/17 00:29:42
this should be connected in all processes (i.e. in
| |
179 new PowerMonitorBroadcastSource(main_message_loop.message_loop_proxy())); | |
180 IPC::ChannelProxy::MessageFilter* power_monitor_message_filter = | |
181 power_monitor_source->MessageFilter(); | |
182 scoped_ptr<base::PowerMonitor> power_monitor(new base::PowerMonitor( | |
183 power_monitor_source.PassAs<base::PowerMonitorSource>())); | |
184 | |
176 scoped_refptr<GpuWatchdogThread> watchdog_thread; | 185 scoped_refptr<GpuWatchdogThread> watchdog_thread; |
177 | 186 |
178 // Start the GPU watchdog only after anything that is expected to be time | 187 // Start the GPU watchdog only after anything that is expected to be time |
179 // consuming has completed, otherwise the process is liable to be aborted. | 188 // consuming has completed, otherwise the process is liable to be aborted. |
180 if (enable_watchdog && !delayed_watchdog_enable) { | 189 if (enable_watchdog && !delayed_watchdog_enable) { |
181 watchdog_thread = new GpuWatchdogThread(kGpuTimeout); | 190 watchdog_thread = new GpuWatchdogThread(kGpuTimeout); |
182 watchdog_thread->Start(); | 191 watchdog_thread->Start(); |
183 } | 192 } |
184 | 193 |
185 gpu::GPUInfo gpu_info; | 194 gpu::GPUInfo gpu_info; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
280 } | 289 } |
281 | 290 |
282 logging::SetLogMessageHandler(NULL); | 291 logging::SetLogMessageHandler(NULL); |
283 | 292 |
284 GpuProcess gpu_process; | 293 GpuProcess gpu_process; |
285 | 294 |
286 GpuChildThread* child_thread = new GpuChildThread(watchdog_thread.get(), | 295 GpuChildThread* child_thread = new GpuChildThread(watchdog_thread.get(), |
287 dead_on_arrival, | 296 dead_on_arrival, |
288 gpu_info, | 297 gpu_info, |
289 deferred_messages.Get()); | 298 deferred_messages.Get()); |
299 | |
300 child_thread->channel()->AddFilter(power_monitor_message_filter); | |
301 | |
290 while (!deferred_messages.Get().empty()) | 302 while (!deferred_messages.Get().empty()) |
291 deferred_messages.Get().pop(); | 303 deferred_messages.Get().pop(); |
292 | 304 |
293 child_thread->Init(start_time); | 305 child_thread->Init(start_time); |
294 | 306 |
295 gpu_process.set_main_thread(child_thread); | 307 gpu_process.set_main_thread(child_thread); |
296 | 308 |
297 { | 309 { |
298 TRACE_EVENT0("gpu", "Run Message Loop"); | 310 TRACE_EVENT0("gpu", "Run Message Loop"); |
299 main_message_loop.Run(); | 311 main_message_loop.Run(); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
427 return true; | 439 return true; |
428 } | 440 } |
429 | 441 |
430 return false; | 442 return false; |
431 } | 443 } |
432 #endif // defined(OS_WIN) | 444 #endif // defined(OS_WIN) |
433 | 445 |
434 } // namespace. | 446 } // namespace. |
435 | 447 |
436 } // namespace content | 448 } // namespace content |
OLD | NEW |