| 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> |
| 11 #include <deque> | 11 #include <deque> |
| 12 #include <map> | 12 #include <map> |
| 13 #include <set> | 13 #include <set> |
| 14 #include <unordered_map> |
| 14 #include <vector> | 15 #include <vector> |
| 15 | 16 |
| 16 #include "base/bind.h" | 17 #include "base/bind.h" |
| 17 #include "base/containers/hash_tables.h" | |
| 18 #include "base/logging.h" | 18 #include "base/logging.h" |
| 19 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
| 20 #include "cc/output/output_surface.h" | 20 #include "cc/output/output_surface.h" |
| 21 #include "cc/resources/returned_resource.h" | 21 #include "cc/resources/returned_resource.h" |
| 22 #include "cc/resources/shared_bitmap_manager.h" | 22 #include "cc/resources/shared_bitmap_manager.h" |
| 23 #include "cc/resources/single_release_callback.h" | 23 #include "cc/resources/single_release_callback.h" |
| 24 #include "cc/test/fake_output_surface.h" | 24 #include "cc/test/fake_output_surface.h" |
| 25 #include "cc/test/fake_output_surface_client.h" | 25 #include "cc/test/fake_output_surface_client.h" |
| 26 #include "cc/test/test_gpu_memory_buffer_manager.h" | 26 #include "cc/test/test_gpu_memory_buffer_manager.h" |
| 27 #include "cc/test/test_shared_bitmap_manager.h" | 27 #include "cc/test/test_shared_bitmap_manager.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 return scoped_refptr<TestTexture>(); | 174 return scoped_refptr<TestTexture>(); |
| 175 } | 175 } |
| 176 return textures_[mailbox]; | 176 return textures_[mailbox]; |
| 177 } | 177 } |
| 178 | 178 |
| 179 private: | 179 private: |
| 180 ContextSharedData() : next_fence_sync_(1), next_mailbox_(1) {} | 180 ContextSharedData() : next_fence_sync_(1), next_mailbox_(1) {} |
| 181 | 181 |
| 182 uint64_t next_fence_sync_; | 182 uint64_t next_fence_sync_; |
| 183 unsigned next_mailbox_; | 183 unsigned next_mailbox_; |
| 184 typedef base::hash_map<unsigned, scoped_refptr<TestTexture>> TextureMap; | 184 using TextureMap = std::unordered_map<unsigned, scoped_refptr<TestTexture>>; |
| 185 TextureMap textures_; | 185 TextureMap textures_; |
| 186 base::hash_map<unsigned, uint32_t> sync_point_for_mailbox_; | 186 std::unordered_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 GLuint64 insertFenceSync() override { | 196 GLuint64 insertFenceSync() override { |
| (...skipping 3416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3613 EXPECT_TRUE(resource_provider_->CanLockForWrite(id)); | 3613 EXPECT_TRUE(resource_provider_->CanLockForWrite(id)); |
| 3614 EXPECT_FALSE(resource_provider_->InUseByConsumer(id)); | 3614 EXPECT_FALSE(resource_provider_->InUseByConsumer(id)); |
| 3615 gpu_memory_buffer_manager_->SetGpuMemoryBufferIsInUseByMacOSWindowServer( | 3615 gpu_memory_buffer_manager_->SetGpuMemoryBufferIsInUseByMacOSWindowServer( |
| 3616 gpu_memory_buffer, true); | 3616 gpu_memory_buffer, true); |
| 3617 EXPECT_FALSE(resource_provider_->CanLockForWrite(id)); | 3617 EXPECT_FALSE(resource_provider_->CanLockForWrite(id)); |
| 3618 EXPECT_TRUE(resource_provider_->InUseByConsumer(id)); | 3618 EXPECT_TRUE(resource_provider_->InUseByConsumer(id)); |
| 3619 } | 3619 } |
| 3620 | 3620 |
| 3621 } // namespace | 3621 } // namespace |
| 3622 } // namespace cc | 3622 } // namespace cc |
| OLD | NEW |