| 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/pixel_buffer_raster_worker_pool.h" | 5 #include "cc/resources/pixel_buffer_raster_worker_pool.h" |
| 6 | 6 |
| 7 #include "base/containers/stack_container.h" | 7 #include "base/containers/stack_container.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "cc/debug/traced_value.h" | 10 #include "cc/debug/traced_value.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 // Overridden from internal::WorkerPoolTask: | 35 // Overridden from internal::WorkerPoolTask: |
| 36 virtual void RunOnWorkerThread(unsigned thread_index) OVERRIDE { | 36 virtual void RunOnWorkerThread(unsigned thread_index) OVERRIDE { |
| 37 // |buffer_| can be NULL in lost context situations. | 37 // |buffer_| can be NULL in lost context situations. |
| 38 if (!buffer_) { | 38 if (!buffer_) { |
| 39 // |needs_upload_| still needs to be true as task has not | 39 // |needs_upload_| still needs to be true as task has not |
| 40 // been canceled. | 40 // been canceled. |
| 41 needs_upload_ = true; | 41 needs_upload_ = true; |
| 42 return; | 42 return; |
| 43 } | 43 } |
| 44 SkBitmap bitmap; | 44 needs_upload_ = task_->RunOnWorkerThread(thread_index, |
| 45 bitmap.setConfig(SkBitmap::kARGB_8888_Config, | 45 buffer_, |
| 46 task_->resource()->size().width(), | 46 task_->resource()->size()); |
| 47 task_->resource()->size().height()); | |
| 48 bitmap.setPixels(buffer_); | |
| 49 SkBitmapDevice device(bitmap); | |
| 50 needs_upload_ = task_->RunOnWorkerThread(&device, thread_index); | |
| 51 } | 47 } |
| 52 virtual void CompleteOnOriginThread() OVERRIDE { | 48 virtual void CompleteOnOriginThread() OVERRIDE { |
| 53 // |needs_upload_| must be be false if task didn't run. | 49 // |needs_upload_| must be be false if task didn't run. |
| 54 DCHECK(HasFinishedRunning() || !needs_upload_); | 50 DCHECK(HasFinishedRunning() || !needs_upload_); |
| 55 reply_.Run(!HasFinishedRunning(), needs_upload_); | 51 reply_.Run(!HasFinishedRunning(), needs_upload_); |
| 56 } | 52 } |
| 57 | 53 |
| 58 private: | 54 private: |
| 59 virtual ~PixelBufferWorkerPoolTaskImpl() {} | 55 virtual ~PixelBufferWorkerPoolTaskImpl() {} |
| 60 | 56 |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 | 686 |
| 691 throttle_state->SetInteger("bytes_available_for_upload", | 687 throttle_state->SetInteger("bytes_available_for_upload", |
| 692 max_bytes_pending_upload_ - bytes_pending_upload_); | 688 max_bytes_pending_upload_ - bytes_pending_upload_); |
| 693 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); | 689 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); |
| 694 throttle_state->SetInteger("scheduled_raster_task_count", | 690 throttle_state->SetInteger("scheduled_raster_task_count", |
| 695 scheduled_raster_task_count_); | 691 scheduled_raster_task_count_); |
| 696 return throttle_state.PassAs<base::Value>(); | 692 return throttle_state.PassAs<base::Value>(); |
| 697 } | 693 } |
| 698 | 694 |
| 699 } // namespace cc | 695 } // namespace cc |
| OLD | NEW |