OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "gpu/command_buffer/service/in_process_command_buffer.h" | 5 #include "gpu/command_buffer/service/in_process_command_buffer.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 fence_sync_wait_event_(false, false), | 191 fence_sync_wait_event_(false, false), |
192 gpu_thread_weak_ptr_factory_(this) { | 192 gpu_thread_weak_ptr_factory_(this) { |
193 DCHECK(service_.get()); | 193 DCHECK(service_.get()); |
194 next_image_id_.GetNext(); | 194 next_image_id_.GetNext(); |
195 } | 195 } |
196 | 196 |
197 InProcessCommandBuffer::~InProcessCommandBuffer() { | 197 InProcessCommandBuffer::~InProcessCommandBuffer() { |
198 Destroy(); | 198 Destroy(); |
199 } | 199 } |
200 | 200 |
201 void InProcessCommandBuffer::OnResizeView(gfx::Size size, float scale_factor) { | |
202 CheckSequencedThread(); | |
203 DCHECK(!surface_->IsOffscreen()); | |
204 surface_->Resize(size); | |
205 } | |
206 | |
207 bool InProcessCommandBuffer::MakeCurrent() { | 201 bool InProcessCommandBuffer::MakeCurrent() { |
208 CheckSequencedThread(); | 202 CheckSequencedThread(); |
209 command_buffer_lock_.AssertAcquired(); | 203 command_buffer_lock_.AssertAcquired(); |
210 | 204 |
211 if (!context_lost_ && decoder_->MakeCurrent()) | 205 if (!context_lost_ && decoder_->MakeCurrent()) |
212 return true; | 206 return true; |
213 DLOG(ERROR) << "Context lost because MakeCurrent failed."; | 207 DLOG(ERROR) << "Context lost because MakeCurrent failed."; |
214 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason()); | 208 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason()); |
215 command_buffer_->SetParseError(gpu::error::kLostContext); | 209 command_buffer_->SetParseError(gpu::error::kLostContext); |
216 return false; | 210 return false; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 params.is_offscreen, | 398 params.is_offscreen, |
405 params.size, | 399 params.size, |
406 disallowed_features, | 400 disallowed_features, |
407 params.attribs)) { | 401 params.attribs)) { |
408 LOG(ERROR) << "Could not initialize decoder."; | 402 LOG(ERROR) << "Could not initialize decoder."; |
409 DestroyOnGpuThread(); | 403 DestroyOnGpuThread(); |
410 return false; | 404 return false; |
411 } | 405 } |
412 *params.capabilities = decoder_->GetCapabilities(); | 406 *params.capabilities = decoder_->GetCapabilities(); |
413 | 407 |
414 if (!params.is_offscreen) { | |
415 decoder_->SetResizeCallback(base::Bind( | |
416 &InProcessCommandBuffer::OnResizeView, gpu_thread_weak_ptr_)); | |
417 } | |
418 decoder_->SetWaitSyncPointCallback( | 408 decoder_->SetWaitSyncPointCallback( |
419 base::Bind(&InProcessCommandBuffer::WaitSyncPointOnGpuThread, | 409 base::Bind(&InProcessCommandBuffer::WaitSyncPointOnGpuThread, |
420 base::Unretained(this))); | 410 base::Unretained(this))); |
421 decoder_->SetFenceSyncReleaseCallback( | 411 decoder_->SetFenceSyncReleaseCallback( |
422 base::Bind(&InProcessCommandBuffer::FenceSyncReleaseOnGpuThread, | 412 base::Bind(&InProcessCommandBuffer::FenceSyncReleaseOnGpuThread, |
423 base::Unretained(this))); | 413 base::Unretained(this))); |
424 decoder_->SetWaitFenceSyncCallback( | 414 decoder_->SetWaitFenceSyncCallback( |
425 base::Bind(&InProcessCommandBuffer::WaitFenceSyncOnGpuThread, | 415 base::Bind(&InProcessCommandBuffer::WaitFenceSyncOnGpuThread, |
426 base::Unretained(this))); | 416 base::Unretained(this))); |
427 | 417 |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 framebuffer_completeness_cache_ = | 1083 framebuffer_completeness_cache_ = |
1094 new gpu::gles2::FramebufferCompletenessCache; | 1084 new gpu::gles2::FramebufferCompletenessCache; |
1095 return framebuffer_completeness_cache_; | 1085 return framebuffer_completeness_cache_; |
1096 } | 1086 } |
1097 | 1087 |
1098 SyncPointManager* GpuInProcessThread::sync_point_manager() { | 1088 SyncPointManager* GpuInProcessThread::sync_point_manager() { |
1099 return sync_point_manager_; | 1089 return sync_point_manager_; |
1100 } | 1090 } |
1101 | 1091 |
1102 } // namespace gpu | 1092 } // namespace gpu |
OLD | NEW |