| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 flushed_fence_sync_release_(0), | 207 flushed_fence_sync_release_(0), |
| 208 flush_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, | 208 flush_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 209 base::WaitableEvent::InitialState::NOT_SIGNALED), | 209 base::WaitableEvent::InitialState::NOT_SIGNALED), |
| 210 service_(GetInitialService(service)), | 210 service_(GetInitialService(service)), |
| 211 fence_sync_wait_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, | 211 fence_sync_wait_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 212 base::WaitableEvent::InitialState::NOT_SIGNALED), | 212 base::WaitableEvent::InitialState::NOT_SIGNALED), |
| 213 client_thread_weak_ptr_factory_(this), | 213 client_thread_weak_ptr_factory_(this), |
| 214 gpu_thread_weak_ptr_factory_(this) { | 214 gpu_thread_weak_ptr_factory_(this) { |
| 215 DCHECK(service_.get()); | 215 DCHECK(service_.get()); |
| 216 next_image_id_.GetNext(); | 216 next_image_id_.GetNext(); |
| 217 LOG(ERROR) << "InProcessCommandBuffer " << this; |
| 217 } | 218 } |
| 218 | 219 |
| 219 InProcessCommandBuffer::~InProcessCommandBuffer() { | 220 InProcessCommandBuffer::~InProcessCommandBuffer() { |
| 220 Destroy(); | 221 Destroy(); |
| 222 LOG(ERROR) << "~InProcessCommandBuffer " << this; |
| 221 } | 223 } |
| 222 | 224 |
| 223 bool InProcessCommandBuffer::MakeCurrent() { | 225 bool InProcessCommandBuffer::MakeCurrent() { |
| 224 CheckSequencedThread(); | 226 CheckSequencedThread(); |
| 225 command_buffer_lock_.AssertAcquired(); | 227 command_buffer_lock_.AssertAcquired(); |
| 226 | 228 |
| 227 if (error::IsError(command_buffer_->GetLastState().error)) { | 229 if (error::IsError(command_buffer_->GetLastState().error)) { |
| 228 DLOG(ERROR) << "MakeCurrent failed because context lost."; | 230 DLOG(ERROR) << "MakeCurrent failed because context lost."; |
| 229 return false; | 231 return false; |
| 230 } | 232 } |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 } | 976 } |
| 975 | 977 |
| 976 namespace { | 978 namespace { |
| 977 | 979 |
| 978 void PostCallback( | 980 void PostCallback( |
| 979 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 981 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 980 const base::Closure& callback) { | 982 const base::Closure& callback) { |
| 981 // The task_runner.get() check is to support using InProcessCommandBuffer on | 983 // The task_runner.get() check is to support using InProcessCommandBuffer on |
| 982 // a thread without a message loop. | 984 // a thread without a message loop. |
| 983 if (task_runner.get() && !task_runner->BelongsToCurrentThread()) { | 985 if (task_runner.get() && !task_runner->BelongsToCurrentThread()) { |
| 984 task_runner->PostTask(FROM_HERE, callback); | 986 task_runner->PostDelayedTask(FROM_HERE, callback, base::TimeDelta::FromSecon
ds(3)); |
| 985 } else { | 987 } else { |
| 986 callback.Run(); | 988 callback.Run(); |
| 987 } | 989 } |
| 988 } | 990 } |
| 989 | 991 |
| 990 void RunOnTargetThread(std::unique_ptr<base::Closure> callback) { | 992 void RunOnTargetThread(std::unique_ptr<base::Closure> callback) { |
| 991 DCHECK(callback.get()); | 993 DCHECK(callback.get()); |
| 992 callback->Run(); | 994 callback->Run(); |
| 993 } | 995 } |
| 994 | 996 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 framebuffer_completeness_cache_ = | 1056 framebuffer_completeness_cache_ = |
| 1055 new gpu::gles2::FramebufferCompletenessCache; | 1057 new gpu::gles2::FramebufferCompletenessCache; |
| 1056 return framebuffer_completeness_cache_; | 1058 return framebuffer_completeness_cache_; |
| 1057 } | 1059 } |
| 1058 | 1060 |
| 1059 SyncPointManager* GpuInProcessThread::sync_point_manager() { | 1061 SyncPointManager* GpuInProcessThread::sync_point_manager() { |
| 1060 return sync_point_manager_; | 1062 return sync_point_manager_; |
| 1061 } | 1063 } |
| 1062 | 1064 |
| 1063 } // namespace gpu | 1065 } // namespace gpu |
| OLD | NEW |