| 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/tile_manager.h" | 5 #include "cc/tile_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 // The component order may be bgra if we're uploading bgra pixels to rgba | 548 // The component order may be bgra if we're uploading bgra pixels to rgba |
| 549 // texture. Mark contents as swizzled if image component order is | 549 // texture. Mark contents as swizzled if image component order is |
| 550 // different than texture format. | 550 // different than texture format. |
| 551 managed_tile_state.contents_swizzled = | 551 managed_tile_state.contents_swizzled = |
| 552 !PlatformColor::sameComponentOrder(tile->format_); | 552 !PlatformColor::sameComponentOrder(tile->format_); |
| 553 | 553 |
| 554 // Tile resources can't be freed until upload has completed. | 554 // Tile resources can't be freed until upload has completed. |
| 555 managed_tile_state.can_be_freed = false; | 555 managed_tile_state.can_be_freed = false; |
| 556 | 556 |
| 557 resource_pool_->resource_provider()->beginSetPixels(resource->id()); | 557 resource_pool_->resource_provider()->beginSetPixels(resource->id()); |
| 558 resource_pool_->resource_provider()->shallowFlushIfSupported(); |
| 558 managed_tile_state.resource = resource.Pass(); | 559 managed_tile_state.resource = resource.Pass(); |
| 559 tiles_with_pending_set_pixels_.push(tile); | 560 tiles_with_pending_set_pixels_.push(tile); |
| 560 | 561 |
| 561 ScheduleCheckForCompletedSetPixels(); | 562 ScheduleCheckForCompletedSetPixels(); |
| 562 } else { | 563 } else { |
| 563 resource_pool_->resource_provider()->releasePixelBuffer(resource->id()); | 564 resource_pool_->resource_provider()->releasePixelBuffer(resource->id()); |
| 564 resource_pool_->ReleaseResource(resource.Pass()); | 565 resource_pool_->ReleaseResource(resource.Pass()); |
| 565 managed_tile_state.resource_is_being_initialized = false; | 566 managed_tile_state.resource_is_being_initialized = false; |
| 566 } | 567 } |
| 567 | 568 |
| 568 DispatchMoreTasks(); | 569 DispatchMoreTasks(); |
| 569 } | 570 } |
| 570 | 571 |
| 571 void TileManager::DidFinishTileInitialization(Tile* tile) { | 572 void TileManager::DidFinishTileInitialization(Tile* tile) { |
| 572 ManagedTileState& managed_tile_state = tile->managed_state(); | 573 ManagedTileState& managed_tile_state = tile->managed_state(); |
| 573 DCHECK(managed_tile_state.resource); | 574 DCHECK(managed_tile_state.resource); |
| 574 managed_tile_state.resource_is_being_initialized = false; | 575 managed_tile_state.resource_is_being_initialized = false; |
| 575 managed_tile_state.can_be_freed = true; | 576 managed_tile_state.can_be_freed = true; |
| 576 for (int i = 0; i < NUM_TREES; ++i) | 577 for (int i = 0; i < NUM_TREES; ++i) |
| 577 drawable_tiles_in_bin_count_[managed_tile_state.bin[i]][i]++; | 578 drawable_tiles_in_bin_count_[managed_tile_state.bin[i]][i]++; |
| 578 } | 579 } |
| 579 | 580 |
| 580 } // namespace cc | 581 } // namespace cc |
| OLD | NEW |