| 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_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ |
| 6 #define CONTENT_COMMON_GPU_CLIENT_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> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 struct GpuListenerInfo { | 44 struct GpuListenerInfo { |
| 45 GpuListenerInfo(); | 45 GpuListenerInfo(); |
| 46 ~GpuListenerInfo(); | 46 ~GpuListenerInfo(); |
| 47 | 47 |
| 48 base::WeakPtr<IPC::Channel::Listener> listener; | 48 base::WeakPtr<IPC::Channel::Listener> listener; |
| 49 scoped_refptr<base::MessageLoopProxy> loop; | 49 scoped_refptr<base::MessageLoopProxy> loop; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 class CONTENT_EXPORT GpuChannelHostFactory { | 52 class CONTENT_EXPORT GpuChannelHostFactory { |
| 53 public: | 53 public: |
| 54 virtual ~GpuChannelHostFactory(); | 54 virtual ~GpuChannelHostFactory() {} |
| 55 static GpuChannelHostFactory* instance() { return instance_; } | |
| 56 | 55 |
| 57 virtual bool IsMainThread() = 0; | 56 virtual bool IsMainThread() = 0; |
| 58 virtual bool IsIOThread() = 0; | 57 virtual bool IsIOThread() = 0; |
| 59 virtual MessageLoop* GetMainLoop() = 0; | 58 virtual MessageLoop* GetMainLoop() = 0; |
| 60 virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() = 0; | 59 virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() = 0; |
| 61 virtual base::WaitableEvent* GetShutDownEvent() = 0; | 60 virtual base::WaitableEvent* GetShutDownEvent() = 0; |
| 62 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(uint32 size) = 0; | 61 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(uint32 size) = 0; |
| 63 virtual int32 CreateViewCommandBuffer( | 62 virtual int32 CreateViewCommandBuffer( |
| 64 int32 surface_id, const GPUCreateCommandBufferConfig& init_params) = 0; | 63 int32 surface_id, const GPUCreateCommandBufferConfig& init_params) = 0; |
| 65 virtual GpuChannelHost* EstablishGpuChannelSync( | 64 virtual GpuChannelHost* EstablishGpuChannelSync( |
| 66 content::CauseForGpuLaunch) = 0; | 65 content::CauseForGpuLaunch) = 0; |
| 67 | |
| 68 protected: | |
| 69 static void set_instance(GpuChannelHostFactory* instance) { | |
| 70 instance_ = instance; | |
| 71 } | |
| 72 | |
| 73 private: | |
| 74 static GpuChannelHostFactory* instance_; | |
| 75 }; | 66 }; |
| 76 | 67 |
| 77 // Encapsulates an IPC channel between the client and one GPU process. | 68 // Encapsulates an IPC channel between the client and one GPU process. |
| 78 // On the GPU process side there's a corresponding GpuChannel. | 69 // On the GPU process side there's a corresponding GpuChannel. |
| 79 class GpuChannelHost : public IPC::Message::Sender, | 70 class GpuChannelHost : public IPC::Message::Sender, |
| 80 public base::RefCountedThreadSafe<GpuChannelHost> { | 71 public base::RefCountedThreadSafe<GpuChannelHost> { |
| 81 public: | 72 public: |
| 82 enum State { | 73 enum State { |
| 83 // Not yet connected. | 74 // Not yet connected. |
| 84 kUnconnected, | 75 kUnconnected, |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 // for calls from contexts that may live on the compositor or main thread. | 197 // for calls from contexts that may live on the compositor or main thread. |
| 207 mutable base::Lock context_lock_; | 198 mutable base::Lock context_lock_; |
| 208 | 199 |
| 209 // A filter for sending messages from thread other than the main thread. | 200 // A filter for sending messages from thread other than the main thread. |
| 210 scoped_refptr<IPC::SyncMessageFilter> sync_filter_; | 201 scoped_refptr<IPC::SyncMessageFilter> sync_filter_; |
| 211 | 202 |
| 212 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); | 203 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); |
| 213 }; | 204 }; |
| 214 | 205 |
| 215 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ | 206 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ |
| OLD | NEW |