OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "components/view_manager/gles2/command_buffer_impl.h" | 5 #include "components/view_manager/gles2/command_buffer_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "components/view_manager/gles2/command_buffer_driver.h" | 9 #include "components/view_manager/gles2/command_buffer_driver.h" |
10 #include "components/view_manager/gles2/command_buffer_impl_observer.h" | 10 #include "components/view_manager/gles2/command_buffer_impl_observer.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 driver_task_runner_->PostTask( | 130 driver_task_runner_->PostTask( |
131 FROM_HERE, base::Bind(&gpu::SyncPointManager::RetireSyncPoint, | 131 FROM_HERE, base::Bind(&gpu::SyncPointManager::RetireSyncPoint, |
132 sync_point_manager_, sync_point)); | 132 sync_point_manager_, sync_point)); |
133 } | 133 } |
134 | 134 |
135 void CommandBufferImpl::Echo(const mojo::Callback<void()>& callback) { | 135 void CommandBufferImpl::Echo(const mojo::Callback<void()>& callback) { |
136 driver_task_runner_->PostTaskAndReply(FROM_HERE, base::Bind(&base::DoNothing), | 136 driver_task_runner_->PostTaskAndReply(FROM_HERE, base::Bind(&base::DoNothing), |
137 base::Bind(&RunCallback, callback)); | 137 base::Bind(&RunCallback, callback)); |
138 } | 138 } |
139 | 139 |
| 140 void CommandBufferImpl::CreateImage(int32_t id, |
| 141 mojo::ScopedHandle memory_handle, |
| 142 int32 type, |
| 143 mojo::SizePtr size, |
| 144 int32_t format, |
| 145 int32_t internal_format) { |
| 146 driver_task_runner_->PostTask( |
| 147 FROM_HERE, base::Bind(&CommandBufferDriver::CreateImage, |
| 148 base::Unretained(driver_.get()), id, |
| 149 base::Passed(&memory_handle), type, |
| 150 base::Passed(&size), format, internal_format)); |
| 151 } |
| 152 |
| 153 void CommandBufferImpl::DestroyImage(int32_t id) { |
| 154 driver_task_runner_->PostTask( |
| 155 FROM_HERE, base::Bind(&CommandBufferDriver::DestroyImage, |
| 156 base::Unretained(driver_.get()), id)); |
| 157 } |
| 158 |
140 CommandBufferImpl::~CommandBufferImpl() { | 159 CommandBufferImpl::~CommandBufferImpl() { |
141 if (observer_) | 160 if (observer_) |
142 observer_->OnCommandBufferImplDestroyed(); | 161 observer_->OnCommandBufferImplDestroyed(); |
143 driver_task_runner_->PostTask( | 162 driver_task_runner_->PostTask( |
144 FROM_HERE, base::Bind(&DestroyDriver, base::Passed(&driver_))); | 163 FROM_HERE, base::Bind(&DestroyDriver, base::Passed(&driver_))); |
145 } | 164 } |
146 | 165 |
147 void CommandBufferImpl::BindToRequest( | 166 void CommandBufferImpl::BindToRequest( |
148 mojo::InterfaceRequest<mojo::CommandBuffer> request) { | 167 mojo::InterfaceRequest<mojo::CommandBuffer> request) { |
149 binding_.Bind(request.Pass()); | 168 binding_.Bind(request.Pass()); |
(...skipping 13 matching lines...) Expand all Loading... |
163 | 182 |
164 void CommandBufferImpl::UpdateVSyncParameters(base::TimeTicks timebase, | 183 void CommandBufferImpl::UpdateVSyncParameters(base::TimeTicks timebase, |
165 base::TimeDelta interval) { | 184 base::TimeDelta interval) { |
166 if (!viewport_parameter_listener_) | 185 if (!viewport_parameter_listener_) |
167 return; | 186 return; |
168 viewport_parameter_listener_->OnVSyncParametersUpdated( | 187 viewport_parameter_listener_->OnVSyncParametersUpdated( |
169 timebase.ToInternalValue(), interval.ToInternalValue()); | 188 timebase.ToInternalValue(), interval.ToInternalValue()); |
170 } | 189 } |
171 | 190 |
172 } // namespace gles2 | 191 } // namespace gles2 |
OLD | NEW |