| 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 "cc/resources/video_resource_updater.h" | 5 #include "cc/resources/video_resource_updater.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 return VideoFrameExternalResources::NONE; | 69 return VideoFrameExternalResources::NONE; |
| 70 } | 70 } |
| 71 | 71 |
| 72 class SyncTokenClientImpl : public media::VideoFrame::SyncTokenClient { | 72 class SyncTokenClientImpl : public media::VideoFrame::SyncTokenClient { |
| 73 public: | 73 public: |
| 74 SyncTokenClientImpl(gpu::gles2::GLES2Interface* gl, | 74 SyncTokenClientImpl(gpu::gles2::GLES2Interface* gl, |
| 75 const gpu::SyncToken& sync_token) | 75 const gpu::SyncToken& sync_token) |
| 76 : gl_(gl), sync_token_(sync_token) {} | 76 : gl_(gl), sync_token_(sync_token) {} |
| 77 ~SyncTokenClientImpl() override {} | 77 ~SyncTokenClientImpl() override {} |
| 78 void GenerateSyncToken(gpu::SyncToken* sync_token) override { | 78 uint32 InsertSyncPoint() override { |
| 79 if (sync_token_.HasData()) { | 79 if (sync_token_.HasData()) { |
| 80 *sync_token = sync_token_; | 80 DCHECK_EQ(gpu::CommandBufferNamespace::OLD_SYNC_POINTS, |
| 81 } else { | 81 sync_token_.namespace_id()); |
| 82 const uint64_t fence_sync = gl_->InsertFenceSyncCHROMIUM(); | 82 return static_cast<uint32>(sync_token_.release_count()); |
| 83 gl_->ShallowFlushCHROMIUM(); | |
| 84 gl_->GenSyncTokenCHROMIUM(fence_sync, sync_token->GetData()); | |
| 85 } | 83 } |
| 84 return gl_->InsertSyncPointCHROMIUM(); |
| 86 } | 85 } |
| 87 void WaitSyncToken(const gpu::SyncToken& sync_token) override { | 86 void WaitSyncToken(const gpu::SyncToken& sync_token) override { |
| 88 if (sync_token.HasData()) { | 87 if (sync_token.HasData()) { |
| 89 gl_->WaitSyncTokenCHROMIUM(sync_token.GetConstData()); | 88 gl_->WaitSyncTokenCHROMIUM(sync_token.GetConstData()); |
| 90 if (sync_token_.HasData()) { | 89 if (sync_token_.HasData()) { |
| 91 gl_->WaitSyncTokenCHROMIUM(sync_token_.GetConstData()); | 90 gl_->WaitSyncTokenCHROMIUM(sync_token_.GetConstData()); |
| 92 sync_token_.Clear(); | 91 sync_token_.Clear(); |
| 93 } | 92 } |
| 94 } | 93 } |
| 95 } | 94 } |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 resource_it->ref_count = 0; | 476 resource_it->ref_count = 0; |
| 478 updater->DeleteResource(resource_it); | 477 updater->DeleteResource(resource_it); |
| 479 return; | 478 return; |
| 480 } | 479 } |
| 481 | 480 |
| 482 --resource_it->ref_count; | 481 --resource_it->ref_count; |
| 483 DCHECK_GE(resource_it->ref_count, 0); | 482 DCHECK_GE(resource_it->ref_count, 0); |
| 484 } | 483 } |
| 485 | 484 |
| 486 } // namespace cc | 485 } // namespace cc |
| OLD | NEW |