Index: content/browser/gpu/gpu_thread_host.h |
diff --git a/content/browser/gpu/gpu_thread_host.h b/content/browser/gpu/gpu_thread_host.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d6b2ddbf6de7891b31e637952ba9bdd42df6542b |
--- /dev/null |
+++ b/content/browser/gpu/gpu_thread_host.h |
@@ -0,0 +1,50 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_BROWSER_GPU_GPU_THREAD_HOST_H_ |
+#define CONTENT_BROWSER_GPU_GPU_THREAD_HOST_H_ |
+#pragma once |
+ |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "content/browser/gpu/gpu_message_hub.h" |
+ |
+class GpuChannelManager; |
+ |
+// This class connects the GPuMessageHub to the GpuThread, when running |
+// in single-process or in-process-gpu mode. |
+class GpuThreadHost : public IPC::Message::Sender { |
+ public: |
+ // Since will ever only be a single GPU thread, this returns the singleton |
+ // instance for this class. |
+ static GpuThreadHost* GetInstance(); |
+ |
+ static void Destroy(); |
+ |
+ // IPC::Message::Sender implementation used to forward messages to the |
+ // GPU thread. |
+ virtual bool Send(IPC::Message* message); |
+ |
+ GpuMessageHub* GetMessageHub() { return message_hub_.get(); } |
+ |
+ private: |
+ GpuThreadHost(); |
+ ~GpuThreadHost(); |
+ |
+ template<class T> friend class DeleteTask; |
+ |
+ GpuChannelManager* gpu_channel_manager_; |
+ |
+ // This member handles incoming messages from the GPU process that |
+ // are either going to the UI thread or are replies to the renderer. |
+ scoped_ptr<GpuMessageHub> message_hub_; |
+ |
+ IPC::Channel::Sender* browser_sender_; |
+ |
+ static GpuThreadHost* g_instance; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(GpuThreadHost); |
+}; |
+ |
+#endif // CONTENT_BROWSER_GPU_GPU_THREAD_HOST_H_ |