| 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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 | 368 |
| 369 // In the case of context lost, this sync token may be empty (see comment in | 369 // In the case of context lost, this sync token may be empty (see comment in |
| 370 // the UpdateSyncToken() function). The WaitSyncTokenCHROMIUM() function | 370 // the UpdateSyncToken() function). The WaitSyncTokenCHROMIUM() function |
| 371 // handles empty sync tokens properly so just wait anyways and update the | 371 // handles empty sync tokens properly so just wait anyways and update the |
| 372 // state the synchronized. | 372 // state the synchronized. |
| 373 gl->WaitSyncTokenCHROMIUM(mailbox_.sync_token().GetConstData()); | 373 gl->WaitSyncTokenCHROMIUM(mailbox_.sync_token().GetConstData()); |
| 374 SetSynchronized(); | 374 SetSynchronized(); |
| 375 } | 375 } |
| 376 | 376 |
| 377 ResourceProvider::Child::Child() | 377 ResourceProvider::Child::Child() |
| 378 : gpu_memory_buffer_client_id(-1), | 378 : marked_for_deletion(false), needs_sync_tokens(true) {} |
| 379 marked_for_deletion(false), | |
| 380 needs_sync_tokens(true) {} | |
| 381 | 379 |
| 382 ResourceProvider::Child::Child(const Child& other) = default; | 380 ResourceProvider::Child::Child(const Child& other) = default; |
| 383 | 381 |
| 384 ResourceProvider::Child::~Child() {} | 382 ResourceProvider::Child::~Child() {} |
| 385 | 383 |
| 386 ResourceProvider::ResourceProvider( | 384 ResourceProvider::ResourceProvider( |
| 387 ContextProvider* compositor_context_provider, | 385 ContextProvider* compositor_context_provider, |
| 388 SharedBitmapManager* shared_bitmap_manager, | 386 SharedBitmapManager* shared_bitmap_manager, |
| 389 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 387 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 390 BlockingTaskRunner* blocking_main_thread_task_runner, | 388 BlockingTaskRunner* blocking_main_thread_task_runner, |
| (...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 | 1274 |
| 1277 void ResourceProvider::SynchronousFence::Wait() { | 1275 void ResourceProvider::SynchronousFence::Wait() { |
| 1278 HasPassed(); | 1276 HasPassed(); |
| 1279 } | 1277 } |
| 1280 | 1278 |
| 1281 void ResourceProvider::SynchronousFence::Synchronize() { | 1279 void ResourceProvider::SynchronousFence::Synchronize() { |
| 1282 TRACE_EVENT0("cc", "ResourceProvider::SynchronousFence::Synchronize"); | 1280 TRACE_EVENT0("cc", "ResourceProvider::SynchronousFence::Synchronize"); |
| 1283 gl_->Finish(); | 1281 gl_->Finish(); |
| 1284 } | 1282 } |
| 1285 | 1283 |
| 1286 int ResourceProvider::CreateChild(const ReturnCallback& return_callback, | 1284 int ResourceProvider::CreateChild(const ReturnCallback& return_callback) { |
| 1287 int gpu_memory_buffer_client_id) { | |
| 1288 DCHECK(thread_checker_.CalledOnValidThread()); | 1285 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1289 | 1286 |
| 1290 Child child_info; | 1287 Child child_info; |
| 1291 child_info.return_callback = return_callback; | 1288 child_info.return_callback = return_callback; |
| 1292 child_info.gpu_memory_buffer_client_id = gpu_memory_buffer_client_id; | |
| 1293 | 1289 |
| 1294 int child = next_child_++; | 1290 int child = next_child_++; |
| 1295 children_[child] = child_info; | 1291 children_[child] = child_info; |
| 1296 return child; | 1292 return child; |
| 1297 } | 1293 } |
| 1298 | 1294 |
| 1299 void ResourceProvider::SetChildNeedsSyncTokens(int child_id, bool needs) { | 1295 void ResourceProvider::SetChildNeedsSyncTokens(int child_id, bool needs) { |
| 1300 ChildMap::iterator it = children_.find(child_id); | 1296 ChildMap::iterator it = children_.find(child_id); |
| 1301 DCHECK(it != children_.end()); | 1297 DCHECK(it != children_.end()); |
| 1302 it->second.needs_sync_tokens = needs; | 1298 it->second.needs_sync_tokens = needs; |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1977 | 1973 |
| 1978 const int kImportance = 2; | 1974 const int kImportance = 2; |
| 1979 pmd->CreateSharedGlobalAllocatorDump(guid); | 1975 pmd->CreateSharedGlobalAllocatorDump(guid); |
| 1980 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 1976 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
| 1981 } | 1977 } |
| 1982 | 1978 |
| 1983 return true; | 1979 return true; |
| 1984 } | 1980 } |
| 1985 | 1981 |
| 1986 } // namespace cc | 1982 } // namespace cc |
| OLD | NEW |