Chromium Code Reviews| Index: content/common/gpu/gpu_command_buffer_stub.cc |
| diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc |
| index 4de06dbfc8381f52a62cc7c8664246ec37644cce..96632613dedd10e0afacba227cb2003ae45e1941 100644 |
| --- a/content/common/gpu/gpu_command_buffer_stub.cc |
| +++ b/content/common/gpu/gpu_command_buffer_stub.cc |
| @@ -198,7 +198,7 @@ GpuCommandBufferStub::GpuCommandBufferStub( |
| last_flush_count_(0), |
| last_memory_allocation_valid_(false), |
| watchdog_(watchdog), |
| - sync_point_wait_count_(0), |
| + waiting_for_sync_point_(false), |
| delayed_work_scheduled_(false), |
| previous_processed_num_(0), |
| active_url_(active_url), |
| @@ -620,9 +620,8 @@ void GpuCommandBufferStub::OnInitialize( |
| base::Unretained(scheduler_.get()))); |
| command_buffer_->SetParseErrorCallback( |
| base::Bind(&GpuCommandBufferStub::OnParseError, base::Unretained(this))); |
| - scheduler_->SetSchedulingChangedCallback( |
| - base::Bind(&GpuChannel::StubSchedulingChanged, |
| - base::Unretained(channel_))); |
| + scheduler_->SetSchedulingChangedCallback(base::Bind( |
| + &GpuCommandBufferStub::OnSchedulingChanged, base::Unretained(this))); |
| if (watchdog_) { |
| scheduler_->SetCommandProcessedCallback( |
| @@ -718,6 +717,12 @@ void GpuCommandBufferStub::OnParseError() { |
| CheckContextLost(); |
| } |
| +void GpuCommandBufferStub::OnSchedulingChanged(bool scheduled) { |
| + TRACE_EVENT1("gpu", "GpuCommandBufferStub::OnSchedulingChanged", "scheduled", |
| + scheduled); |
| + channel_->OnStubSchedulingChanged(this, scheduled); |
| +} |
| + |
| void GpuCommandBufferStub::OnWaitForTokenInRange(int32 start, |
| int32 end, |
| IPC::Message* reply_message) { |
| @@ -900,6 +905,7 @@ void GpuCommandBufferStub::OnRetireSyncPoint(uint32 sync_point) { |
| } |
| bool GpuCommandBufferStub::OnWaitSyncPoint(uint32 sync_point) { |
| + DCHECK(!waiting_for_sync_point_); |
| if (!sync_point) |
| return true; |
| GpuChannelManager* manager = channel_->gpu_channel_manager(); |
| @@ -908,27 +914,25 @@ bool GpuCommandBufferStub::OnWaitSyncPoint(uint32 sync_point) { |
| return true; |
| } |
| - if (sync_point_wait_count_ == 0) { |
| - TRACE_EVENT_ASYNC_BEGIN1("gpu", "WaitSyncPoint", this, |
| - "GpuCommandBufferStub", this); |
| - } |
| + TRACE_EVENT_ASYNC_BEGIN1("gpu", "WaitSyncPoint", this, "GpuCommandBufferStub", |
| + this); |
| + |
| scheduler_->SetScheduled(false); |
| - ++sync_point_wait_count_; |
| + waiting_for_sync_point_ = true; |
| manager->sync_point_manager()->AddSyncPointCallback( |
| sync_point, |
| base::Bind(&RunOnThread, task_runner_, |
| base::Bind(&GpuCommandBufferStub::OnWaitSyncPointCompleted, |
| this->AsWeakPtr(), sync_point))); |
| - return scheduler_->IsScheduled(); |
| + return waiting_for_sync_point_; |
|
piman
2015/09/16 23:21:09
return !waiting_for_sync_point_;
sunnyps
2015/09/16 23:38:42
Done.
|
| } |
| void GpuCommandBufferStub::OnWaitSyncPointCompleted(uint32 sync_point) { |
| + DCHECK(waiting_for_sync_point_); |
| + TRACE_EVENT_ASYNC_END1("gpu", "WaitSyncPoint", this, "GpuCommandBufferStub", |
| + this); |
| PullTextureUpdates(sync_point); |
| - --sync_point_wait_count_; |
| - if (sync_point_wait_count_ == 0) { |
| - TRACE_EVENT_ASYNC_END1("gpu", "WaitSyncPoint", this, |
| - "GpuCommandBufferStub", this); |
| - } |
| + waiting_for_sync_point_ = false; |
| scheduler_->SetScheduled(true); |
| } |