OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/resource_provider.h" | 5 #include "cc/resources/resource_provider.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 base::hash_map<unsigned, uint32_t> sync_point_for_mailbox_; | 186 base::hash_map<unsigned, uint32_t> sync_point_for_mailbox_; |
187 }; | 187 }; |
188 | 188 |
189 class ResourceProviderContext : public TestWebGraphicsContext3D { | 189 class ResourceProviderContext : public TestWebGraphicsContext3D { |
190 public: | 190 public: |
191 static scoped_ptr<ResourceProviderContext> Create( | 191 static scoped_ptr<ResourceProviderContext> Create( |
192 ContextSharedData* shared_data) { | 192 ContextSharedData* shared_data) { |
193 return make_scoped_ptr(new ResourceProviderContext(shared_data)); | 193 return make_scoped_ptr(new ResourceProviderContext(shared_data)); |
194 } | 194 } |
195 | 195 |
196 GLuint insertSyncPoint() override { | |
197 const uint32_t sync_point = | |
198 static_cast<uint32_t>(shared_data_->InsertFenceSync()); | |
199 gpu::SyncToken sync_token_data(sync_point); | |
200 | |
201 // Commit the produceTextureCHROMIUM calls at this point, so that | |
202 // they're associated with the sync point. | |
203 for (const scoped_ptr<PendingProduceTexture>& pending_texture : | |
204 pending_produce_textures_) { | |
205 shared_data_->ProduceTexture(pending_texture->mailbox, sync_token_data, | |
206 pending_texture->texture); | |
207 } | |
208 pending_produce_textures_.clear(); | |
209 return sync_point; | |
210 } | |
211 | |
212 GLuint64 insertFenceSync() override { | 196 GLuint64 insertFenceSync() override { |
213 return shared_data_->InsertFenceSync(); | 197 return shared_data_->InsertFenceSync(); |
214 } | 198 } |
215 | 199 |
216 void genSyncToken(GLuint64 fence_sync, GLbyte* sync_token) override { | 200 void genSyncToken(GLuint64 fence_sync, GLbyte* sync_token) override { |
217 gpu::SyncToken sync_token_data(gpu::CommandBufferNamespace::GPU_IO, 0, | 201 gpu::SyncToken sync_token_data(gpu::CommandBufferNamespace::GPU_IO, 0, |
218 0x123, fence_sync); | 202 0x123, fence_sync); |
219 sync_token_data.SetVerifyFlush(); | 203 sync_token_data.SetVerifyFlush(); |
220 // Commit the produceTextureCHROMIUM calls at this point, so that | 204 // Commit the produceTextureCHROMIUM calls at this point, so that |
221 // they're associated with the sync point. | 205 // they're associated with the sync point. |
(...skipping 3407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3629 EXPECT_TRUE(resource_provider_->CanLockForWrite(id)); | 3613 EXPECT_TRUE(resource_provider_->CanLockForWrite(id)); |
3630 EXPECT_FALSE(resource_provider_->InUseByConsumer(id)); | 3614 EXPECT_FALSE(resource_provider_->InUseByConsumer(id)); |
3631 gpu_memory_buffer_manager_->SetGpuMemoryBufferIsInUseByMacOSWindowServer( | 3615 gpu_memory_buffer_manager_->SetGpuMemoryBufferIsInUseByMacOSWindowServer( |
3632 gpu_memory_buffer, true); | 3616 gpu_memory_buffer, true); |
3633 EXPECT_FALSE(resource_provider_->CanLockForWrite(id)); | 3617 EXPECT_FALSE(resource_provider_->CanLockForWrite(id)); |
3634 EXPECT_TRUE(resource_provider_->InUseByConsumer(id)); | 3618 EXPECT_TRUE(resource_provider_->InUseByConsumer(id)); |
3635 } | 3619 } |
3636 | 3620 |
3637 } // namespace | 3621 } // namespace |
3638 } // namespace cc | 3622 } // namespace cc |
OLD | NEW |