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 uint32 InsertSyncPoint() override { | 78 void GenerateSyncToken(gpu::SyncToken* sync_token) override { |
79 if (sync_token_.HasData()) { | 79 if (sync_token_.HasData()) { |
80 DCHECK_EQ(gpu::CommandBufferNamespace::OLD_SYNC_POINTS, | 80 *sync_token = sync_token_; |
81 sync_token_.namespace_id()); | 81 } else { |
82 return static_cast<uint32>(sync_token_.release_count()); | 82 const uint64_t fence_sync = gl_->InsertFenceSyncCHROMIUM(); |
| 83 gl_->ShallowFlushCHROMIUM(); |
| 84 gl_->GenSyncTokenCHROMIUM(fence_sync, sync_token->GetData()); |
83 } | 85 } |
84 return gl_->InsertSyncPointCHROMIUM(); | |
85 } | 86 } |
86 void WaitSyncToken(const gpu::SyncToken& sync_token) override { | 87 void WaitSyncToken(const gpu::SyncToken& sync_token) override { |
87 if (sync_token.HasData()) { | 88 if (sync_token.HasData()) { |
88 gl_->WaitSyncTokenCHROMIUM(sync_token.GetConstData()); | 89 gl_->WaitSyncTokenCHROMIUM(sync_token.GetConstData()); |
89 if (sync_token_.HasData()) { | 90 if (sync_token_.HasData()) { |
90 gl_->WaitSyncTokenCHROMIUM(sync_token_.GetConstData()); | 91 gl_->WaitSyncTokenCHROMIUM(sync_token_.GetConstData()); |
91 sync_token_.Clear(); | 92 sync_token_.Clear(); |
92 } | 93 } |
93 } | 94 } |
94 } | 95 } |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 resource_it->ref_count = 0; | 477 resource_it->ref_count = 0; |
477 updater->DeleteResource(resource_it); | 478 updater->DeleteResource(resource_it); |
478 return; | 479 return; |
479 } | 480 } |
480 | 481 |
481 --resource_it->ref_count; | 482 --resource_it->ref_count; |
482 DCHECK_GE(resource_it->ref_count, 0); | 483 DCHECK_GE(resource_it->ref_count, 0); |
483 } | 484 } |
484 | 485 |
485 } // namespace cc | 486 } // namespace cc |
OLD | NEW |