| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_GPU_GPU_THREAD_H_ | |
| 6 #define CHROME_GPU_GPU_THREAD_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/command_line.h" | |
| 13 #include "base/scoped_ptr.h" | |
| 14 #include "base/time.h" | |
| 15 #include "build/build_config.h" | |
| 16 #include "chrome/gpu/gpu_channel.h" | |
| 17 #include "chrome/gpu/gpu_config.h" | |
| 18 #include "chrome/gpu/x_util.h" | |
| 19 #include "content/common/child_thread.h" | |
| 20 #include "content/common/gpu_info.h" | |
| 21 #include "ui/gfx/native_widget_types.h" | |
| 22 | |
| 23 namespace IPC { | |
| 24 struct ChannelHandle; | |
| 25 } | |
| 26 | |
| 27 namespace sandbox { | |
| 28 class TargetServices; | |
| 29 } | |
| 30 | |
| 31 class GpuWatchdogThread; | |
| 32 | |
| 33 class GpuThread : public ChildThread { | |
| 34 public: | |
| 35 #if defined(OS_WIN) | |
| 36 explicit GpuThread(sandbox::TargetServices* target_services); | |
| 37 #else | |
| 38 GpuThread(); | |
| 39 #endif | |
| 40 | |
| 41 // For single-process mode. | |
| 42 explicit GpuThread(const std::string& channel_id); | |
| 43 | |
| 44 ~GpuThread(); | |
| 45 | |
| 46 void Init(const base::Time& process_start_time); | |
| 47 void StopWatchdog(); | |
| 48 | |
| 49 // Remove the channel for a particular renderer. | |
| 50 void RemoveChannel(int renderer_id); | |
| 51 | |
| 52 private: | |
| 53 // ChildThread overrides. | |
| 54 virtual bool OnControlMessageReceived(const IPC::Message& msg); | |
| 55 | |
| 56 // Message handlers. | |
| 57 void OnInitialize(); | |
| 58 void OnEstablishChannel(int renderer_id); | |
| 59 void OnCloseChannel(const IPC::ChannelHandle& channel_handle); | |
| 60 void OnSynchronize(); | |
| 61 void OnCollectGraphicsInfo(GPUInfo::Level level); | |
| 62 void OnCreateViewCommandBuffer( | |
| 63 gfx::PluginWindowHandle window, | |
| 64 int32 render_view_id, | |
| 65 int32 renderer_id, | |
| 66 const GPUCreateCommandBufferConfig& init_params); | |
| 67 #if defined(OS_MACOSX) | |
| 68 void OnAcceleratedSurfaceBuffersSwappedACK( | |
| 69 int renderer_id, int32 route_id, uint64 swap_buffers_count); | |
| 70 void OnDidDestroyAcceleratedSurface(int renderer_id, int32 renderer_route_id); | |
| 71 #endif | |
| 72 void OnCrash(); | |
| 73 void OnHang(); | |
| 74 | |
| 75 #if defined(OS_WIN) | |
| 76 static void CollectDxDiagnostics(GpuThread* thread); | |
| 77 static void SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node); | |
| 78 #endif | |
| 79 | |
| 80 base::Time process_start_time_; | |
| 81 scoped_refptr<GpuWatchdogThread> watchdog_thread_; | |
| 82 | |
| 83 typedef base::hash_map<int, scoped_refptr<GpuChannel> > GpuChannelMap; | |
| 84 GpuChannelMap gpu_channels_; | |
| 85 | |
| 86 // Information about the GPU, such as device and vendor ID. | |
| 87 GPUInfo gpu_info_; | |
| 88 | |
| 89 #if defined(OS_WIN) | |
| 90 // Windows specific client sandbox interface. | |
| 91 sandbox::TargetServices* target_services_; | |
| 92 #endif | |
| 93 | |
| 94 DISALLOW_COPY_AND_ASSIGN(GpuThread); | |
| 95 }; | |
| 96 | |
| 97 #endif // CHROME_GPU_GPU_THREAD_H_ | |
| OLD | NEW |