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