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_BROWSER_GPU_BROWSER_GPU_CHANNEL_HOST_FACTORY_H_ | 5 #ifndef CONTENT_BROWSER_GPU_BROWSER_GPU_CHANNEL_HOST_FACTORY_H_ |
6 #define CONTENT_BROWSER_GPU_BROWSER_GPU_CHANNEL_HOST_FACTORY_H_ | 6 #define CONTENT_BROWSER_GPU_BROWSER_GPU_CHANNEL_HOST_FACTORY_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "content/common/gpu/client/gpu_channel_host.h" | 12 #include "content/common/gpu/client/gpu_channel_host.h" |
13 #include "ipc/message_filter.h" | 13 #include "ipc/message_filter.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 class GpuMemoryBufferImpl; | 16 class GpuMemoryBufferImpl; |
17 class GpuMemoryBufferFactoryHostImpl; | 17 class GpuMemoryBufferFactoryHostImpl; |
18 | 18 |
19 class CONTENT_EXPORT BrowserGpuChannelHostFactory | 19 class CONTENT_EXPORT BrowserGpuChannelHostFactory |
20 : public GpuChannelHostFactory { | 20 : public GpuChannelHostFactory { |
21 public: | 21 public: |
22 static void Initialize(bool establish_gpu_channel); | 22 static void Initialize(bool establish_gpu_channel); |
23 static void Terminate(); | 23 static void Terminate(); |
24 static BrowserGpuChannelHostFactory* instance() { return instance_; } | 24 static BrowserGpuChannelHostFactory* instance() { return instance_; } |
25 | 25 |
26 // GpuChannelHostFactory implementation. | 26 // GpuChannelHostFactory implementation. |
27 virtual bool IsMainThread() OVERRIDE; | 27 virtual bool IsMainThread() override; |
28 virtual base::MessageLoop* GetMainLoop() OVERRIDE; | 28 virtual base::MessageLoop* GetMainLoop() override; |
29 virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() OVERRIDE; | 29 virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() override; |
30 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory( | 30 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory( |
31 size_t size) OVERRIDE; | 31 size_t size) override; |
32 virtual CreateCommandBufferResult CreateViewCommandBuffer( | 32 virtual CreateCommandBufferResult CreateViewCommandBuffer( |
33 int32 surface_id, | 33 int32 surface_id, |
34 const GPUCreateCommandBufferConfig& init_params, | 34 const GPUCreateCommandBufferConfig& init_params, |
35 int32 route_id) OVERRIDE; | 35 int32 route_id) override; |
36 virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( | 36 virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( |
37 size_t width, | 37 size_t width, |
38 size_t height, | 38 size_t height, |
39 unsigned internalformat, | 39 unsigned internalformat, |
40 unsigned usage) OVERRIDE; | 40 unsigned usage) override; |
41 | 41 |
42 // Specify a task runner and callback to be used for a set of messages. The | 42 // Specify a task runner and callback to be used for a set of messages. The |
43 // callback will be set up on the current GpuProcessHost, identified by | 43 // callback will be set up on the current GpuProcessHost, identified by |
44 // GpuProcessHostId(). | 44 // GpuProcessHostId(). |
45 virtual void SetHandlerForControlMessages( | 45 virtual void SetHandlerForControlMessages( |
46 const uint32* message_ids, | 46 const uint32* message_ids, |
47 size_t num_messages, | 47 size_t num_messages, |
48 const base::Callback<void(const IPC::Message&)>& handler, | 48 const base::Callback<void(const IPC::Message&)>& handler, |
49 base::TaskRunner* target_task_runner); | 49 base::TaskRunner* target_task_runner); |
50 int GpuProcessHostId() { return gpu_host_id_; } | 50 int GpuProcessHostId() { return gpu_host_id_; } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 std::vector<base::Closure> established_callbacks_; | 89 std::vector<base::Closure> established_callbacks_; |
90 | 90 |
91 static BrowserGpuChannelHostFactory* instance_; | 91 static BrowserGpuChannelHostFactory* instance_; |
92 | 92 |
93 DISALLOW_COPY_AND_ASSIGN(BrowserGpuChannelHostFactory); | 93 DISALLOW_COPY_AND_ASSIGN(BrowserGpuChannelHostFactory); |
94 }; | 94 }; |
95 | 95 |
96 } // namespace content | 96 } // namespace content |
97 | 97 |
98 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_CHANNEL_HOST_FACTORY_H_ | 98 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_CHANNEL_HOST_FACTORY_H_ |
OLD | NEW |