| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_GPU_GPU_THREAD_H_ | 5 #ifndef CHROME_GPU_GPU_THREAD_H_ |
| 6 #define CHROME_GPU_GPU_THREAD_H_ | 6 #define CHROME_GPU_GPU_THREAD_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/command_line.h" |
| 10 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 11 #include "base/time.h" | 12 #include "base/time.h" |
| 12 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 13 #include "chrome/common/child_thread.h" | 14 #include "chrome/common/child_thread.h" |
| 14 #include "chrome/common/gpu_info.h" | 15 #include "chrome/common/gpu_info.h" |
| 15 #include "chrome/gpu/gpu_channel.h" | 16 #include "chrome/gpu/gpu_channel.h" |
| 16 #include "chrome/gpu/gpu_config.h" | 17 #include "chrome/gpu/gpu_config.h" |
| 17 #include "chrome/gpu/x_util.h" | 18 #include "chrome/gpu/x_util.h" |
| 18 #include "gfx/native_widget_types.h" | 19 #include "gfx/native_widget_types.h" |
| 19 | 20 |
| 20 namespace IPC { | 21 namespace IPC { |
| 21 struct ChannelHandle; | 22 struct ChannelHandle; |
| 22 } | 23 } |
| 23 | 24 |
| 25 class GpuWatchdogThread; |
| 26 |
| 24 class GpuThread : public ChildThread { | 27 class GpuThread : public ChildThread { |
| 25 public: | 28 public: |
| 26 GpuThread(); | 29 explicit GpuThread(const CommandLine& command_line); |
| 27 ~GpuThread(); | 30 ~GpuThread(); |
| 28 | 31 |
| 29 void Init(const base::Time& process_start_time); | 32 void Init(const base::Time& process_start_time); |
| 33 void StopWatchdog(); |
| 30 | 34 |
| 31 // Remove the channel for a particular renderer. | 35 // Remove the channel for a particular renderer. |
| 32 void RemoveChannel(int renderer_id); | 36 void RemoveChannel(int renderer_id); |
| 33 | 37 |
| 34 private: | 38 private: |
| 35 // ChildThread overrides. | 39 // ChildThread overrides. |
| 36 virtual bool OnControlMessageReceived(const IPC::Message& msg); | 40 virtual bool OnControlMessageReceived(const IPC::Message& msg); |
| 37 | 41 |
| 38 // Message handlers. | 42 // Message handlers. |
| 43 void OnInitialize(); |
| 39 void OnEstablishChannel(int renderer_id); | 44 void OnEstablishChannel(int renderer_id); |
| 40 void OnCloseChannel(const IPC::ChannelHandle& channel_handle); | 45 void OnCloseChannel(const IPC::ChannelHandle& channel_handle); |
| 41 void OnSynchronize(); | 46 void OnSynchronize(); |
| 42 void OnCollectGraphicsInfo(); | 47 void OnCollectGraphicsInfo(); |
| 43 #if defined(OS_MACOSX) | 48 #if defined(OS_MACOSX) |
| 44 void OnAcceleratedSurfaceBuffersSwappedACK( | 49 void OnAcceleratedSurfaceBuffersSwappedACK( |
| 45 int renderer_id, int32 route_id, uint64 swap_buffers_count); | 50 int renderer_id, int32 route_id, uint64 swap_buffers_count); |
| 46 void OnDidDestroyAcceleratedSurface(int renderer_id, int32 renderer_route_id); | 51 void OnDidDestroyAcceleratedSurface(int renderer_id, int32 renderer_route_id); |
| 47 #endif | 52 #endif |
| 48 void OnCrash(); | 53 void OnCrash(); |
| 49 void OnHang(); | 54 void OnHang(); |
| 50 | 55 |
| 51 #if defined(OS_WIN) | 56 #if defined(OS_WIN) |
| 52 static void CollectDxDiagnostics(GpuThread* thread); | 57 static void CollectDxDiagnostics(GpuThread* thread); |
| 53 static void SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node); | 58 static void SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node); |
| 54 #endif | 59 #endif |
| 55 | 60 |
| 61 CommandLine command_line_; |
| 62 base::Time process_start_time_; |
| 63 scoped_refptr<GpuWatchdogThread> watchdog_thread_; |
| 64 |
| 56 typedef base::hash_map<int, scoped_refptr<GpuChannel> > GpuChannelMap; | 65 typedef base::hash_map<int, scoped_refptr<GpuChannel> > GpuChannelMap; |
| 57 GpuChannelMap gpu_channels_; | 66 GpuChannelMap gpu_channels_; |
| 58 | 67 |
| 59 // Information about the GPU, such as device and vendor ID. | 68 // Information about the GPU, such as device and vendor ID. |
| 60 GPUInfo gpu_info_; | 69 GPUInfo gpu_info_; |
| 61 | 70 |
| 62 DISALLOW_COPY_AND_ASSIGN(GpuThread); | 71 DISALLOW_COPY_AND_ASSIGN(GpuThread); |
| 63 }; | 72 }; |
| 64 | 73 |
| 65 #endif // CHROME_GPU_GPU_THREAD_H_ | 74 #endif // CHROME_GPU_GPU_THREAD_H_ |
| OLD | NEW |