Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: cc/resources/pixel_buffer_raster_worker_pool.cc

Issue 21159007: cc: Adding support for RGBA_4444 tile textures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move stride check to RWP Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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()); 47 0);
48 bitmap.setPixels(buffer_);
49 SkBitmapDevice device(bitmap);
50 needs_upload_ = task_->RunOnWorkerThread(&device, thread_index);
51 } 48 }
52 virtual void CompleteOnOriginThread() OVERRIDE { 49 virtual void CompleteOnOriginThread() OVERRIDE {
53 // |needs_upload_| must be be false if task didn't run. 50 // |needs_upload_| must be be false if task didn't run.
54 DCHECK(HasFinishedRunning() || !needs_upload_); 51 DCHECK(HasFinishedRunning() || !needs_upload_);
55 reply_.Run(!HasFinishedRunning(), needs_upload_); 52 reply_.Run(!HasFinishedRunning(), needs_upload_);
56 } 53 }
57 54
58 private: 55 private:
59 virtual ~PixelBufferWorkerPoolTaskImpl() {} 56 virtual ~PixelBufferWorkerPoolTaskImpl() {}
60 57
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 // another check. 216 // another check.
220 check_for_completed_raster_tasks_callback_.Cancel(); 217 check_for_completed_raster_tasks_callback_.Cancel();
221 check_for_completed_raster_tasks_pending_ = false; 218 check_for_completed_raster_tasks_pending_ = false;
222 ScheduleCheckForCompletedRasterTasks(); 219 ScheduleCheckForCompletedRasterTasks();
223 220
224 TRACE_EVENT_ASYNC_STEP1( 221 TRACE_EVENT_ASYNC_STEP1(
225 "cc", "ScheduledTasks", this, StateName(), 222 "cc", "ScheduledTasks", this, StateName(),
226 "state", TracedValue::FromValue(StateAsValue().release())); 223 "state", TracedValue::FromValue(StateAsValue().release()));
227 } 224 }
228 225
229 GLenum PixelBufferRasterWorkerPool::GetResourceFormat() const { 226 ResourceFormat PixelBufferRasterWorkerPool::GetResourceFormat() const {
230 return resource_provider()->best_texture_format(); 227 return resource_provider()->memory_efficient_texture_format();
231 } 228 }
232 229
233 void PixelBufferRasterWorkerPool::CheckForCompletedTasks() { 230 void PixelBufferRasterWorkerPool::CheckForCompletedTasks() {
234 TRACE_EVENT0("cc", "PixelBufferRasterWorkerPool::CheckForCompletedTasks"); 231 TRACE_EVENT0("cc", "PixelBufferRasterWorkerPool::CheckForCompletedTasks");
235 232
236 RasterWorkerPool::CheckForCompletedTasks(); 233 RasterWorkerPool::CheckForCompletedTasks();
237 CheckForCompletedUploads(); 234 CheckForCompletedUploads();
238 FlushUploads(); 235 FlushUploads();
239 236
240 TaskDeque completed_tasks; 237 TaskDeque completed_tasks;
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 670
674 throttle_state->SetInteger("bytes_available_for_upload", 671 throttle_state->SetInteger("bytes_available_for_upload",
675 max_bytes_pending_upload_ - bytes_pending_upload_); 672 max_bytes_pending_upload_ - bytes_pending_upload_);
676 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); 673 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_);
677 throttle_state->SetInteger("scheduled_raster_task_count", 674 throttle_state->SetInteger("scheduled_raster_task_count",
678 scheduled_raster_task_count_); 675 scheduled_raster_task_count_);
679 return throttle_state.PassAs<base::Value>(); 676 return throttle_state.PassAs<base::Value>();
680 } 677 }
681 678
682 } // namespace cc 679 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698