OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_GPU_COMMAND_BUFFER_STUB_H_ | 5 #ifndef CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
6 #define CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 6 #define CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #if defined(ENABLE_GPU) | 9 #if defined(ENABLE_GPU) |
10 | 10 |
11 #include <queue> | 11 #include <queue> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/process.h" | 16 #include "base/process.h" |
17 #include "base/task.h" | 17 #include "base/task.h" |
18 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" | |
18 #include "gpu/command_buffer/service/command_buffer_service.h" | 19 #include "gpu/command_buffer/service/command_buffer_service.h" |
19 #include "gpu/command_buffer/service/gpu_scheduler.h" | 20 #include "gpu/command_buffer/service/gpu_scheduler.h" |
20 #include "ipc/ipc_channel.h" | 21 #include "ipc/ipc_channel.h" |
21 #include "ipc/ipc_message.h" | 22 #include "ipc/ipc_message.h" |
22 #include "ui/gfx/native_widget_types.h" | 23 #include "ui/gfx/native_widget_types.h" |
23 #include "ui/gfx/size.h" | 24 #include "ui/gfx/size.h" |
24 | 25 |
25 class GpuChannel; | 26 class GpuChannel; |
26 class GpuWatchdog; | 27 class GpuWatchdog; |
27 | 28 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 | 89 |
89 // Called when the command buffer was destroyed, and the stub should now | 90 // Called when the command buffer was destroyed, and the stub should now |
90 // unblock itself and handle pending messages. | 91 // unblock itself and handle pending messages. |
91 void CommandBufferWasDestroyed(); | 92 void CommandBufferWasDestroyed(); |
92 | 93 |
93 // Register a callback to be Run() whenever the underlying scheduler receives | 94 // Register a callback to be Run() whenever the underlying scheduler receives |
94 // a set_token() call. The callback will be Run() with the just-set token as | 95 // a set_token() call. The callback will be Run() with the just-set token as |
95 // its only parameter. Multiple callbacks may be registered. | 96 // its only parameter. Multiple callbacks may be registered. |
96 void AddSetTokenCallback(const base::Callback<void(int32)>& callback); | 97 void AddSetTokenCallback(const base::Callback<void(int32)>& callback); |
97 | 98 |
99 void set_video_decoder(GpuVideoDecodeAccelerator* video_decoder) { | |
100 DCHECK(!video_decoder_.get()); | |
101 video_decoder_.reset(video_decoder); | |
102 } | |
103 | |
104 void DestroyVideoDecoder() { | |
Ami GONE FROM CHROMIUM
2011/06/30 22:20:39
Destroy* implies to me that this class should have
vrk (LEFT CHROMIUM)
2011/07/01 18:12:14
Destroying is now done directly in GpuCommandBuffe
| |
105 video_decoder_.reset(); | |
106 } | |
107 | |
98 private: | 108 private: |
99 // Message handlers: | 109 // Message handlers: |
100 void OnInitialize(base::SharedMemoryHandle ring_buffer, | 110 void OnInitialize(base::SharedMemoryHandle ring_buffer, |
101 int32 size, | 111 int32 size, |
102 IPC::Message* reply_message); | 112 IPC::Message* reply_message); |
103 void OnSetParent(int32 parent_route_id, | 113 void OnSetParent(int32 parent_route_id, |
104 uint32 parent_texture_id, | 114 uint32 parent_texture_id, |
105 IPC::Message* reply_message); | 115 IPC::Message* reply_message); |
106 void OnGetState(IPC::Message* reply_message); | 116 void OnGetState(IPC::Message* reply_message); |
107 void OnFlush(int32 put_offset, | 117 void OnFlush(int32 put_offset, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 std::vector<base::Callback<void(int32)> > set_token_callbacks_; | 174 std::vector<base::Callback<void(int32)> > set_token_callbacks_; |
165 | 175 |
166 // SetParent may be called before Initialize, in which case we need to keep | 176 // SetParent may be called before Initialize, in which case we need to keep |
167 // around the parent stub, so that Initialize can set the parent correctly. | 177 // around the parent stub, so that Initialize can set the parent correctly. |
168 base::WeakPtr<GpuCommandBufferStub> parent_stub_for_initialization_; | 178 base::WeakPtr<GpuCommandBufferStub> parent_stub_for_initialization_; |
169 uint32 parent_texture_for_initialization_; | 179 uint32 parent_texture_for_initialization_; |
170 | 180 |
171 GpuWatchdog* watchdog_; | 181 GpuWatchdog* watchdog_; |
172 ScopedRunnableMethodFactory<GpuCommandBufferStub> task_factory_; | 182 ScopedRunnableMethodFactory<GpuCommandBufferStub> task_factory_; |
173 | 183 |
184 // The video decoder associated with this stub, if any. | |
185 scoped_ptr<GpuVideoDecodeAccelerator> video_decoder_; | |
186 | |
174 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); | 187 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); |
175 }; | 188 }; |
176 | 189 |
177 #endif // defined(ENABLE_GPU) | 190 #endif // defined(ENABLE_GPU) |
178 | 191 |
179 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 192 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
OLD | NEW |