| 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 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "chrome/common/child_thread.h" | 11 #include "chrome/common/child_thread.h" |
| 12 #include "chrome/common/gpu_native_window_handle.h" | 12 #include "chrome/common/gpu_native_window_handle.h" |
| 13 #include "chrome/gpu/gpu_channel.h" |
| 13 #include "chrome/gpu/gpu_config.h" | 14 #include "chrome/gpu/gpu_config.h" |
| 14 #include "chrome/gpu/x_util.h" | 15 #include "chrome/gpu/x_util.h" |
| 15 #include "gfx/native_widget_types.h" | 16 #include "gfx/native_widget_types.h" |
| 16 | 17 |
| 17 #if defined(GPU_USE_GLX) | 18 #if defined(GPU_USE_GLX) |
| 18 class GpuBackingStoreGLXContext; | 19 class GpuBackingStoreGLXContext; |
| 19 #endif | 20 #endif |
| 20 | 21 |
| 21 class GpuThread : public ChildThread { | 22 class GpuThread : public ChildThread { |
| 22 public: | 23 public: |
| 23 GpuThread(); | 24 GpuThread(); |
| 24 ~GpuThread(); | 25 ~GpuThread(); |
| 25 | 26 |
| 26 #if defined(GPU_USE_GLX) | 27 #if defined(GPU_USE_GLX) |
| 27 GpuBackingStoreGLXContext* GetGLXContext(); | 28 GpuBackingStoreGLXContext* GetGLXContext(); |
| 28 | 29 |
| 29 Display* display() const { return display_; } | 30 Display* display() const { return display_; } |
| 30 #endif | 31 #endif |
| 31 | 32 |
| 32 private: | 33 private: |
| 33 // ChildThread overrides. | 34 // ChildThread overrides. |
| 34 virtual void OnControlMessageReceived(const IPC::Message& msg); | 35 virtual void OnControlMessageReceived(const IPC::Message& msg); |
| 35 | 36 |
| 36 // Message handlers. | 37 // Message handlers. |
| 37 void OnEstablishChannel(int renderer_id); | 38 void OnEstablishChannel(int renderer_id); |
| 38 void OnNewRenderWidgetHostView(GpuNativeWindowHandle parent_window, | 39 void OnNewRenderWidgetHostView(GpuNativeWindowHandle parent_window, |
| 39 int32 routing_id); | 40 int32 routing_id); |
| 40 | 41 |
| 42 typedef base::hash_map<int, scoped_refptr<GpuChannel> > GpuChannelMap; |
| 43 GpuChannelMap gpu_channels_; |
| 44 |
| 41 #if defined(GPU_USE_GLX) | 45 #if defined(GPU_USE_GLX) |
| 42 Display* display_; | 46 Display* display_; |
| 43 scoped_ptr<GpuBackingStoreGLXContext> glx_context_; | 47 scoped_ptr<GpuBackingStoreGLXContext> glx_context_; |
| 44 #endif | 48 #endif |
| 45 | 49 |
| 46 DISALLOW_COPY_AND_ASSIGN(GpuThread); | 50 DISALLOW_COPY_AND_ASSIGN(GpuThread); |
| 47 }; | 51 }; |
| 48 | 52 |
| 49 #endif // CHROME_GPU_GPU_THREAD_H_ | 53 #endif // CHROME_GPU_GPU_THREAD_H_ |
| OLD | NEW |