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

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: Fix raster-on-demand codepath 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());
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698