| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 // Overridden from internal::WorkerPoolTask: | 31 // Overridden from internal::WorkerPoolTask: |
| 32 virtual void RunOnWorkerThread(unsigned thread_index) OVERRIDE { | 32 virtual void RunOnWorkerThread(unsigned thread_index) OVERRIDE { |
| 33 // |buffer_| can be NULL in lost context situations. | 33 // |buffer_| can be NULL in lost context situations. |
| 34 if (!buffer_) { | 34 if (!buffer_) { |
| 35 // |needs_upload_| still needs to be true as task has not | 35 // |needs_upload_| still needs to be true as task has not |
| 36 // been canceled. | 36 // been canceled. |
| 37 needs_upload_ = true; | 37 needs_upload_ = true; |
| 38 return; | 38 return; |
| 39 } | 39 } |
| 40 SkBitmap bitmap; | 40 needs_upload_ = task_->RunOnWorkerThread(thread_index, buffer_, |
| 41 bitmap.setConfig(SkBitmap::kARGB_8888_Config, | 41 task_->resource()->size()); |
| 42 task_->resource()->size().width(), | |
| 43 task_->resource()->size().height()); | |
| 44 bitmap.setPixels(buffer_); | |
| 45 SkDevice device(bitmap); | |
| 46 needs_upload_ = task_->RunOnWorkerThread(&device, thread_index); | |
| 47 } | 42 } |
| 48 virtual void CompleteOnOriginThread() OVERRIDE { | 43 virtual void CompleteOnOriginThread() OVERRIDE { |
| 49 // |needs_upload_| must be be false if task didn't run. | 44 // |needs_upload_| must be be false if task didn't run. |
| 50 DCHECK(HasFinishedRunning() || !needs_upload_); | 45 DCHECK(HasFinishedRunning() || !needs_upload_); |
| 51 reply_.Run(!HasFinishedRunning(), needs_upload_); | 46 reply_.Run(!HasFinishedRunning(), needs_upload_); |
| 52 } | 47 } |
| 53 | 48 |
| 54 private: | 49 private: |
| 55 virtual ~PixelBufferWorkerPoolTaskImpl() {} | 50 virtual ~PixelBufferWorkerPoolTaskImpl() {} |
| 56 | 51 |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 | 669 |
| 675 throttle_state->SetInteger("bytes_available_for_upload", | 670 throttle_state->SetInteger("bytes_available_for_upload", |
| 676 kMaxPendingUploadBytes - bytes_pending_upload_); | 671 kMaxPendingUploadBytes - bytes_pending_upload_); |
| 677 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); | 672 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); |
| 678 throttle_state->SetInteger("scheduled_raster_task_count", | 673 throttle_state->SetInteger("scheduled_raster_task_count", |
| 679 scheduled_raster_task_count_); | 674 scheduled_raster_task_count_); |
| 680 return throttle_state.PassAs<base::Value>(); | 675 return throttle_state.PassAs<base::Value>(); |
| 681 } | 676 } |
| 682 | 677 |
| 683 } // namespace cc | 678 } // namespace cc |
| OLD | NEW |