| 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 #ifndef CONTENT_GPU_GPU_CHILD_THREAD_H_ | 5 #ifndef CONTENT_GPU_GPU_CHILD_THREAD_H_ |
| 6 #define CONTENT_GPU_GPU_CHILD_THREAD_H_ | 6 #define CONTENT_GPU_GPU_CHILD_THREAD_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 16 #include "content/common/child_thread.h" | 16 #include "content/common/child_thread.h" |
| 17 #include "content/common/gpu/gpu_channel.h" | 17 #include "content/common/gpu/gpu_channel.h" |
| 18 #include "content/common/gpu/gpu_channel_manager.h" | 18 #include "content/common/gpu/gpu_channel_manager.h" |
| 19 #include "content/common/gpu/gpu_config.h" | 19 #include "content/common/gpu/gpu_config.h" |
| 20 #include "content/common/gpu/x_util.h" | 20 #include "content/common/gpu/x_util.h" |
| 21 #include "content/public/common/gpu_info.h" | 21 #include "content/public/common/gpu_info.h" |
| 22 #include "ui/gfx/native_widget_types.h" | 22 #include "ui/gfx/native_widget_types.h" |
| 23 | 23 |
| 24 namespace sandbox { | 24 namespace sandbox { |
| 25 class TargetServices; | 25 class TargetServices; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace content { |
| 28 class GpuWatchdogThread; | 29 class GpuWatchdogThread; |
| 29 | 30 |
| 30 // The main thread of the GPU child process. There will only ever be one of | 31 // The main thread of the GPU child process. There will only ever be one of |
| 31 // these per process. It does process initialization and shutdown. It forwards | 32 // these per process. It does process initialization and shutdown. It forwards |
| 32 // IPC messages to GpuChannelManager, which is responsible for issuing rendering | 33 // IPC messages to GpuChannelManager, which is responsible for issuing rendering |
| 33 // commands to the GPU. | 34 // commands to the GPU. |
| 34 class GpuChildThread : public ChildThread { | 35 class GpuChildThread : public ChildThread { |
| 35 public: | 36 public: |
| 36 explicit GpuChildThread(bool dead_on_arrival, | 37 explicit GpuChildThread(bool dead_on_arrival, const GPUInfo& gpu_info); |
| 37 const content::GPUInfo& gpu_info); | |
| 38 | 38 |
| 39 // For single-process mode. | 39 // For single-process mode. |
| 40 explicit GpuChildThread(const std::string& channel_id); | 40 explicit GpuChildThread(const std::string& channel_id); |
| 41 | 41 |
| 42 virtual ~GpuChildThread(); | 42 virtual ~GpuChildThread(); |
| 43 | 43 |
| 44 void Init(const base::Time& process_start_time); | 44 void Init(const base::Time& process_start_time); |
| 45 void StopWatchdog(); | 45 void StopWatchdog(); |
| 46 | 46 |
| 47 // ChildThread overrides. | 47 // ChildThread overrides. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 59 void OnCrash(); | 59 void OnCrash(); |
| 60 void OnHang(); | 60 void OnHang(); |
| 61 | 61 |
| 62 #if defined(USE_TCMALLOC) | 62 #if defined(USE_TCMALLOC) |
| 63 void OnGetGpuTcmalloc(); | 63 void OnGetGpuTcmalloc(); |
| 64 #endif | 64 #endif |
| 65 | 65 |
| 66 #if defined(OS_WIN) | 66 #if defined(OS_WIN) |
| 67 static void CollectDxDiagnostics(GpuChildThread* thread); | 67 static void CollectDxDiagnostics(GpuChildThread* thread); |
| 68 static void SetDxDiagnostics(GpuChildThread* thread, | 68 static void SetDxDiagnostics(GpuChildThread* thread, |
| 69 const content::DxDiagNode& node); | 69 const DxDiagNode& node); |
| 70 #endif | 70 #endif |
| 71 | 71 |
| 72 // Set this flag to true if a fatal error occurred before we receive the | 72 // Set this flag to true if a fatal error occurred before we receive the |
| 73 // OnInitialize message, in which case we just declare ourselves DOA. | 73 // OnInitialize message, in which case we just declare ourselves DOA. |
| 74 bool dead_on_arrival_; | 74 bool dead_on_arrival_; |
| 75 base::Time process_start_time_; | 75 base::Time process_start_time_; |
| 76 scoped_refptr<GpuWatchdogThread> watchdog_thread_; | 76 scoped_refptr<GpuWatchdogThread> watchdog_thread_; |
| 77 | 77 |
| 78 #if defined(OS_WIN) | 78 #if defined(OS_WIN) |
| 79 // Windows specific client sandbox interface. | 79 // Windows specific client sandbox interface. |
| 80 sandbox::TargetServices* target_services_; | 80 sandbox::TargetServices* target_services_; |
| 81 | 81 |
| 82 // Indicates whether DirectX Diagnostics collection is ongoing. | 82 // Indicates whether DirectX Diagnostics collection is ongoing. |
| 83 bool collecting_dx_diagnostics_; | 83 bool collecting_dx_diagnostics_; |
| 84 #endif | 84 #endif |
| 85 | 85 |
| 86 scoped_ptr<GpuChannelManager> gpu_channel_manager_; | 86 scoped_ptr<GpuChannelManager> gpu_channel_manager_; |
| 87 | 87 |
| 88 // Information about the GPU, such as device and vendor ID. | 88 // Information about the GPU, such as device and vendor ID. |
| 89 content::GPUInfo gpu_info_; | 89 GPUInfo gpu_info_; |
| 90 | 90 |
| 91 DISALLOW_COPY_AND_ASSIGN(GpuChildThread); | 91 DISALLOW_COPY_AND_ASSIGN(GpuChildThread); |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 } // namespace content |
| 95 |
| 94 #endif // CONTENT_GPU_GPU_CHILD_THREAD_H_ | 96 #endif // CONTENT_GPU_GPU_CHILD_THREAD_H_ |
| OLD | NEW |