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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 driver_task_runner_->PostTask( | 101 driver_task_runner_->PostTask( |
102 FROM_HERE, base::Bind(&CommandBufferDriver::DestroyTransferBuffer, | 102 FROM_HERE, base::Bind(&CommandBufferDriver::DestroyTransferBuffer, |
103 base::Unretained(driver_.get()), id)); | 103 base::Unretained(driver_.get()), id)); |
104 } | 104 } |
105 | 105 |
106 void CommandBufferImpl::InsertSyncPoint(bool retire) { | 106 void CommandBufferImpl::InsertSyncPoint(bool retire) { |
107 uint32_t sync_point = sync_point_manager_->GenerateSyncPoint(); | 107 uint32_t sync_point = sync_point_manager_->GenerateSyncPoint(); |
108 sync_point_client_->DidInsertSyncPoint(sync_point); | 108 sync_point_client_->DidInsertSyncPoint(sync_point); |
109 if (retire) { | 109 if (retire) { |
110 driver_task_runner_->PostTask( | 110 driver_task_runner_->PostTask( |
111 FROM_HERE, base::Bind(&gpu::SyncPointManager::RetireSyncPoint, | 111 FROM_HERE, |
112 sync_point_manager_, sync_point)); | 112 base::Bind(&gpu::SyncPointManager::RetireSyncPoint, |
113 base::Unretained(sync_point_manager_), sync_point)); | |
msw
2015/07/21 00:46:03
What guarantees that |sync_point_manager_| exists
boliu
2015/07/21 00:57:19
Hmm, I'm not sure actually.
It outlives the "cont
| |
113 } | 114 } |
114 } | 115 } |
115 | 116 |
116 void CommandBufferImpl::RetireSyncPoint(uint32_t sync_point) { | 117 void CommandBufferImpl::RetireSyncPoint(uint32_t sync_point) { |
117 driver_task_runner_->PostTask( | 118 driver_task_runner_->PostTask( |
118 FROM_HERE, base::Bind(&gpu::SyncPointManager::RetireSyncPoint, | 119 FROM_HERE, base::Bind(&gpu::SyncPointManager::RetireSyncPoint, |
119 sync_point_manager_, sync_point)); | 120 base::Unretained(sync_point_manager_), sync_point)); |
120 } | 121 } |
121 | 122 |
122 void CommandBufferImpl::Echo(const mojo::Callback<void()>& callback) { | 123 void CommandBufferImpl::Echo(const mojo::Callback<void()>& callback) { |
123 driver_task_runner_->PostTaskAndReply(FROM_HERE, base::Bind(&base::DoNothing), | 124 driver_task_runner_->PostTaskAndReply(FROM_HERE, base::Bind(&base::DoNothing), |
124 base::Bind(&RunCallback, callback)); | 125 base::Bind(&RunCallback, callback)); |
125 } | 126 } |
126 | 127 |
127 void CommandBufferImpl::CreateImage(int32_t id, | 128 void CommandBufferImpl::CreateImage(int32_t id, |
128 mojo::ScopedHandle memory_handle, | 129 mojo::ScopedHandle memory_handle, |
129 int32 type, | 130 int32 type, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
172 | 173 |
173 void CommandBufferImpl::UpdateVSyncParameters(base::TimeTicks timebase, | 174 void CommandBufferImpl::UpdateVSyncParameters(base::TimeTicks timebase, |
174 base::TimeDelta interval) { | 175 base::TimeDelta interval) { |
175 if (!viewport_parameter_listener_) | 176 if (!viewport_parameter_listener_) |
176 return; | 177 return; |
177 viewport_parameter_listener_->OnVSyncParametersUpdated( | 178 viewport_parameter_listener_->OnVSyncParametersUpdated( |
178 timebase.ToInternalValue(), interval.ToInternalValue()); | 179 timebase.ToInternalValue(), interval.ToInternalValue()); |
179 } | 180 } |
180 | 181 |
181 } // namespace gles2 | 182 } // namespace gles2 |
OLD | NEW |