| 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_RENDERER_GPU_GPU_CHANNEL_HOST_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ |
| 6 #define CONTENT_RENDERER_GPU_GPU_CHANNEL_HOST_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/hash_tables.h" | 12 #include "base/hash_tables.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/process_util.h" | 16 #include "base/process_util.h" |
| 17 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
| 18 #include "content/common/gpu/gpu_process_launch_causes.h" | 18 #include "content/common/gpu/gpu_process_launch_causes.h" |
| 19 #include "content/common/message_router.h" | 19 #include "content/common/message_router.h" |
| 20 #include "content/public/common/gpu_info.h" | 20 #include "content/public/common/gpu_info.h" |
| 21 #include "content/renderer/gpu/gpu_video_decode_accelerator_host.h" | 21 #include "content/common/gpu/client/gpu_video_decode_accelerator_host.h" |
| 22 #include "ipc/ipc_channel_handle.h" | 22 #include "ipc/ipc_channel_handle.h" |
| 23 #include "ipc/ipc_channel_proxy.h" | 23 #include "ipc/ipc_channel_proxy.h" |
| 24 #include "ipc/ipc_sync_channel.h" | 24 #include "ipc/ipc_sync_channel.h" |
| 25 #include "ui/gfx/gl/gpu_preference.h" | 25 #include "ui/gfx/gl/gpu_preference.h" |
| 26 #include "ui/gfx/native_widget_types.h" | 26 #include "ui/gfx/native_widget_types.h" |
| 27 #include "ui/gfx/size.h" | 27 #include "ui/gfx/size.h" |
| 28 | 28 |
| 29 class CommandBufferProxy; | 29 class CommandBufferProxy; |
| 30 struct GPUCreateCommandBufferConfig; | 30 struct GPUCreateCommandBufferConfig; |
| 31 class GURL; | 31 class GURL; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 protected: | 67 protected: |
| 68 static void set_instance(GpuChannelHostFactory* instance) { | 68 static void set_instance(GpuChannelHostFactory* instance) { |
| 69 instance_ = instance; | 69 instance_ = instance; |
| 70 } | 70 } |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 static GpuChannelHostFactory* instance_; | 73 static GpuChannelHostFactory* instance_; |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 // Encapsulates an IPC channel between the renderer and one plugin process. | 76 // Encapsulates an IPC channel between the client and one GPU process. |
| 77 // On the plugin side there's a corresponding GpuChannel. | 77 // On the GPU process side there's a corresponding GpuChannel. |
| 78 class GpuChannelHost : public IPC::Message::Sender, | 78 class GpuChannelHost : public IPC::Message::Sender, |
| 79 public base::RefCountedThreadSafe<GpuChannelHost> { | 79 public base::RefCountedThreadSafe<GpuChannelHost> { |
| 80 public: | 80 public: |
| 81 enum State { | 81 enum State { |
| 82 // Not yet connected. | 82 // Not yet connected. |
| 83 kUnconnected, | 83 kUnconnected, |
| 84 // Ready to use. | 84 // Ready to use. |
| 85 kConnected, | 85 kConnected, |
| 86 // An error caused the host to become disconnected. Recreate channel to | 86 // An error caused the host to become disconnected. Recreate channel to |
| 87 // reestablish connection. | 87 // reestablish connection. |
| 88 kLost | 88 kLost |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 // Called on the render thread | 91 // Called on the render thread |
| 92 explicit GpuChannelHost(GpuChannelHostFactory* factory); | 92 explicit GpuChannelHost(GpuChannelHostFactory* factory); |
| 93 virtual ~GpuChannelHost(); | 93 virtual ~GpuChannelHost(); |
| 94 | 94 |
| 95 // Connect to GPU process channel. | 95 // Connect to GPU process channel. |
| 96 void Connect(const IPC::ChannelHandle& channel_handle, | 96 void Connect(const IPC::ChannelHandle& channel_handle, |
| 97 base::ProcessHandle renderer_process_for_gpu); | 97 base::ProcessHandle client_process_for_gpu); |
| 98 | 98 |
| 99 State state() const { return state_; } | 99 State state() const { return state_; } |
| 100 | 100 |
| 101 // Change state to kLost. | 101 // Change state to kLost. |
| 102 void SetStateLost(); | 102 void SetStateLost(); |
| 103 | 103 |
| 104 // The GPU stats reported by the GPU process. | 104 // The GPU stats reported by the GPU process. |
| 105 void set_gpu_info(const content::GPUInfo& gpu_info); | 105 void set_gpu_info(const content::GPUInfo& gpu_info); |
| 106 const content::GPUInfo& gpu_info() const; | 106 const content::GPUInfo& gpu_info() const; |
| 107 | 107 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // A lock to guard against concurrent access to members like the proxies map | 198 // A lock to guard against concurrent access to members like the proxies map |
| 199 // for calls from contexts that may live on the compositor or main thread. | 199 // for calls from contexts that may live on the compositor or main thread. |
| 200 mutable base::Lock context_lock_; | 200 mutable base::Lock context_lock_; |
| 201 | 201 |
| 202 // A filter for sending messages from thread other than the main thread. | 202 // A filter for sending messages from thread other than the main thread. |
| 203 scoped_refptr<IPC::SyncMessageFilter> sync_filter_; | 203 scoped_refptr<IPC::SyncMessageFilter> sync_filter_; |
| 204 | 204 |
| 205 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); | 205 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); |
| 206 }; | 206 }; |
| 207 | 207 |
| 208 #endif // CONTENT_RENDERER_GPU_GPU_CHANNEL_HOST_H_ | 208 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ |
| OLD | NEW |