OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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 CONTENT_BROWSER_GPU_GPU_THREAD_HOST_H_ |
| 6 #define CONTENT_BROWSER_GPU_GPU_THREAD_HOST_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "content/browser/gpu/gpu_message_hub.h" |
| 12 |
| 13 class GpuChannelManager; |
| 14 |
| 15 // This class connects the GPuMessageHub to the GpuThread, when running |
| 16 // in single-process or in-process-gpu mode. |
| 17 class GpuThreadHost : public IPC::Message::Sender { |
| 18 public: |
| 19 // Since will ever only be a single GPU thread, this returns the singleton |
| 20 // instance for this class. |
| 21 static GpuThreadHost* GetInstance(); |
| 22 |
| 23 static void Destroy(); |
| 24 |
| 25 // IPC::Message::Sender implementation used to forward messages to the |
| 26 // GPU thread. |
| 27 virtual bool Send(IPC::Message* message); |
| 28 |
| 29 GpuMessageHub* GetMessageHub() { return message_hub_.get(); } |
| 30 |
| 31 private: |
| 32 GpuThreadHost(); |
| 33 ~GpuThreadHost(); |
| 34 |
| 35 template<class T> friend class DeleteTask; |
| 36 |
| 37 GpuChannelManager* gpu_channel_manager_; |
| 38 |
| 39 // This member handles incoming messages from the GPU process that |
| 40 // are either going to the UI thread or are replies to the renderer. |
| 41 scoped_ptr<GpuMessageHub> message_hub_; |
| 42 |
| 43 IPC::Channel::Sender* browser_sender_; |
| 44 |
| 45 static GpuThreadHost* g_instance; |
| 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(GpuThreadHost); |
| 48 }; |
| 49 |
| 50 #endif // CONTENT_BROWSER_GPU_GPU_THREAD_HOST_H_ |
OLD | NEW |