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

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: fixed a signed vs. unsigned comparison in video_resource_updater.cc 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
« no previous file with comments | « cc/resources/pixel_buffer_raster_worker_pool.h ('k') | cc/resources/platform_color.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // another check. 209 // another check.
213 check_for_completed_raster_tasks_callback_.Cancel(); 210 check_for_completed_raster_tasks_callback_.Cancel();
214 check_for_completed_raster_tasks_pending_ = false; 211 check_for_completed_raster_tasks_pending_ = false;
215 ScheduleCheckForCompletedRasterTasks(); 212 ScheduleCheckForCompletedRasterTasks();
216 213
217 TRACE_EVENT_ASYNC_STEP1( 214 TRACE_EVENT_ASYNC_STEP1(
218 "cc", "ScheduledTasks", this, StateName(), 215 "cc", "ScheduledTasks", this, StateName(),
219 "state", TracedValue::FromValue(StateAsValue().release())); 216 "state", TracedValue::FromValue(StateAsValue().release()));
220 } 217 }
221 218
222 GLenum PixelBufferRasterWorkerPool::GetResourceFormat() const { 219 ResourceFormat PixelBufferRasterWorkerPool::GetResourceFormat() const {
223 return resource_provider()->best_texture_format(); 220 return resource_provider()->memory_efficient_texture_format();
224 } 221 }
225 222
226 void PixelBufferRasterWorkerPool::CheckForCompletedTasks() { 223 void PixelBufferRasterWorkerPool::CheckForCompletedTasks() {
227 TRACE_EVENT0("cc", "PixelBufferRasterWorkerPool::CheckForCompletedTasks"); 224 TRACE_EVENT0("cc", "PixelBufferRasterWorkerPool::CheckForCompletedTasks");
228 225
229 RasterWorkerPool::CheckForCompletedTasks(); 226 RasterWorkerPool::CheckForCompletedTasks();
230 CheckForCompletedUploads(); 227 CheckForCompletedUploads();
231 FlushUploads(); 228 FlushUploads();
232 229
233 TaskDeque completed_tasks; 230 TaskDeque completed_tasks;
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 663
667 throttle_state->SetInteger("bytes_available_for_upload", 664 throttle_state->SetInteger("bytes_available_for_upload",
668 max_bytes_pending_upload_ - bytes_pending_upload_); 665 max_bytes_pending_upload_ - bytes_pending_upload_);
669 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); 666 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_);
670 throttle_state->SetInteger("scheduled_raster_task_count", 667 throttle_state->SetInteger("scheduled_raster_task_count",
671 scheduled_raster_task_count_); 668 scheduled_raster_task_count_);
672 return throttle_state.PassAs<base::Value>(); 669 return throttle_state.PassAs<base::Value>();
673 } 670 }
674 671
675 } // namespace cc 672 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/pixel_buffer_raster_worker_pool.h ('k') | cc/resources/platform_color.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698