| 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/gpu/gpu_child_thread.h" | 5 #include "content/gpu/gpu_child_thread.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/threading/worker_pool.h" | 12 #include "base/threading/worker_pool.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "content/common/child_process.h" | 14 #include "content/common/child_process.h" |
| 15 #include "content/common/gpu/gpu_messages.h" | 15 #include "content/common/gpu/gpu_messages.h" |
| 16 #include "content/gpu/gpu_info_collector.h" | |
| 17 #include "content/gpu/gpu_watchdog_thread.h" | 16 #include "content/gpu/gpu_watchdog_thread.h" |
| 18 #include "content/public/common/content_client.h" | 17 #include "content/public/common/content_client.h" |
| 19 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
| 19 #include "gpu/config/gpu_info_collector.h" |
| 20 #include "ipc/ipc_channel_handle.h" | 20 #include "ipc/ipc_channel_handle.h" |
| 21 #include "ipc/ipc_sync_message_filter.h" | 21 #include "ipc/ipc_sync_message_filter.h" |
| 22 #include "ui/gl/gl_implementation.h" | 22 #include "ui/gl/gl_implementation.h" |
| 23 | 23 |
| 24 #if defined(OS_ANDROID) | 24 #if defined(OS_ANDROID) |
| 25 // TODO(epenner): Move thread priorities to base. (crbug.com/170549) | 25 // TODO(epenner): Move thread priorities to base. (crbug.com/170549) |
| 26 #include <sys/resource.h> | 26 #include <sys/resource.h> |
| 27 #endif | 27 #endif |
| 28 | 28 |
| 29 namespace content { | 29 namespace content { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 47 message)); | 47 message)); |
| 48 } | 48 } |
| 49 | 49 |
| 50 return false; | 50 return false; |
| 51 } | 51 } |
| 52 | 52 |
| 53 } // namespace | 53 } // namespace |
| 54 | 54 |
| 55 GpuChildThread::GpuChildThread(GpuWatchdogThread* watchdog_thread, | 55 GpuChildThread::GpuChildThread(GpuWatchdogThread* watchdog_thread, |
| 56 bool dead_on_arrival, | 56 bool dead_on_arrival, |
| 57 const GPUInfo& gpu_info) | 57 const gpu::GPUInfo& gpu_info) |
| 58 : dead_on_arrival_(dead_on_arrival), | 58 : dead_on_arrival_(dead_on_arrival), |
| 59 gpu_info_(gpu_info), | 59 gpu_info_(gpu_info), |
| 60 in_browser_process_(false) { | 60 in_browser_process_(false) { |
| 61 watchdog_thread_ = watchdog_thread; | 61 watchdog_thread_ = watchdog_thread; |
| 62 #if defined(OS_WIN) | 62 #if defined(OS_WIN) |
| 63 target_services_ = NULL; | 63 target_services_ = NULL; |
| 64 #endif | 64 #endif |
| 65 } | 65 } |
| 66 | 66 |
| 67 GpuChildThread::GpuChildThread(const std::string& channel_id) | 67 GpuChildThread::GpuChildThread(const std::string& channel_id) |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 void GpuChildThread::OnCollectGraphicsInfo() { | 170 void GpuChildThread::OnCollectGraphicsInfo() { |
| 171 #if defined(OS_WIN) | 171 #if defined(OS_WIN) |
| 172 // GPU full info collection should only happen on un-sandboxed GPU process | 172 // GPU full info collection should only happen on un-sandboxed GPU process |
| 173 // or single process/in-process gpu mode on Windows. | 173 // or single process/in-process gpu mode on Windows. |
| 174 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 174 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 175 DCHECK(command_line->HasSwitch(switches::kDisableGpuSandbox) || | 175 DCHECK(command_line->HasSwitch(switches::kDisableGpuSandbox) || |
| 176 in_browser_process_); | 176 in_browser_process_); |
| 177 #endif // OS_WIN | 177 #endif // OS_WIN |
| 178 | 178 |
| 179 if (!gpu_info_collector::CollectContextGraphicsInfo(&gpu_info_)) | 179 if (!gpu::CollectContextGraphicsInfo(&gpu_info_)) |
| 180 VLOG(1) << "gpu_info_collector::CollectGraphicsInfo failed"; | 180 VLOG(1) << "gpu::CollectGraphicsInfo failed"; |
| 181 GetContentClient()->SetGpuInfo(gpu_info_); | 181 GetContentClient()->SetGpuInfo(gpu_info_); |
| 182 | 182 |
| 183 #if defined(OS_WIN) | 183 #if defined(OS_WIN) |
| 184 // This is slow, but it's the only thing the unsandboxed GPU process does, | 184 // This is slow, but it's the only thing the unsandboxed GPU process does, |
| 185 // and GpuDataManager prevents us from sending multiple collecting requests, | 185 // and GpuDataManager prevents us from sending multiple collecting requests, |
| 186 // so it's OK to be blocking. | 186 // so it's OK to be blocking. |
| 187 gpu_info_collector::GetDxDiagnostics(&gpu_info_.dx_diagnostics); | 187 gpu::GetDxDiagnostics(&gpu_info_.dx_diagnostics); |
| 188 gpu_info_.finalized = true; | 188 gpu_info_.finalized = true; |
| 189 #endif // OS_WIN | 189 #endif // OS_WIN |
| 190 | 190 |
| 191 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_)); | 191 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_)); |
| 192 | 192 |
| 193 #if defined(OS_WIN) | 193 #if defined(OS_WIN) |
| 194 if (!in_browser_process_) { | 194 if (!in_browser_process_) { |
| 195 // The unsandboxed GPU process fulfilled its duty. Rest in peace. | 195 // The unsandboxed GPU process fulfilled its duty. Rest in peace. |
| 196 base::MessageLoop::current()->Quit(); | 196 base::MessageLoop::current()->Quit(); |
| 197 } | 197 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 // the future posting of tasks to the message loop. | 234 // the future posting of tasks to the message loop. |
| 235 if (watchdog_thread_->message_loop()) | 235 if (watchdog_thread_->message_loop()) |
| 236 watchdog_thread_->PostAcknowledge(); | 236 watchdog_thread_->PostAcknowledge(); |
| 237 // Prevent rearming. | 237 // Prevent rearming. |
| 238 watchdog_thread_->Stop(); | 238 watchdog_thread_->Stop(); |
| 239 } | 239 } |
| 240 } | 240 } |
| 241 | 241 |
| 242 } // namespace content | 242 } // namespace content |
| 243 | 243 |
| OLD | NEW |